Skip to content

Instantly share code, notes, and snippets.

@joaomlneto
Created November 12, 2021 16:26
Show Gist options
  • Save joaomlneto/54b25e1c69cd971ad62af556f6cd04b3 to your computer and use it in GitHub Desktop.
Save joaomlneto/54b25e1c69cd971ad62af556f6cd04b3 to your computer and use it in GitHub Desktop.
.vimrc
" show line numbers
set nu
" enable syntax highlighting
syntax on
" set tab size to 2 spaces
set ts=2
" enable mouse use in all modes
set mouse=a
" encoding
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment