From f4d51f6216f2df1cc648046307ce184ad87ab289 Mon Sep 17 00:00:00 2001 From: Grigory Efimov Date: Tue, 21 Nov 2023 12:58:17 -0300 Subject: [PATCH] ~/.vimrc added gomod and added "Return to last edit position when opening files" --- .vimrc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.vimrc b/.vimrc index db24f57..7176655 100644 --- a/.vimrc +++ b/.vimrc @@ -229,6 +229,18 @@ augroup golang autocmd BufNewFile,BufRead *.go let b:mtrailingws=matchadd('ErrorMsg', 's\+$', -1) autocmd BufNewFile,BufRead *.go let b:mtrailingws=matchadd('ErrorMsg', '/\s\+$\| \+\ze\t\|^\t*\zs \+/', -1) augroup END +augroup gomod + autocmd! + autocmd BufRead,BufNewFile *.mod match none + autocmd BufRead,BufNewFile *.mod set shiftwidth=4 + autocmd BufRead,BufNewFile *.mod set tabstop=4 + autocmd BufRead,BufNewFile *.mod set smarttab + autocmd BufRead,BufNewFile *.mod set noexpandtab + autocmd BufRead,BufNewFile *.mod set autoindent + autocmd BufRead,BufNewFile *.mod set smartindent + autocmd BufNewFile,BufRead *.mod let b:mtrailingws=matchadd('ErrorMsg', 's\+$', -1) + autocmd BufNewFile,BufRead *.mod let b:mtrailingws=matchadd('ErrorMsg', '/\s\+$\| \+\ze\t\|^\t*\zs \+/', -1) +augroup END " fix term in screen if match($TERM, "screen")!=-1 @@ -258,3 +270,9 @@ function OldTabs() :match ExtraWhitespace /\s\+$\| \+\ze\t\|^\t*\zs \+/ endfunction map :call OldTabs() + +" Return to last edit position when opening files +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif