From 424a5386b0392ffe4377f4009f01ddf520a7bc64 Mon Sep 17 00:00:00 2001 From: Adam Hovorka Date: Fri, 5 Jun 2020 17:11:23 -0600 Subject: Make Vim reopen to last position in file --- base/vimrc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'base/vimrc') diff --git a/base/vimrc b/base/vimrc index 16ccf21..9bc3a54 100644 --- a/base/vimrc +++ b/base/vimrc @@ -243,6 +243,12 @@ nnoremap N :call NumberToggle() "autocmd InsertEnter * :set norelativenumber "autocmd InsertLeave * :set relativenumber +" Open to last position ====---- + +if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +endif + " Custom functions ====---- if filereadable(expand("~/.vimrc.local")) -- cgit v1.2.3-70-g09d2