FocusPrevious : Focus previous window/tab when closing the current one.
| script karma
Downloaded by 815
Comments, bugs, improvements
script versions (upload new version)
|I tend to open multiple tabs in vim and multiple windows within a tab.
I have a habit of traversing the code in a tree format - I open a tag in a
new tab, so that my current view of the window remains unchanged. I can simply
close the newly opened tab/window to resume to my previous view.
Consider a case where I have window A focused. I open a new split as window B.
Now, when I close window B, it should focus the earlier window A. Currently,
it always focuses the window on left side of B.
Similarly, for tab close case, it always selects the tab on the right side of
tab being closed.
With this plugin, it maintains the order in which the tabs are switched and
the order in which windows are switched within a tab.
NOTE that the order of window switching is maintained in per-tab basis.
When any window/tab is closed, it focuses the tab that was last focussed.
Please provide feedback here: http://vi.stackexchange.com/a/9288/2749 (My question which led me into writing this script.)
|Actual script needs to be copied to ~/.vim/plugin.
This package us a VIMBall.
Download the script as FocusPrevious.vmb using wget/curl
$ wget http://www.vim.org/scripts/download_script.php?src_id=24462 -O FocusPrevious.vmb # The download URL would vary with new version
$ vim FocusPrevious.vmb
: source %
Click on the package to download.
ip used for rating: 220.127.116.11