Skip to content

Instantly share code, notes, and snippets.

@jrial
Created February 13, 2018 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrial/043fa63c73faabf66a0b35a9d85fd572 to your computer and use it in GitHub Desktop.
Save jrial/043fa63c73faabf66a0b35a9d85fd572 to your computer and use it in GitHub Desktop.
" Use syntax highlighting by default
syntax on
" Use decent colors in screen
set background=dark
" Don't expand tabs...
set noexpandtab
" ...But if we were to, they would expand to 4 spaces
set shiftwidth=4
" Tabs are 4 characters wide
set tabstop=4
" Don't wrap lines
set nowrap
" Shortly jump to a matching bracket when inserting one
set showmatch
" Turn on automatic indentation
set autoindent
" Automatically indent/unindent when typing { / }
" Caution: indents incorrectly when doing {}<left><enter>!
set smartindent
" Allows you to backspace through eol, and past the point where you started insert mode.
" Not needed on systems that realize we live in the 21st century (unlike *BSD)
set backspace=indent,eol,start
" Remember marks for 100 files, and keep at most 1000 lines per register (to prevent your-
" self from shooting yourself in the foot by deleting a large number of lines from one file
" with the intention of pasting it into another, and then noticing you just lost half of
" your content because the default is set to store only 50 lines - less than one screen)
set viminfo='100,\"1000
" Remember last line across editor sessions
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
augroup cprog
au!
autocmd BufRead *.c,*.h set formatoptions=croql cindent expandtab comments=sr:/*,mb:*,el:*/,://
augroup END
autocmd FileType java :compiler javac
autocmd BufRead *.py set smartindent expandtab cinwords=if,elif,else,for,while,try,except,finally,def,class
" Get rid of the silly colors for matching parens in vim 7
hi clear MatchParen
hi MatchParen cterm=underline
" In normal mode, have <Insert> go to insert mode...
noremap <Insert> i
" ...and in insert mode, have <Insert> toggle paste mode (who uses replace anyway?)
set pastetoggle=<Insert>
" Correct syntax highlighting for apache vhosts
autocmd BufRead /etc/apache2/sites-* set filetype=apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment