tpope / vim-rsi

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

Meta mappings interfere with vim's :terminal meta mappings #46

Closed knatsakis closed 2 years ago

knatsakis commented 6 years ago

Meta mappings inside a vim terminal stop working when vim-rsi is loaded.

Opening a vim terminal (:terminal) and typing Alt+f produces ';2C', Alt+b produces ';2D', etc...

I am using vim version 8.1.0229 and zsh.

cwfoo commented 5 years ago

@tpope Is there a way to disable this plugin when using :terminal? The terminal (e.g. bash) already comes with its own readline keybindings, and vim-rsi seems to interfere with them.

tpope commented 5 years ago

You can opt out of meta mappings entirely, but no, there isn't a way to selectively disable set <M-b>=... in :terminal. For the first time in my life I am jealous of N****m.

lacygoill commented 3 years ago

This patch should fix the issue:

diff --git a/plugin/rsi.vim b/plugin/rsi.vim
index 8ecf2b3..61ab2b0 100644
--- a/plugin/rsi.vim
+++ b/plugin/rsi.vim
@@ -87,11 +87,16 @@ else
   silent! exe "set <F34>=\<Esc>\<C-?>"
   silent! exe "set <F35>=\<Esc>\<C-H>"
   noremap!        <F29> <S-Left>
+  tnoremap        <F29> <Esc>b
   noremap!        <F30> <S-Right>
+  tnoremap        <F30> <Esc>f
   noremap!        <F31> <C-O>dw
   cnoremap        <F31> <S-Right><C-W>
+  tnoremap        <F31> <Esc>d
   noremap!        <F32> <Down>
+  tnoremap        <F32> <Esc>n
   noremap!        <F33> <Up>
+  tnoremap        <F32> <Esc>p
   noremap!        <F34> <C-W>
   noremap!        <F35> <C-W>
   augroup rsi_gui

I explain how it works here.