diff options
-rw-r--r-- | autoload/keep_position.vim | 5 | ||||
-rw-r--r-- | plugin/keep_position.vim | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/autoload/keep_position.vim b/autoload/keep_position.vim new file mode 100644 index 0000000..a2f2ed4 --- /dev/null +++ b/autoload/keep_position.vim @@ -0,0 +1,5 @@ +function! keep_position#(command) abort + let view = winsaveview() + execute a:command + call winrestview(view) +endfunction diff --git a/plugin/keep_position.vim b/plugin/keep_position.vim new file mode 100644 index 0000000..06a23ec --- /dev/null +++ b/plugin/keep_position.vim @@ -0,0 +1,2 @@ +command! -nargs=+ -complete=command KeepPosition + \ call keep_position#(<q-args>) |