From cd07963085a046489df7d558c095cb8cf9617f93 Mon Sep 17 00:00:00 2001 From: lhark Date: Wed, 6 Mar 2019 16:40:26 -0500 Subject: [PATCH] [vim] Stabilize cursor while saving and scrolling --- vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index f382579..1caa278 100644 --- a/vimrc +++ b/vimrc @@ -120,6 +120,8 @@ set equalalways " Show a few lines of context around the cursor. set scrolloff=5 +" Try to keep the cursor in the same column while scrolling +set nostartofline set autochdir set autoread @@ -221,10 +223,10 @@ function! DeleteTrailingTWS() if &ft =~ 'diff' return end - normal mb + let l:view = winsaveview() silent %s/[ \t]*$//g silent %s/\s\+$//ge - normal 'b + call winrestview(l:view) endfunction "[Make the scripts executable]" function! ChangeScriptMode()