Permalink
Browse files

set g:nrrw_rgn_write_on_sync to save the original file (fixes #26)

  • Loading branch information...
1 parent 34964ce commit df4e31e3a6d8a5b93fc1a23b12e5be8ab567a6fe @chrisbra committed Mar 7, 2014
Showing with 15 additions and 1 deletion.
  1. +3 −0 autoload/nrrwrgn.vim
  2. +12 −1 doc/NarrowRegion.txt
View
@@ -1117,6 +1117,9 @@ fun! nrrwrgn#WidenRegion(force) "{{{1
" endif
call <sid>SaveRestoreRegister(_opts)
let @/=s:o_s
+ if get(g:, 'nrrw_rgn_write_on_sync', 0)
+ write
+ endif
call winrestview(wsv)
if !close && has_key(s:nrrw_rgn_lines[instn], 'single')
" move back to narrowed buffer
View
@@ -284,12 +284,20 @@ If you are using the |:NRMulti| command and want to have the original window
update to the position of where the cursor is in the narrowed window, you can
set the variable g:nrrw_rgn_update_orig_win, e.g. in your |.vimrc| >
- let g:nrrw_rgn_update_orig_win = '1'
+ let g:nrrw_rgn_update_orig_win = 1
<
Now the cursor in the original window will always update when the position
changes in the narrowed window (using a |CursorMoved| autocommand).
Note: that this might slow down scrolling and cursor movement a bit.
+------------------------------------------------------------------------------
+If you want the original file to be written, whenever the narrowed window is
+written to the original file, set the variable g:nrrw_rgn_write_on_sync, e.g.
+in your |.vimrc| >
+
+ let g:nrrw_rgn_write_on_sync = 1
+<
+
----------------------------------------------------------------------------
*NrrwRgn-hook* *NR-hooks*
@@ -364,6 +372,9 @@ looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW
(https://github.com/chrisbra/NrrwRgn/2, reported by Mario Ricalde, thanks!)
- better default names for the narrowed window
(https://github.com/chrisbra/Nrrwrgn/28, reported by Mario Ricalde, thanks!)
+- when setting g:nrrw_rgn_write_on_sync the original file will be saved,
+ whenever the narrowed window is written back
+ (https://github.com/chrisbra/26, reported by Mario Ricalde, thanks!)
0.31: Feb 16, 2013 {{{1
- NRM threw some errors (reported by pydave in

0 comments on commit df4e31e

Please sign in to comment.