Saturday, November 5, 2011

Re: mapping ALT-backspace

Benjamin R. Haskell <vim@benizi.com> [11-11-05 17:36]:
> On Sat, 5 Nov 2011, Benjamin R. Haskell wrote:
>
> >On Sat, 5 Nov 2011, meino.cramer@gmx.de wrote:
> >
> >>For me the question remains, whether zsh from which vim is started
> >>recognizes ALT-Backspace well and vim does not... ?!
> >
>
> Also, more to the point, see what Zsh thinks represents alt+backspace
> for you:
>
> (in zsh:)
> $ bindkey -L | grep backward-kill-word
>
>
> For me, that returns:
> bindkey "^W" backward-kill-word
> bindkey "^[^H" backward-kill-word
> bindkey "^[^?" backward-kill-word
>
> Which means that all three of <Ctrl>+<w>, <Alt>+<Delete> (==
> <Esc>+<Delete>), and <Alt>+<Backspace> (== <Esc>+<Backspace>) do the
> same thing. Maybe your Backspace and Delete are reversed? (Seems
> unlikely, because that makes operating in Vim kind of awkward, IMO, so
> you'd've probably fixed it already.)
>
> See:
>
> :help :fixdel
>
> --
> Best,
> Ben
>
> --
> 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
>

Hi Benjamin,

I want to summarize, what I have found:
I am using vim under linux -- gvim is used very very very seldom.
The TERM variable is set to:xterm-256color.
I am using utf-8.

First experiment:
Using ALT-BS under zsh works. bindkey -L | grep backward-kill-word
gives me:
bindkey "^W" backward-kill-word
bindkey "^[^H" backward-kill-word
bindkey "^[^?" backward-kill-word

which seems to be the same as what you see with your zsh...

Second experiment:
Opening vim from this zsh/terminal and
doing CTRL-k ALT-Backspace in insert mode gives: <nothing>
Same goes for CTRL-v
No trying to insert ALT-backspace on the commandline of vim:
This puts me back to the buffer, leaving the commandline.
=> There is "something", vim recognizing, otherwise it stay
in the commandline. But it seems not enough to be recognized
as a valid keystroke.

Now trying <ESC><BS> as keystrokes, same experiments:
In insert mode, the <ESC> key puts me back to command mode
instantly.
Commandline: Same scenario.

In /etc/inputrc (this is the only inputrcon this system) there is set:

set input-meta on # Enable Meta input with eighth bit set
set meta-flag on # Synonym for the above
set convert-meta off # Do NOT strip the eighth bit
set output-meta on # Enable Meta output with eighth bit set

Regarding to the ctrl-v- and ctrl-k-experiments there would be no
hope to get any mapping with ALT-backspace working.
From what can be acchieved with zsh and regarding to the inputrc
it /should/ work nevertheless.

Finally I put a
nmap <esc><bs> db
into the .vimrc

and...it works! After all I dont know why.

Final thing I want to fix (help appreciated ;)
is this:
When I put a "imap <esc><bs> :normal db<cr>"
into .vimrc and restart vim to execute ALT-backspace
in input mode it prints :normal db at the cursor
position and jumps to the next line.
Is there a way to get it working in input mode also?

Best regards and have a nice sunday!
mcc

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