Last active
December 17, 2015 10:28
-
-
Save qstrahl/5594655 to your computer and use it in GitHub Desktop.
Overload of Vim's default `<C-W>=` normal command that sets the preview window's height to `&previewheight`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:CustomWincmdEquals(visual) | |
try | |
let w = winnr() | |
wincmd P | |
exe &previewheight.'wincmd _' | |
exe w.'wincmd w' | |
catch /^E441:/ | |
continue | |
finally | |
return "\<C-W>=" . (a:visual ? 'gv' : '') | |
endtry | |
endfunction | |
nno <silent> <Plug>CustomwincmdEquals @=<SID>CustomWincmdEquals(0)<CR> | |
vno <silent> <Plug>CustomwincmdEquals @=<SID>CustomWincmdEquals(1)<CR> | |
nmap <C-W>= <Plug>CustomwincmdEquals | |
vmap <C-W>= <Plug>CustomwincmdEquals |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment