sponsor Vim development Vim logo Vim Book Ad

vim-smartclose : Close Vim windows in a smart way!

 script karma  Rating 0/0, Downloaded by 800  Comments, bugs, improvements  Vim wiki

created by
Szymon Wrozynski
script type
SmartClose is a wise closing utility. What does it mean? SmartClose plugin distinguishes two kinds of windows (the regular windows you use to work) and the auxiliary ones (a preview window, a NERDTree panel, a quickfix window, etc). Basically, the plugin allows you to close a window just with a single keystroke (<F10>). But if there are any auxiliary windows visible, it closes them first (in the LIFO order). It means, you don't have to leave the current (regular) window to close the auxiliary one. Just hit <F10> and you'll get it closed. If there are no auxiliary windows visible, <F10> will close the current window (and a tab if it would be the last window in the tab, or the editor itself, if it would be the last tab).

If you hit <F10> inside an auxiliary window, the window is closed immediately. And sometimes, the same behavior could be desired inside regular windows too, right? Even, if there are visible auxiliary ones, which will have the precedence, as said before. Therefore, the plugin provides you a configurable delay time. By default, during the first second after entering a regular window, hitting <F10> will close that window rather than any auxiliary ones.

In other words, the smart auxiliary windows closing feature is delayed about 1 sec. This way you can move into a regular window you want to close, press <F10> immediately, and close it even if there are open auxilary windows on the screen. The delay can be adjusted or even disabled.
install details
Place in ~/.vim/plugin/smartclose.vim.

The most recent version can be always found on github: https://github.com/szw/vim-smartclose

Please, don't forget to star the repository if you like (and use) the plugin and rate the plugin here. This will let me know how many users it has and then how to proceed with further development :).

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-smartclose-0.0.2.zip 0.0.2 2013-04-21 7.0 Szymon Wrozynski Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github