On 30/07/12 1:10 PM, Bee wrote:
On Jul 29, 7:24 pm, Ben Fritz<[email protected]> 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>"
The :normal command doesn't understand <>-notation, so it needs bona
fide control-W characters in its argument. Using :execute with a
double-quoted string and the \< escape inside it (:help expr-quote)
facilitates that, while still keeping the code readable, representable
and printable in valid Unicode text, etc..
Ben.
--
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