Friday, July 23, 2010

Re: Howto execute VIM-commands in editing mode, needed for prototype

Hi Andreas,

did I get the idea correct?

After writing a single ! do nothing until a space is typed (indicating
that the command has finished). Examples
line !TheCommand

then trigger :TheCommand?

Why?

I'd do this:

inoremap !! !
inoremap ! <c-o>

You have to hit <cr> at the end.
Why? If you switch to command line you
- have completion
- can pass arguments
- can pass line ranges
- its vim style.

given than ! is as much to type as <c-o> I'd stick to <c-o>.

Your idea could be implemented by imap <space>
<c-r>=GetLastWordExecuteThenRemoveIt()

where
fun GetLastWordExecuteThenRemoveIt()
command = " .. some glob pattern with getline and current cursor pos
or something like that
exec command
return repeat("\<bs>",len(command))
endf

But as I said earlier there is no reason because there is <c-o>

Marc Weber

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