diff --git a/etc/vim/bundle/NrrwRgn/autoload/nrrwrgn.vim b/etc/vim/bundle/NrrwRgn/autoload/nrrwrgn.vim index ef224e9e..cee63c87 100755 --- a/etc/vim/bundle/NrrwRgn/autoload/nrrwrgn.vim +++ b/etc/vim/bundle/NrrwRgn/autoload/nrrwrgn.vim @@ -382,7 +382,7 @@ fun! Options(search) "{{{1 finally if fnamemodify(bufname(''),':p') == \expand("$VIMRUNTIME/doc/options.txt") - bwipe + noa bwipe endif exe "noa " bufwinnr(buf) "wincmd w" return c @@ -423,7 +423,7 @@ fun! CheckProtected() "{{{1 if !&l:ma || &l:ro let b:orig_buf_ro=1 call s:WarningMsg("Buffer is protected, won't be able to write". - \ "the changes back!") + \ " the changes back!") else " Protect the original buffer, " so you won't accidentally modify those lines, @@ -810,11 +810,19 @@ fun! nrrwrgn#WidenRegion(force) "{{{1 let instn = b:nrrw_instn let close = has_key(s:nrrw_rgn_lines[instn], 'single') let vmode = has_key(s:nrrw_rgn_lines[instn], 'vmode') + " Save current state + let nr = changenr() " Execute autocommands if has_key(s:nrrw_aucmd, "close") exe s:nrrw_aucmd["close"] endif let cont = getline(1,'$') + if has_key(s:nrrw_aucmd, "close") && nr != changenr() + " Restore buffer contents before the autocommand + " (in case the window isn't closed, the user sees + " the correct input) + exe "undo" nr + endif let tab=BufInTab(orig_buf) if tab != tabpagenr() && tab > 0 diff --git a/etc/vim/bundle/NrrwRgn/doc/NarrowRegion.txt b/etc/vim/bundle/NrrwRgn/doc/NarrowRegion.txt index adda42c7..52ae9414 100755 --- a/etc/vim/bundle/NrrwRgn/doc/NarrowRegion.txt +++ b/etc/vim/bundle/NrrwRgn/doc/NarrowRegion.txt @@ -2,7 +2,7 @@ Author: Christian Brabandt Version: 0.31 Sat, 16 Feb 2013 22:28:31 +0100 -Copyright: (c) 2009, 2010, 2011, 2012 by Christian Brabandt +Copyright: (c) 2009-2013 by Christian Brabandt The VIM LICENSE applies to NrrwRgnPlugin.vim and NrrwRgnPlugin.txt (see |copyright|) except use NrrwRgnPlugin instead of "Vim". NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. @@ -44,7 +44,7 @@ This plugin defines the following commands: *:NarrowRegion* *:NR* :[range]NR[!] :[range]NarrowRegion[!] When [range] is omitted, select only the current - line, else use the lines in the range given and + line, else use the lines in the range given and open it in a new Scratch Window. If the current line is selected and is on a folded region, select the whole folded text. @@ -56,7 +56,7 @@ This plugin defines the following commands: *:NarrowWindow* *:NW* :NW[!] :NarrowWindow[!] Select only the range that is visible the current - window and open it in a new Scratch Window. + window and open it in a new Scratch Window. Whenever you are finished modifying that region simply write the buffer. If ! is given, open the narrowed buffer not in a @@ -64,7 +64,7 @@ This plugin defines the following commands: with 'hidden' set). *:WidenRegion* -:WidenRegion[!] This command is only available in the narrowed +:WidenRegion[!] This command is only available in the narrowed scratch window. If the buffer has been modified, the contents will be put back on the original buffer. If ! is specified, the window will be @@ -121,11 +121,13 @@ This plugin defines the following commands: narrowed buffer behaves like an ordinary buffer that you can write in the filesystem. (this is the default). + Note: You can still use |:WidenRegion| to write + the changes back to the original buffer. *:NRL* - + :NRL[!] Reselect the last selected region again and open - in a narrowed window. + in a narrowed window. If ! is given, open the narrowed buffer not in a split buffer but in the current window (works best with 'hidden' set). @@ -175,7 +177,7 @@ changes but when you write your changes back, these comments will stay in your file. You would do it like this: > :v/^#/NRP :NRMulti -< +< Now a Narrowed Window will open, that contains only the configuration lines. Each block of independent region will be separated by a string like @@ -263,7 +265,7 @@ If you want to use several independent narrowed regions of the same buffer that you want to write at the same time, protecting the original buffer is not really useful. Therefore, set the g:nrrw_rgn_protect variable, e.g. in your |.vimrc| > - + let g:nrrw_rgn_protect = 'n' < This can be useful if you diff different regions of the same file, and want @@ -278,7 +280,7 @@ back into the original buffer, but it can't guarantee that this will work and might fail silently. Therefore, this feature is experimental! ------------------------------------------------------------------------------ - *NR-hooks* + *NrrwRgn-hook* *NR-hooks* NarrowRegion can execute certain commands, when creating the narrowed window and when closing the narrowed window. For this, you can set 2 buffer-local @@ -289,7 +291,7 @@ For example, suppose you have a file, containing columns separated data (CSV format) which you want to modify and you also have the CSV filetype plugin (http://www.vim.org/scripts/script.php?script_id=2830) installed and you want to modify the CSV data which should be visually arranged like a table in the -narrowed window. +narrowed window. Therefore you want the command |:ArrangeColumn| to be executed in the new narrowed window upon entering it, and when writing the changes back, you want @@ -305,7 +307,7 @@ This will execute the commands in the narrowed window: > :%ArrangeCol and before writing the changes back, it'll execute: > - + :%UnArrangeCol ============================================================================== @@ -329,7 +331,11 @@ looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW 4. NrrwRgn History *NrrwRgn-history* -0.31: Feb 16, 2013 +0.32 (unreleased) +- hooks could corrupt the narrowed buffer, if it wasn't closed (reported by + jszakemeister https://github.com/chrisbra/NrrwRgn/issues/17, thanks!) + +0.31: Feb 16, 2013 {{{1 - NRM threw some errors (reported by pydave in https://github.com/chrisbra/NrrwRgn/issues/17, thanks!) - don't create swapfiles (reported by ping, thanks!) @@ -391,7 +397,7 @@ looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW 0.23: Oct 24, 2011 {{{1 - (wrongly uploaded to vim.org) - + 0.22: Oct 24, 2011 {{{1 - Allow customization via the use of hooks (|NR-hooks|) @@ -493,7 +499,7 @@ looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW bufnr(), so it should work without problems for several buffers) - switch from script local variables to buffer local variables, so narrowing for several buffers should work. -- set 'winfixheight' for narrowed window +- set 'winfixheight' for narrowed window - Added command :NRV (suggested by Charles Campbell, thanks!) - added error handling, in case :NRV is called, without a selected region - take care of beeps, when calling :NRV @@ -524,7 +530,7 @@ looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW - Highlight narrowed region in the original buffer - Save and Restore search-register -- Provide shortcut commands |:NR| +- Provide shortcut commands |:NR| - Provide command |:NW| and |:NarrowWindow| - Make plugin autoloadable - Enable GLVS (see |:GLVS|) diff --git a/etc/vim/bundle/NrrwRgn/doc/tags b/etc/vim/bundle/NrrwRgn/doc/tags index 4837dcd0..fcafc64b 100644 --- a/etc/vim/bundle/NrrwRgn/doc/tags +++ b/etc/vim/bundle/NrrwRgn/doc/tags @@ -19,6 +19,7 @@ NarrowRegion NarrowRegion.txt /*NarrowRegion* NrrwRgn-config NarrowRegion.txt /*NrrwRgn-config* NrrwRgn-feedback NarrowRegion.txt /*NrrwRgn-feedback* NrrwRgn-history NarrowRegion.txt /*NrrwRgn-history* +NrrwRgn-hook NarrowRegion.txt /*NrrwRgn-hook* NrrwRgn-manual NarrowRegion.txt /*NrrwRgn-manual* NrrwRgn.txt NarrowRegion.txt /*NrrwRgn.txt* NrrwRgnPlugin NarrowRegion.txt /*NrrwRgnPlugin*