Monday, July 30, 2012

Re: when to use ' or "

On Monday, July 30, 2012 4:31:16 AM UTC-5, Ben Schmidt wrote:
> On 30/07/12 1:10 PM, Bee wrote:
>
> > On Jul 29, 7:24 pm, Ben Fritz<fritzophre...@gmail.com> wrote:
>
> >> On Friday, July 27, 2012 7:02:52 PM UTC-5, Bee wrote:
>
> >>> I tend to use ' around strings passed as arguments to functions or
>
> >>
>
> >>> commands, and use " for comments.
>
> >>
>
> >>> Comments... Please
>
> >>
>
> >> I use " for strings when I need to use special characters, e.g.
>
> >>
>
> >> :execute "nnoremap \<CR>" MyFuncResult()
>
> >>
>
> >> I also use " for strings which contain ' characters, like:
>
> >>
>
> >> :echo "I don't like to double up the ' characters"
>
> >>
>
> >> I use ' everywhere else, especially when I want to include a literal backslash or a " character in a string.
>
> >
>
> > Would your first example be simpler,
>
> > since ' suppresses special chars:
>
> >
>
> > :execute 'nnoremap<CR>' MyFuncResult()
>
>
>
> Perhaps it wasn't the best example. This example from :help :normal is
>
> perhaps more instructive (it moves the cursor to the next window).
>
>
>
> :exe "normal \<c-w>\<c-w>"
>
>
>

Yeah...oops. I meant to use something where the \<...> notation was needed. I wrote in a hurry...nnoremap was a bad example.

--
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: