I have recently added the excellent fholgado/minibufexpl.vim plugin to got a readily available display of all the existing buffers.
My problem now, though, is that I heavily rely on CTRL+W W/H/J/K/L to switch between splits and I keep missing that I'm in the plugin's split.
Is it possible to write some Vim code which would skip or disable navigation to a certain split?
Do the following code do what you're expecting? It remaps some window focus commands (<C-W>l/h/j/k/w), so that it skips the BDE window, if it's opened.
" Remapping the following <ctrl-w>... commands:
for wincmd in ['l', 'h', 'j', 'k', 'w']
exe 'noremap <silent> <c-w>'.wincmd.' :WincmdSkipMBE '.wincmd.'<cr>'
endfor
command! -nargs=1 WincmdSkipMBE call WincmdSkipMBE(<f-args>)
function! WincmdSkipMBE(cmd)
let l:first = winnr()
while 1
let l:last = winnr()
exe 'wincmd '.a:cmd
let l:new = winnr()
if l:last == l:new | exe l:first.'wincmd w' | break
elseif bufname('%') != '-MiniBufExplorer-' | break
endif
endw
endf
I'm not totally sure of what you're asking. When you say:
I heavily rely on
CTRL+W W/H/J/K/Lto switch between splits
, do you rather mean CTRL-W w/h/j/k/l (lowercase) ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With