1

This question already has an answer here:

I used to be able to navigate vim splits using

nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h

but now I cannot map the <C-j> sequence to any other command. Is this key combination not allowed to be remapped anymore?

I tried an empty .vimrc file (apart from the 4 lines above) and it does not work when using :sp for a horizontal split. All other navigation mappings work as expected. If I use other keys instead of j it also works. I tried on both gnome-terminal and the termite terminal emulators, running on Arch Linux. Im using vim 8.1:

:version
VIM - Vi IMproved 8.1

Edit: If I log into vim and type :nnoremap I see a list of the mappings for h, k and l, but not for j. If I then type :nnoremap <C-j> <C-w>j everything works fine. For some reason, vim is not loading the <C-j> map from the .vimrc file...

marked as duplicate by Herb Wolfe, peterh, user579, Christian Brabandt, Naumann Sep 13 '18 at 16:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @HerbWolfe the answer in the link you provided says its not a good idea to map <C-j> in insert mode only, but I'm trying on normal mode. Also, the command let g:BASH_Ctrl_j = 'off' did not have any effect. I have updated my question with new information. – Kevin Liu Sep 12 '18 at 17:08
  • 1
    The upvoted answer also says that Ctrl-J is interpreted as a null byte. See also these answers to similar questions: vi.stackexchange.com/a/3570/5298 and vi.stackexchange.com/a/10716/5298, in particular the comments regarding Gnome-Terminal. – Herb Wolfe Sep 12 '18 at 21:29
  • I don't think my problem is the same as in the other questions. As I stated in the OP, running the command :nnoremap <C-j> <C-w>j inside vim fixes the problem. This happens in gvim and vim, using gnome-terminal, termite, or xterm. – Kevin Liu Sep 17 '18 at 15:28
  • I have fixed the issue, vim-latexsuite was interfering with the mappings. Removing the vim-latexsuite package solved the problem. – Kevin Liu Sep 17 '18 at 17:17

Browse other questions tagged or ask your own question.