Giter Club home page Giter Club logo

vim-smartclose's Introduction

vim-smartclose

Close Vim windows in a smart way!

Installation

Place in ~/.vim/plugin/smartclose.vim or in case of Pathogen:

cd ~/.vim/bundle
git clone https://github.com/szw/vim-smartclose.git

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

About

SmartClose is a wise closing utility. What does it mean? SmartClose plugin distinguishes two kinds of windows (the main windows you use to work) and the auxiliary windows (a preview window, a NERDTree panel, a quickfix window, etc). Basically, the plugin provides you the closing ability just with 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 (regualar) window to close an 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> in the auxiliary windows it gets closed immediately. Also, by default, you can close the regular window in the same way, but only within the first second after entering the window. 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, hit immediately <F10>, and close it even if there are open auxilary windows on the screen. The delay can be adjusted or even disabled.

Usage

SmartClose has only one command:

:SmartClose

Also the plugin can define some default mappings if the user wants to. By default it maps to <F10> in normal, insert, and visual modes. See Configuration to get some examples.

The banged version forces closing of the current window:

:SmartClose!
Configuration -------------

SmartClose is extremely handy with command mappings. By default it uses <F10> like here:

nnoremap <silent><F10> :SmartClose<CR>
vnoremap <silent><F10> :SmartClose<CR>
inoremap <silent><F10> <C-[>:SmartClose<CR>

With these mappings you can hit <F10> any time, not only in normal mode.

Here are some plugin options:

  • smartclose_set_default_mapping

    Whether SmartClose should set default mappings or not:

      let g:smartclose_set_default_mapping = 1
    
  • smartclose_set_mapping_with_bang

    Whether SmartClose should set default mappings with banged version or not:

      let g:smartclose_set_mapping_with_bang = 0
    
  • smartclose_default_mapping_key

    The default mappings key:

      let g:smartclose_default_mapping_key = '<F10>'
    
  • smartclose_delay

    Sets the delay of smart closing auxiliary windows. After entering a new window <F10> will start closing auxiliary windows first after that period. By default is's 1000ms (1 second). You can turn off delaying completely by setting this variable to 0.

      let g:smartclose_delay = 1000
    

Author and License

SmartClose was written by Szymon Wrozynski and Contributors. It is licensed under the same terms as Vim itself.

Copyright © 2013 Szymon Wrozynski. See :help license

vim-smartclose's People

Contributors

szw avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.