Created
February 3, 2015 20:50
-
-
Save wolever/46f2c2cfcabf431679a6 to your computer and use it in GitHub Desktop.
:Conly Vim command to close all windows in the current column.
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
" :Co[nly] closes all other windows in the current column. | |
" For example, if the cursor is in the "cur" window, below, windows 1, 2, and | |
" 4 will be closed: | |
" +-------+ +-------+ | |
" | win 1 | | | | |
" +-------+ | | | |
" | win 2 | | | | |
" +-------+ --> :Conly --> | cur | | |
" | cur | | | | |
" +-------+ | | | |
" | win 4 | | | | |
" +-------+ +-------+ | |
fun! Conly() | |
for dir in ['j', 'k'] | |
while 1 | |
let cur = winnr() | |
execute "normal \<c-w>".dir | |
if winnr() == cur | |
break | |
endif | |
close | |
endwhile | |
endfor | |
endfun | |
command! Conly call Conly() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment