If I Only... : An only slightly smarter :only
script karma |
Rating 51/16,
Downloaded by 996 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Andrew Haust |
|
script type |
utility |
|
description |
If I Only... is an only slightly smarter :only.
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).
If invoking :IfIOnly leaves one buffer, calling it again to bring back any windows that were closed (ie, it acts as a poor man's WinZoom. This is available until quitting Vim.
Usage
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. |
|
install details |
|
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.219.224.246
|