From 5a00c2967ae471825308a2eff6132ac2066986b1 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Fri, 13 Jan 2023 13:00:31 +0000 Subject: [PATCH] Keep current line in centre of window https://vim.fandom.com/wiki/Keep_your_cursor_centered_vertically_on_the_screen --- vimrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vimrc b/vimrc index 3198a53..e49c75d 100644 --- a/vimrc +++ b/vimrc @@ -146,6 +146,12 @@ if has('autocmd') autocmd User GoyoEnter nested call goyo_enter() autocmd User GoyoLeave nested call goyo_leave() + + augroup VCenterCursor + au! + au BufEnter,WinEnter,WinNew,VimResized *,*.* + \ let &scrolloff=winheight(win_getid())/2 + augroup END endif if has('folding')