vim mapping not working with slimv plugin

279 views Asked by At

The following mappings are located in my .vimrc and are used to quickly navigate between vertical split panes created with :vsp and split panes creates with :sp.

" Smart way to move between windows
map <up> <C-w><up>
map <down> <C-w><down>
map <left> <C-w><left>
map <right> <C-w><right>

This does not seem to play well with the slimv plugin. When I press ,c to open REPL in a horizontal split pane, <down> and <up> do not work within REPL; however, <left> and <right> work as expected.

From the original window I can navigate in all four directions and into the REPL window. From REPL, only <left> and <right> works. <up> and <down> result in moving the cursor up and down within the window.

1

There are 1 answers

1
Tamas Kovacs On BEST ANSWER

Slimv tries to simulate a console output in the REPL buffer by setting Vim's wrap option. This way lines longer than textwidth will be displayed in multiple screen-lines. Vim's cursor movement keys (j, k, <Down>, <Up>) normally position the cursor by buffer-lines, instead of screen-lines. Slimv simulates screen-line cursor movement by redefining those cursor keys (e.g. 'k' to 'gk', 'j' to 'gj').

You can disable the wrap option for the REPL buffer in Slimv by adding this line to your .vimrc:

let g:slimv_repl_wrap=0

This way <Up> and <Down> (and some other) keys will not be remapped. Please note however that long lines will not be wrapped then, only the their first part will be displayed, and you'll need to scroll the screen horizontally to view the rest of them.