bjackfly
bjackfly

Reputation: 3336

remove netrw s-up and s-down mapping in vim

I have the following mappings in my .vimrc file that I use to move between windows, but when in an explore window :e of netrw plugin the shift down key will produce a warning window instead of respecting my mappings. I am assuming this mapping must be hard coded into the plugin itself. How can I remove the shift-up and shift-up mappings in the plugin.

nnoremap <silent> <S-Up> :wincmd k<CR>     
nnoremap <silent> <S-Down> :wincmd j<CR>   

The window that shows up when trying to do a shift-up or shift-down is below, which shows up in a new split which is very annoying:

**warning** (netrw) using Nexplore or <s-down> improperly; see help for netrw-starstar

As a result, my question is how can I shut off this behavior in the netrw plugin so that it respects my mappings shown above instead.

Upvotes: 5

Views: 1291

Answers (1)

sidyll
sidyll

Reputation: 59297

A buffer map for that is created by the plugin, so you could overwrite it again after created with an autocmd:

autocmd filetype netrw nnoremap <buffer> <s-down> :wincmd j<cr>

If using multiple times, it might be useful to create a group:

augroup netrw_maps
  autocmd!
  autocmd filetype netrw call ApplyNetrwMaps()
augroup END

function ApplyNetrwMaps()
  nnoremap <buffer> <s-up> :wincmd k<cr>
  nnoremap <buffer> <s-down> :wincmd j<cr>
  " ...
endfunction

Upvotes: 5

Related Questions