cohama / lexima.vim

Auto close parentheses and repeat by dot dot dot...
995 stars 46 forks source link

Neovim : <C-h> needs to be overridden #55

Closed bryanmaina closed 8 years ago

bryanmaina commented 8 years ago

I want to bind <C-h> in neovim to move cursor left in insert mode. But it can't work.

nnoremap <C-h> <C-w>h " only C-h does not work.
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

This is what I added to my .vimrc to try to make it work and it still doesn't work :

if has('nvim')
  " Hack to get C-h working in NeoVim
  nmap <BS> <C-W>h
endif

verbose imap <BS> gives me this result

i  <BS>        * lexima#expand('<BS>', 'i')
        Last set from ~/.vim/plugged/lexima.vim/autoload/lexima/insmode.vim

Someone here told me this :

@aemb You are mapping in normal mode, not insert mode, so the plugin takes over. It might override it even if you do map it in insert mode, but that will depend on how well behaved it is.

How can I override the plugin mapping ?

cohama commented 8 years ago

You need to learn about mappings. See :help map-overview lexima.vim does not touch normal mappings. If you want to override any key in insert mode, use imap instead of nmap.

Pleae note that your imap is put after lexima#init() since grantee the definition order.

" force init lexima.vim
call lexima#init()
" override the lexima's mapping
inoremap <C-h> <Left>