0

I'm trying to add some readline keybindings into insert mode, like below,

inoremap <C-B> <Left>
inoremap <C-F> <Right>
inoremap <A-B> <C-Left>
inoremap <A-F> <C-Right>

The fist two work fine. However, when I try A-B, it goes back one word but changes the mode to normal mode. Also, A-f only acts as Esc key, changes the mode to normal mode. I have other Alt keybindings but they work fine. not sure what is special about these two.

NVIM v0.4.4 Debian buster/sid

Edit: some more info

  • terminal emulator: alacritty v0.4.3,
  • I don't use tmux and the like,
  • in terminal alt is ^[
  • in neovim alt is M for meta
  • TERM=xterm-256color
12
  • 1
    Welcome to Vi and Vim! Please also mention which terminal emulator you're using. And, if possible, which $TERM value you have. Are you inside tmux or screen or similar? If on the shell you start a command such as cat and type <Alt-F> or <Alt-B>, what shows up? Inside Vim, in insert mode, what does the sequences <Ctrl-V><Alt-F> produce? – filbranden Nov 21 '20 at 22:42
  • 1
    @filbranden Thank you! my terminal emulator is alacritty v0.4.3. I don't use tmux and the like. in cat I see ^[f and ^[b respectively for A-f and A-b. inside neovim <Ctrl-V><Alt-F> produces <M-f>! it seems, in neovim alt acts as meta but in terminal alt is some escape sequence, so there is no meta key to be pressed actually. I'll update the question with these information. – ali b Nov 21 '20 at 23:14
  • 1
    @filbranden sorry, I forgot. echo $term = xterm-256color – ali b Nov 21 '20 at 23:37
  • 1
    @filbranden sorry, i forgot again. export TERM=alacritty didn't help. – ali b Nov 22 '20 at 0:21
  • 1
    @filbranden I think I found pretty much what I needed. It's tim pope's vim-rsi plugin. It works in urxvt and xfce4-terminal. I havent checked it yet on alacritty since I moved to urxvt. Nevertheless, I'm not sure if this is the answer to the question or not. I'll put an edit in my question. – ali b Dec 3 '20 at 20:49
1

If you want readline in your vim/neovim (my goal of asking this question), simply use Tim Pope's vim-rsi plugin.

1
  • Thanks for posting it as an answer! – filbranden Dec 10 '20 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.