Skip to content

Commit

Permalink
Save and restore window view after saving
Browse files Browse the repository at this point in the history
  • Loading branch information
907th committed Aug 8, 2022
1 parent 038c104 commit 2e3e54e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/AutoSave.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"======================================
" Script Name: vim-auto-save (http://www.vim.org/scripts/script.php?script_id=4521)
" Plugin Name: AutoSave
" Version: 0.1.12
" Version: 0.1.13
"======================================

if exists("g:auto_save_loaded")
Expand Down Expand Up @@ -74,8 +74,13 @@ function AutoSave()
let first_char_pos = getpos("'[")
let last_char_pos = getpos("']")

" Preserve the window view.
let window_view = winsaveview()

call DoSave()

call winrestview(window_view)

call setpos("'[", first_char_pos)
call setpos("']", last_char_pos)

Expand Down

0 comments on commit 2e3e54e

Please sign in to comment.