narrow : Another plugin that emulates emacs' narrowing feature.
| script karma
Downloaded by 669
Comments, bugs, improvements
script versions (upload new version)
|This plugin allows you to zoom into regions of a buffer by hiding everything outside the selection. Global operations like global search/replace etc. only apply to the selected region, until you widen the view again. This is useful when you have a very long function that doesn't fit the screen, and you end up in another function when searching whithout noticing (as an example). With this plugin you can zoom to that function and be sure that you keep inside it, no matter what you do.
:Narrow (takes a region, zooms to it)
:Widen (inserts the hidden parts again)
As the Narrow function actually deletes the hidden text from the buffer temporarily, this action can be undone manually by the user (using "u", ":undo", ":earlier", "g-", ...), which will break the :Widen function. For this reason, the 'u' key is remapped to a "safe" undo function. Still, there are other ways to undo the narrowing, so be careful!
Also, when in a narrowed buffer, the auto-command "BufWriteCmd" is set to a function that saves the whole file, so not only the narrowed region is saved on ".w". Don't mess with this auto-command, or you'll probably lose data!
|Just copy the script in your plugin folder.
The latest version can also be checked out of the Git repository at http://github.com/jkramer/vim-narrow/tree/master
Click on the package to download.
ip used for rating: