Thursday, July 22, 2010

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

On Jul 22, 1:43 am, "Romeyke, Andreas" <andreas.rome...@dzb.de> wrote:
> Hello,
>
> To show a UI-concept I would reconfigure vim. The plan is that the user
> writes text. If the user type !command (where command is an editor
> command defined somewhere) the command should be executed directly. The
> idea is not to switch explicitely between command layer and editing
> layer (as with the esc-key in vim)
>

I mean no offense, but I think your approach, of actually entering the
command text in insert mode, then somehow grabbing that text and doing
the command without ever leaving insert mode and with no extra
keystrokes to trigger the behavior, is a terrible idea.

A much better approach, in my opinion, that does almost the same thing
is something like:

inoremap <F7> <C-\><C-O>:

This mapping will allow the user to hit the <F7> key to go into
command-line mode for a single command. The user will then type the
command and hit enter, returning to insert mode exactly where they
left off.

You could map any other key rather than F7. Normally people use non-
printable sequences like CTRL or ALT combinations, but you could also
use infrequently typed things like two capital letters in a row, or
two '!' characters in a row, or anything else.

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