NrrwRgn: a narrow region window for Vim buffers
A Narrow Region Plugin for vim (like Emacs Narrow Region)
At a glance
- What is it?
- NrrwRgn is a Vim script plugin that opens a selected region in its own split window, protects the rest of the buffer, and writes the edits back when you are done. It is aimed at Vim users who want the focus behaviour of the Emacs narrowing feature.
- Who is it for?
- NrrwRgn suits Vim users who regularly work inside one function, one diff hunk or one configuration block and want the surrounding buffer out of the way without losing the edits. It is the wrong tool if you need several regions of a buffer visible at once, because the multi narrowed window command is marked experimental in the documentation.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 152 days ago.
- What is it written in?
- Mainly Vim Script, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A split window that hides the rest of the buffer
NrrwRgn gives Vim something like the narrowing feature of Emacs. The README states the idea plainly: select a region, call `:NR`, and the selected part opens in a new split window while the rest of the buffer is protected. The protection is the interesting part. A plain split window is just another view, and edits in it can easily drift out of sync with what you meant. Here, once you are finished, you write the narrowed window with `:w` and the changes are moved back to the original buffer. That is a different model from hiding lines with folding or from using a quickfix window. The plugin is a single Vim Script project, distributed as a vimball and listed on vim.org as script 3075, and the author credits the Emacs narrowing idea as the inspiration.
The command set and what each one does
The command surface is small enough to learn in a minute, and the README lists it. The core group opens regions: `:NR` opens the selected region in a new narrowed window, `:NW` does the same for the current visual window, `:NRV` reopens the region that was last visually selected, and `:NRL` reselects the last selected region and opens it again. Two commands control the round trip: `:WR` writes the changes back to the original buffer, and `:NRS` or `:NRN` toggle the syncing of buffer content back, with syncing on by default. There is a diff-aware pair, where `:NUD` opens the selected diff in two narrowed windows when you are in a unified diff. The multi window commands are `:NRP`, which marks a region for a multi narrowed window, and `:NRM`, which creates it, and the documentation flags `:NRM` as experimental. You can append `!` to most commands to reuse the current window instead of opening a new split, and with `:WR` the bang also closes the narrowed window afterwards.
Visual mode and a scripting entry point
Two access paths exist outside the Ex commands. Visual mode has a mapping, `<Leader>nr`, that opens the current visual selection in a new narrowed window, so the common case of marking a block and doing something to it does not require typing a command. For automation there is a scripting function, `nrrwrgn#NrrwRgnStatus()`, which returns a dict with all the status information for the current window. That function is the hook if you want to drive the plugin from a status line, a custom layout, or a script that decides where to place the narrowed window. The plugin follows the usual Vim autoload convention, with the function living in the `autoload/` directory and the command definitions in `plugin/`, and the repository also carries a `doc/` directory that holds the help file, a `test/` directory with a `runtest.sh` script, a `Makefile`, a `todo.txt` and a `post.pl` helper.
Installing from a vimball or a plugin manager
The README says to use the plugin manager of your choice, or to download the stable version of the plugin from vim.org, open it in Vim with `vim NrrwRgn-XXX.vmb` and source it with `:so %`. After that, restart Vim and read the help at `:h NrrwRgn.txt`, and the usage section points at `:h NarrowRegion` for the full reference. The repository ships its own vimball, `NrrwRgn.vmb`, and the Makefile has an install target that sources the plugin's `plugin/vimballPlugin.vim` helper and runs `:MkVimball` to build a versioned vimball, plus an uninstall target that calls `:RmVimball`. The Makefile also carries a `test` target that changes into the `test` directory and runs `runtest.sh`, and a `version` target that bumps the version string in the script and autoload files with perl and refreshes the date line. The command list you will actually use is short enough to paste into a memory of the help file:
Reading the command list from the documentation
The overview in the README is the fastest way to see what the plugin does without launching Vim, and it is reproduced here as the list the help file describes. The indentation and the spacing of each command is as shown in the documentation:
:NR - Open the selected region in a new narrowed window
:NW - Open the current visual window in a new narrowed window
:WR - (In the narrowed window) write the changes back to the original buffer.
:NRV - Open the narrowed window for the region that was last visually selected.
:NUD - (In a unified diff) open the selected diff in 2 Narrowed windows
:NRP - Mark a region for a Multi narrowed window
:NRM - Create a new Multi narrowed window (after :NRP) - experimental!
:NRS - Enable Syncing the buffer content back (default on)
:NRN - Disable Syncing the buffer content back
:NRL - Reselect the last selected region and open it again in a narrowed windowThe visual mode mapping `<Leader>nr` and the status function `nrrwrgn#NrrwRgnStatus()` are documented alongside this list. Note the `:NUD` wording, which applies to a unified diff, and the default-on state of syncing, which is why you can leave the buffer alone and still get your changes back when you write the narrowed window.
What it does not cover, and what the alternatives do
Two limits are worth naming. The multi narrowed window feature, built from `:NRP` and `:NRM`, is labelled experimental in the documentation, so if your workflow needs several regions of a buffer visible and editable at once, this is not a settled answer. Second, a narrowed window is still a window, so anything that depends on seeing the whole buffer, such as a search across the file or a global replace, still has to happen before you narrow. The alternatives listed by the project itself are other narrowing plugins, and the difference in approach is that they are separate scripts with their own command names and their own conventions for getting edits back, whereas NrrwRgn keeps a single command family with a `!` variant for window placement and an explicit toggle for syncing. The other option is not a plugin at all: folding hides lines in place, keeps one window, and leaves the buffer structure untouched, which is simpler but does not give you a separate buffer view to write back from.
Licence, maintenance and the state of the repository
The project is released under the Vim License, and the README carries the standard disclaimer that there is no warranty, express or implied, and that you use it at your own risk. The metadata for the repository lists the licence as unknown, so the authoritative statement is the one in the README and in the help file it ships, not the repository field. Copyright is stated as Christian Brabandt for 2009 to 2014. On maintenance, the last push was on 2026-05-24 and the repository has no GitHub releases, so the distribution channel is the vim.org script page rather than tagged releases, and the versioning is carried inside the script files themselves, with the Makefile editing the version and date lines directly. The `test/` directory and the `runtest.sh` script are there to catch regressions, and the `todo.txt` file gives a hint about what the author considers unfinished.
Editorial conclusion
NrrwRgn suits Vim users who regularly work inside one function, one diff hunk or one configuration block and want the surrounding buffer out of the way without losing the edits. It is the wrong tool if you need several regions of a buffer visible at once, because the multi narrowed window command is marked experimental in the documentation. Before installing, read the help at `:h NarrowRegion` and check the command list below against your editing habits, and note that the plugin is Vim Script with a Vim License, carries no warranty, and had its last push on 2026-05-24 with no GitHub releases published.
Frequently asked questions
How do I install the NrrwRgn Vim plugin?
The README says to use the plugin manager of your choice, or to download the stable vimball from vim.org, open it with `vim NrrwRgn-XXX.vmb` and source it with `:so %`. The repository also ships a `NrrwRgn.vmb` and a Makefile with install and uninstall targets.
How do I write the changes from a NrrwRgn narrowed window back to the original buffer?
Use the `:WR` command in the narrowed window, which writes the changes back to the original buffer. Appending `!` to `:WR` also closes the narrowed window afterwards.
Does NrrwRgn support working on several regions of the same buffer at once?
There are commands for it, `:NRP` to mark a region and `:NRM` to create a multi narrowed window, but the documentation states that `:NRM` is currently experimental.
What license does NrrwRgn use?
The README states that the Vim License applies and that there is no warranty, express or implied. Copyright is listed as Christian Brabandt for 2009 to 2014.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/chrisbra-nrrwrgn)Was this useful?