Tuesday, January 26, 2010

Re: Control-

On 2010-01-26, Paul wrote:
> In gvim, when at vim's command line, I can do c-<left> and c-<right> to
> move the cursor to the previous/next word boundary. In normal vim, I cannot
> do this. It tries to enter the control code text "1;5D" into the document
> instead (and I lose the command that I was composing).
>
> I had a look at what :imap shows for both vim and gvim, but all those imaps
> are the same.
>
> Is there anything I can do to make c-<left> and c-<right> work at the :
> command in vim?

I'm not sure about this, but I think vim uses an internal
terminal-definition database to determine the escape sequences used
by some terminals for keys that don't have terminfo or termcap
definitions. The value of TERM in your environment may be one that
vim does not recognize as supporting c-<left> and c-<right>.

One solution is to set the value of TERM to one that vim recognizes
and whose terminfo database accurately reflects the capabilities of
your terminal. I think the ones vim recognizes are:

xterm
nxterm
kterm
mlterm
rxvt

Another solution would be to map the sequences your terminal emits
to the <C-Left> and <C-Right> key codes, e.g.,

:cmap <Esc>[1;5D <C-Left>
:cmap <Esc>[1;5C <C-Right>

> Also, I suppose there would be no way to make that work with standard
> readline? :help readline just brings up stuff about the readline.vim syntax
> file.

Do you mean have Ctrl-Left and Ctrl-Right work at the shell prompt
or do you mean have vim use readline? If you mean the latter, then
no. For the former, see

man readline

HTH,
Gary


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: