From 34f20b49ff87ba8f5fc37760a138b560b0b2d9fc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 4 Nov 2021 18:08:34 +0900 Subject: .vimrc: jump to the last cursor position when you open a file --- .vimrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.vimrc b/.vimrc index 3b82731..5c59154 100644 --- a/.vimrc +++ b/.vimrc @@ -598,6 +598,13 @@ Autocmd BufEnter,WinEnter,BufWinEnter * \ let &l:numberwidth = len(line('$')) + 2 +" Jump to the last cursor position when you open a file. +Autocmd BufRead * + \ if 0 < line("'\"") && line("'\"") <= line('$') && &filetype !~# 'commit' | + \ execute "normal g`\"" | + \ endif + + " Syntax highlight for .vimrc {{{2 Autocmd Filetype vim -- cgit v1.2.3-70-g09d2