Skip to content

Instantly share code, notes, and snippets.

@doitian
Created October 13, 2017 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doitian/3109eb0951415af317081bbdaf5363fc to your computer and use it in GitHub Desktop.
Save doitian/3109eb0951415af317081bbdaf5363fc to your computer and use it in GitHub Desktop.
Close disturbing windows in #vim
function! s:CloseDisturbingWin()
if &filetype == "help" || &filetype == "netrw"
let l:currentWindow = winnr()
if s:currentWindow > l:currentWindow
let s:currentWindow = s:currentWindow - 1
endif
close
endif
endfunction
command! Close :pclose | :cclose | :lclose |
\ let s:currentWindow = winnr() |
\ :windo call s:CloseDisturbingWin() |
\ exe s:currentWindow . "wincmd w"
@doitian
Copy link
Author

doitian commented Oct 13, 2017

一键关闭各种跳出的窗口

@tracyone
Copy link

其实一个:only命令就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment