vim - chunhualiao/public-docs GitHub Wiki

.vimrc

syntax on
filetype plugin indent on
" Use spaces instead of tabs for C++ files
autocmd FileType cpp setlocal expandtab shiftwidth=2 softtabstop=2
:set expandtab
:set shiftwidth=2
:set softtabstop=2

" Restore cursor to the last known position when reopening a file
if has("autocmd")
  autocmd BufReadPost *
        \ if line("'\"") > 0 && line("'\"") <= line("$") |
        \   exe "normal! g`\"" |
        \ endif
endif