christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.07k stars 319 forks source link

Custom key maps don't work in neovim [solved] #315

Closed urob closed 2 years ago

urob commented 2 years ago

SOLVED: Everything seems to work fine today. I am not exactly sure why. My guess is that it is related to restarting vim and tmux instead of resourcing their configurations. Anyhow, this can be closed.


I encountered a very strange issue in NVIM v0.6.1 with tmux 3.2a and with the latest vim-tmux-navigator installed using vim-plug. When I set let g:tmux_navigator_no_mappings = 0 in my vim configuration file (init.vim in nvim), then everything works as expected. However, including the defaults defined in tmux_navigator.vim directly in my own init.vim breaks the configuration:

" Loading default bindings works
let g:tmux_navigator_no_mappings = 0 
" Replicating default bindings myself won't work
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
nnoremap <silent> <c-\> :TmuxNavigatePrevious<cr>

With the latter configuration, none of the maps are recognized inside vim, and pressing c-h will simply result in h etc. It seems that binding keys to the TmuxNavigator from within init.vim has no effect (at least when tmux-navigator is installed using vim-plug manager).

Note: this is not an issue of conflicting bindings (I have no other bindings involving CTRL). Also, for a quick sanity check: mapping nnoremap <silent> <c-h> :echo "test"<cr> works as expected. So it seems to be really something unique about the interaction of nvim and the TmuxNavigator.

(This might be related to: https://github.com/christoomey/vim-tmux-navigator/issues/140)

ahillio commented 2 years ago

Anyhow, this can be closed.

You gotta close it yourself... rather than change title, click the button to close the issue ;^)