Skip to content

Instantly share code, notes, and snippets.

@MarkLodato
Created November 1, 2012 17:52
Show Gist options
  • Save MarkLodato/3995359 to your computer and use it in GitHub Desktop.
Save MarkLodato/3995359 to your computer and use it in GitHub Desktop.
My .vimrc
set nocompatible
set bs=2
set ai
set viminfo='20,\"500
set history=50
set ruler
set incsearch
filetype plugin indent on
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set guioptions-=T " no toolbar
set guioptions-=m " no menu
set textwidth=78
"set showmatch " blink matching ()'s
"set autowrite
set cinoptions+=g0(0t0p0
set nf-=octal
set ls=2
set grepprg=grep\ -nH\ $* " for VIM-LaTeX
set tags=./tags,tags,../tags,~/tags,/usr/local/include/tags,/usr/include/tags
set winaltkeys=no
set suffixes-=.h
set suffixes+=.pdf,.ps,.blg,.d,.aux,.log,.1
set formatoptions+=t
set printoptions=paper:letter,duplex:off
set mousemodel=popup
" show marker for tabs, and highlight spaces before tabs and at EOL
set list
execute 'set listchars=tab:' . nr2char(187) . '\ '
hi default link WhiteSpaceError Error
match WhiteSpaceError /\(\s\+\%#\@!$\)\|\( \+\ze\t\)/
if has("gui_running") || &t_Co == 256
colorscheme midnight2
set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
endif
set mouse=a " allow mouse in console
" Don't use Ex mode, use Q for formatting
noremap Q gq
" make Y work like it should - yank to end of line
noremap Y y$
" Use Aspell to check spelling
nnoremap <Leader>s :w<CR>:!aspell -c "%"<CR>:e<CR>
" Get rid of annoying keys
nnoremap <F1> <nop>
inoremap <F1> <nop>
vnoremap K k
vnoremap J j
" Some useful insert-mode Emacs commands
inoremap <C-A> <C-O>0
inoremap <C-E> <C-O>$
inoremap <C-B> <C-O>h
inoremap <C-F> <C-O>l
inoremap <A-b> <C-O>b
inoremap <A-f> <C-O>w
inoremap <A-B> <C-O>B
inoremap <A-F> <C-O>W
inoremap <A-p> <C-O>k
inoremap <A-n> <C-O>j
" In the command bar, use ALT-P and ALT-N to go to the previous and next
" command starting with what's already been typed.
cnoremap <A-p> <Up>
cnoremap <A-n> <Down>
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if &term=="xterm"
set t_RV= " don't check terminal version
set t_Co=8
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
if has("autocmd")
augroup gentoo
au!
" Gentoo-specific settings for ebuilds. These are the federally-mandated
" required tab settings. See the following for more information:
" http://www.gentoo.org/doc/en/xml/gentoo-howto.xml
au BufRead,BufNewFile *.e{build,class} let is_bash=1|set ft=sh
au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab
" In text files, limit the width of text to 78 characters, but be careful
" that we don't override the user's setting.
autocmd BufNewFile,BufRead *.txt if &tw == 0 | set tw=78 | endif
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
" Use a good font for nfo files
autocmd BufNewFile,BufRead *.nfo set guifont=smoothansi
augroup END
au BufNewFile,BufRead *.svg setf svg
endif " has("autocmd")
" For increment.vim
vnoremap <c-a> :I<CR>
" For a.vim:
let g:alternateExtensions_tex = "bib,BIB"
let g:alternateExtensions_TEX = "bib,BIB"
let g:alternateExtensions_bib = "tex,TEX"
let g:alternateExtensions_BIB = "tex,TEX"
" For vimacs.vim
let g:VM_CmdHeightAdj = 0
" Some syntax highlighting options
let python_highlight_builtins = 1
let python_highlight_exceptions = 1
let python_highlight_string_formatting = 1
let python_highlight_string_format = 1
let python_highlight_indent_errors = 1
let python_highlight_space_errors = 0 " we do this ourselves
let python_highlight_doctests = 1
let python_print_as_function = 1
let python_slow_sync = 1
let c_gnu = 1
" use \f or :Fmt to format C code (check over results by hand)
source $HOME/.vim/Fmt.vim
" use \c<dir> or :Center to center text, including ones with initial comments,
" or \C<dir> to center with ----- above and below
source $HOME/.vim/Center.vim
map <Leader>m :make<CR>
" What is the current syntax highlighting group?
map <F3> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") . " BG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"bg#")<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment