tpope / vim-rsi

rsi.vim: Readline style insertion
http://www.vim.org/scripts/script.php?script_id=4359
590 stars 36 forks source link

Add support for <M-BS> as delete-backward-word #3

Closed jdelkins closed 10 years ago

jdelkins commented 11 years ago

Although <C-W> is perfectly useful already, one of the readline key bindings I use a lot is <M-BS> ("delete-backward-word"). However, implementing this is complicated by the fact that it is apparently impossible(?) to get the actual backspace key within vim. Attempts to, for example,

    exe "set <F34>=\<Esc>\<BS>"

result in <F34> being set to <Esc><80>fb, which is probably some internal indirect reference to the termcap variable, and, moreover, doesn't work. Inexplicably, as well, one cannot retrieve the value of &t_xx (&t_fb specifically is what we want here) termcap options in vim script.

As far as I know, in the modern era, terminals generally use either <C-H> or <C-?> for backspace; and sometimes these are transposed with the bindings for <Del>. My brutish solution is to bind both <Esc><C-H> and <Esc><C-?> to the desired function. The consequence is that, for some terminals, <M-Del> might be bound to the same as <M-BS>, but I don't think <M-Del> means anything in readline anyhow.

evanpurkhiser commented 11 years ago

Any chance of seeing this merged in? Old habits die hard, and this is one of them. :+1:

aaronjensen commented 10 years ago

I'm a fan of this, it'd be nice to see it merged in. For now I just added it to my vimrc directly

tpope commented 10 years ago

I suppose this would be fine. What's with the 3 commits?

aaronjensen commented 10 years ago

no idea, squashed into #10

jdelkins commented 10 years ago

I suck at git. Sorry for the 3 commits -- it was inadvertent.