aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2021-11-04 18:08:34 +0900
committernsfisis <nsfisis@gmail.com>2021-11-04 18:08:34 +0900
commit34f20b49ff87ba8f5fc37760a138b560b0b2d9fc (patch)
tree556ecc5408f362ef9cdffa9b24c3afccd943bf97
parent59e234d12c8df1ab21db977785945ac68edc8d68 (diff)
downloaddotfiles-34f20b49ff87ba8f5fc37760a138b560b0b2d9fc.tar.gz
dotfiles-34f20b49ff87ba8f5fc37760a138b560b0b2d9fc.tar.zst
dotfiles-34f20b49ff87ba8f5fc37760a138b560b0b2d9fc.zip
.vimrc: jump to the last cursor position when you open a file
-rw-r--r--.vimrc7
1 files changed, 7 insertions, 0 deletions
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