Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customized copyright #6

Open
bo-wu opened this issue Feb 8, 2021 · 2 comments
Open

customized copyright #6

bo-wu opened this issue Feb 8, 2021 · 2 comments

Comments

@bo-wu
Copy link

bo-wu commented Feb 8, 2021

Hi authors,

Thanks a lot for the excellent plugin. I use it for quite well, now I want to do some customization. However, I do not know the grammar of vimscript. I also search around and did not find the corrected answer.

The specific customization is changing
call append(l + 7, g:file_copyright_comment_mid_prefix." Last Modified : ".strftime("%Y-%m-%d %H:%M"))
to
call append(l + 13, g:file_copyright_comment_mid_prefix." \\date ".strftime("%Y/%m/%d %H:%M"))

And I also change
let regline = '^'.g:file_copyright_comment_mid_prefix.'\s*\S*Last\sModified\s*:\s*\S*.*$'
execute '/'.g:file_copyright_comment_mid_prefix.'\s*\S*Last\sModified\s*:/s@:.*$@\=strftime(": %Y-%m-%d %H:%M")@'
to
let regline = '^'.g:file_copyright_comment_mid_prefix.'\s*\\date\s*\s*.*$'
execute '/'.g:file_copyright_comment_mid_prefix.'\s*\\date\s*/s@*$@\=strftime("%Y/%m/%d %H:%M")@'
for update

The changes works well, but when I use "CopyrightUpdate", It seems something wrong with string match, and resulting double title. Could you please help me correcting the matching pattern?

thanks in advance

@bbxytl
Copy link
Member

bbxytl commented Feb 9, 2021

git pull
call append(l + 7, g:file_copyright_comment_mid_prefix."   date          :".strftime("%Y/%m/%d %H:%M"))
let regline = '^'.g:file_copyright_comment_mid_prefix.'\s*\S*date\s*\s*.*$'
execute '/^'.g:file_copyright_comment_mid_prefix.'\s*\S*date\s*:/s@:.*$@\=": ".strftime("%Y/%m/%d %H:%M")@'

image

@bo-wu
Copy link
Author

bo-wu commented Feb 10, 2021

@bbxytl Thank you for the reply.
I tried, seems not work for me, it appears double titles instead of updatingt the title.

The specific pattern I want is shown as the following image.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants