Skip to content

Instantly share code, notes, and snippets.

@dekarrin
Created June 8, 2014 15:46
Show Gist options
  • Save dekarrin/b788af8816c2fe61e977 to your computer and use it in GitHub Desktop.
Save dekarrin/b788af8816c2fe61e977 to your computer and use it in GitHub Desktop.
Vim RC
" Ensure that sourcing twice doesn't set autocmds twice
autocmd!
" Remember things on exit
" 'x : save marks in up to x last files
" "x : save up to x lines for each register
" :x : save up to x lines of command history
" % : save and restore buffer list
" nX : save viminfo in path X
set viminfo='10,\"100,:20,%,n~/.viminfo
" function to restore cursor position
function! RestoreCursor()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
" auto restore cursor
augroup resCur
autocmd!
autocmd BufWinEnter * call RestoreCursor ()
augroup END
" Enable omnicompletion
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" Enable syntax
syntax on
" Enable highlighting lines over 80 characters
augroup longlines
autocmd BufEnter * highlight OverLength ctermbg=blue ctermfg=white guibg=#592929
autocmd BufEnter * match OverLength /\%81v.\+/
augroup END
" Always show line numbers
set number
highlight LineNr term=bold cterm=NONE ctermfg=DarkGray ctermbg=NONE gui=NONE guifg=NONE guibg=DarkGray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment