Remap ctrl-j and ctrl-k in vim

keyboard shortcutsvimvimrc

I would like to remap ctrl + j to ctrl + d, and ctrl + k to ctrl + u for moving half a page down and up in normal mode. I have tried with

noremap <c-j> <c-d>
noremap <c-k> <c-u>

in my .vimrc, but the key function does not change.

I read on the vim wiki that

The Ctrl-J character represents the linefeed and is internally used by Vim to represent the Nul character. You cannot create a map for Ctrl-J by using the following command:

"The following command doesn't work

:imap Newlinecharacter

Is there any way to remap ctrl + j and ctrl + k in vim?

Best Answer

With those, you first need to unmap them:

For example, for CTRL+J put the following line in the file '.vimrc':

let g:BASH_Ctrl_j = 'off'