2

I am trying to map <A-b> to <C-left> in insert mode in neovim. When I press <A-b> it just inserts the character 0, but when I start neovim with --clean (so all configurations are ignored), it works as expected, and the cursor moves one word backwards. I use alacritty, but it was the same in other terminals like kitty too. This is what I use to remap: vim.keymap.set('i', '<A-b>', '<C-left>'). Output of :verbose map <A-b> is No mapping found. It's the same even if I set the keybind with :inoremap <A-b> <C-left> inside neovim after everything has loaded.

Edit: There was a conflict with the auto-pairs plugin. After I disabled it, the keybinding worked as it should.

2
  • Could you tell us what is the result of the following command: :verbose map <A-b>? Mar 5, 2023 at 21:08
  • Could you tell us which command do you use to map <A-b>? Mar 5, 2023 at 21:09

1 Answer 1

0

It seems that your mapping is in conflict with a plugin mapping.

You can try two things

  1. Make sure your mapping is not remapped
  2. Verify that your mapping is not overriden
:verbose map <A-b>

Remapping:

If you map <A-b> to <C-left> with:

imap <A-b> <C-left>

But that <C-left> is mapped by a plugin to 0 then <A-b> is mapped to 0.

The solution could be to use inoremap instead

inoremap <A-b> <C-left>

Overridden

If you map in .vimrc your mapping can be overridden by a plugin code that is executed later.

You can analyze the situation with the following command:

verbose map <A-b>

If your mapping is overridden you could use the following command to make your mapping win:

augroup mymapping
  autocmd VimEnter * inoremap <A-b> <C-left>
augroup END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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