From 2e3e54ea4c0fc946c21b0a4ee4c1c295ba736ee8 Mon Sep 17 00:00:00 2001 From: Aleksei Chernenkov Date: Mon, 8 Aug 2022 12:57:25 +0500 Subject: [PATCH] Save and restore window view after saving --- plugin/AutoSave.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/AutoSave.vim b/plugin/AutoSave.vim index 20627e2..3166f61 100644 --- a/plugin/AutoSave.vim +++ b/plugin/AutoSave.vim @@ -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") @@ -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)