It helped me.
On Wed, Jul 21, 2010 at 4:42 AM, John Little <john.b.little@gmail.com> wrote:
> autocmd Bufwritepre,filewritepre *.sv exe "1," . 30 . "g/Modified By
> :.*/s/Modified By :.*/Modified By: " .expand("$LOGNAME")
> Please let me know what went wrong.I can see two problems with this:
- If the file has less than 30 lines the 1,30 range will fail.
- Sometimes you have a space between "By" and the colon,
sometimes not. Maybe matching any white space there would be good,
say
/Modified By\s*:.*
Also, the command could be simpler:
autocmd BufWritePre,FileWritePre *.sv exe '1,30g/Modified By\s*:.*/s//
Modified By: ' . $LOGNAME
Note the single quotes, to avoid having to double the backslash.
Another thing, it's a good idea to put a set of auto commands like
this in a group; see :h augroup.
HTH, John
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment