If I Only... : An only slightly smarter :only
| script karma
Downloaded by 21
Comments, bugs, improvements
|If I Only... is an only slightly smarter :only.
It's pretty simple: If there are any unmodifiable buffers open (NERDTree, :Gstatus, quickfix window, etc.), close them leaving any modifiable buffers alone. If there are only modifiable splits open, make the current one the only one—i.e., call plain old :only. If you are in an unmodifiable buffer, jump to the first modifiable one (this last point is configurable; see :help ifionly).
There is only one command (:IfIOnly) and one mapping (<C-W>O).
I would suggest using an even simpler mapping. Personally, I use L.
I made this because my default vim state is to have two buffers open, side-by-side. Sometimes I'll find myself in a position where git status, the quickfix window, and sometimes even NERDTree--(or, ahem the twiggy window) are all open and I want to quickly get back to my default state in one or two keystokes.
If this sounds useful to you yet you like to have something like NERDTree open at all times, g:ifionly_filetypes can be set in your vimrc. For example:
let g:ifionly_filetypes = ['nerdtree']
Development is done at https://github.com/sodapopcan/vim-ifionly
If I Only...'s namesake is a song by Toronto, ON band Do Make Say Think.
Rating scripts is only available on the
script versions (upload new version)
Click on the package to download.
ip used for rating: 220.127.116.11