On 06/05/2011 12:30 PM, Tim Johnson wrote:
I'm unclear about when to use and when *not* to use the colon in a
string for the `execute' command - as composed programmatically.

I'd appreciate it if someone could point me to some documentation or
discussion on this topic.

:h execute
doesn't seem to clear this question up for me.

As far as I can tell, the colon is *never* needed in the string used by :exec command as the resulting string is (per ":help :execute") executed as an Ex command. Explicitly stated in usr_41.txt (around line 498)

"""
The ":execute" command can only execute colon commands.
"""


The possible extra bit of information you may want is that any extra colons are ignored in an Ex command, so you can (pointlessly) do

  ::::echo 42

which is the same as

  :echo 42

This is obliquely mentioned in ":help cmdline.txt" if you search for the word "colon" (around line 572 in my older 7.2 that comes with Debian):

"""
A colon is allowed between the range and the command name. It is ignored (this is Vi compatible). For example:

        :1,$:s/pat/string
"""

Hope that sheds light on why you sometimes do/don't see a colon in an :execute command...they're superfluous :)

-tim



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

Reply via email to