Currently, my vimrc contains the linesnnoremap j gjxnoremap j gjnnoremap gj jxnoremap gj jnnoremap k gkxnoremap k gknnoremap gk kxnoremap gk kThis way, the j key in both visual and normal mode will go to the next displayed line, not the next actual line. However, this is rather silly in visual line mode, since, well, it only operates on actual lines. It doesn't make much sense in visual block mode either.How can I make a mapping apply only in visual mode, not visual line mode or visual block mode?
How can I create a mapping only in plain visual mode?
key bindings;visual mode
You could rewrite your mappings as expression mappings:xnoremap <expr> j  mode() ==# v ? gj : jxnoremap <expr> gj mode() ==# v ? j  : jxnoremap <expr> k  mode() ==# v ? gk : kxnoremap <expr> gk mode() ==# v ? k  : gkSee :help <expr> and :help mode().