Am 20.08.2010 15:50, schrieb Andy Wokula:
Am 20.08.2010 15:16, schrieb Aarto Matti:
Hi,

I wonder if there a way to access the last command even if it comes from
mapping. Vim help says I can't:

": Contains the most recent executed command-line. Example: Use
"@:" to repeat the previous command-line command.
The command-line is only stored in this register when at least
one character of it was typed. Thus it remains unchanged if
the command was completely from a mapping.

I have a mapping that enables the command mode and prints a command there,
so I only need to press enter to execute it. The command doesn't get saved
into ": register because I didn't type a single character, fair enough.
However if I move the cursor with left or right arrow then it counts as
typing and the command get saved. Eh? Any ideas how can I overcome that
bug/limitation and access the last command no matter where it comes from?

:call histadd(":", "MyCmd")
:h histadd()

ok, this was not a very good suggestion ...
try this one:

:call feedkeys(":MyCmd\r", "t")

Now keys are fed as if typed -> the ":" register is changed.

--
Andy

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