Wednesday, March 26, 2014

Re: Question on .vimrc coding technique


On Mar 26, 2014 9:25 AM, "Singlestone" <vitonis@gmail.com> wrote:
>
> I just added the following lines to my .vimrc file:
>
>     let start_comment="\\/\\*"
>     let any_including_nl="\\_."
>     let non_greedy="\\{-}"
>     let end_comment="\\*\\/"
>
>     let full_c_comment=start_comment . any_including_nl . non_greedy .
> end_comment
>     nnoremap <leader>cc /^R=full_c_comment^M^M
>
> The intent is to make some regex building blocks that are easy to read and
> combine. It works fine so far. Any gotchas I should know about? Thanks.

It is better to use single quotes: this way you do not need to double escapes.

I would also omit using literal control characters: you can replace ^M with <CR> and ^R with <C-r>. Using literal control characters may force some tools (diff, grep, VCS) to treat your file as binary and does not let you see what exactly is there in the file without using editor or tools like hexdump.

>
>
>
> --
> View this message in context: http://vim.1045645.n5.nabble.com/Question-on-vimrc-coding-technique-tp5721131.html
> Sent from the Vim - General mailing list archive at Nabble.com.
>
> --
> --
> 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 because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: