diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-04 01:06:10 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-04 01:06:10 +1200 |
commit | 90e5acaf0add1d5caf78417ff544ea1b2d74c0ac (patch) | |
tree | 2646b998bdb401b0f67645871fc900922d3c26df /autoload | |
parent | Add command example (diff) | |
download | vim-keep-position-90e5acaf0add1d5caf78417ff544ea1b2d74c0ac.tar.gz vim-keep-position-90e5acaf0add1d5caf78417ff544ea1b2d74c0ac.zip |
Add ranges support
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/keep_position.vim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/autoload/keep_position.vim b/autoload/keep_position.vim index a2f2ed4..7ff0228 100644 --- a/autoload/keep_position.vim +++ b/autoload/keep_position.vim @@ -1,5 +1,7 @@ -function! keep_position#(command) abort +function! keep_position#(command, range, start, end) abort let view = winsaveview() execute a:command - call winrestview(view) + if !a:range || (a:start >= line("'[") && a:end <= line("']")) + call winrestview(view) + endif endfunction |