Created
May 3, 2011 22:55
-
-
Save nornagon/954432 to your computer and use it in GitHub Desktop.
My .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" duh | |
syn on | |
filetype plugin indent on | |
" the only TRUE tab settings | |
set ts=2 sw=2 noet tw=79 ai smarttab | |
" keep 4 lines between the cursor and the edge of the screen where possible | |
set so=4 | |
" pay attention to modelines, so i can deal with different tab conventions more | |
" easily. | |
set modeline | |
set modelines=3 | |
" copy indentation style from the previous line. this means if i do: | |
" if (blah) {<CR> | |
" <TAB>int x = 0,<CR> | |
" <TAB>____y = 3,<CR> | |
" | |
" i will get | |
" <TAB>____(cursor) | |
" instead of | |
" <TAB><TAB><TAB>(cursor) | |
" | |
" good for using tabs as they were intended (i.e, to indent) and then using | |
" spaces for formatting. | |
set copyindent | |
" highlight the line the cursor is on. usually done with an underline, but it | |
" is configurable by color scheme. | |
set cursorline | |
" when i :set list, show tabs with unicode arrows instead of as ^I | |
set listchars+=tab:►─ | |
" wrap on word breaks, not between characters | |
" there's a space at the end of that line, after the \. that's important. | |
set wrap linebreak showbreak=↪\ | |
" when you open a file you were just editing, vim should remember which line | |
" you were on and put you back there. | |
set viminfo='50,\"100,:40,n~/.viminfo | |
au BufReadPost * if line("'\"") > 0 | if line("'\"") <= line("$") | | |
\ exe("norm '\"") | else | exe("norm $") | endif | endif | |
" for completing file names, etc. complete the longest match. if i press tab | |
" again, show me a list. if i press tab again, start cycling through the | |
" options. | |
set wildmode=longest,list,full | |
" let the mouse work in console mode. I generally just use it for the scroll | |
" button. | |
if &term == "screen" | |
set ttymouse=xterm2 | |
endif | |
if has("mouse") && !has("gui_running") | |
set mouse=nvir | |
endif | |
" helps for function completion. | |
set path=.,/usr/include,/usr/include/*,, | |
" for completion in insert mode (^P). | |
set completeopt=longest,menuone | |
" set up some interaction between the X clipboard and vim. yanking puts stuff | |
" into the X selection buffer. even without this stuff, "*p will paste stuff | |
" from the selection buffer. | |
set clipboard+=exclude:screen " to stop that annoying slow startup when starting from an old screen | |
set clipboard+=unnamed " allegedly uses the system clipboard for yank/delete | |
" put swap files in ~/.vim-swp instead of in the directory of the file. | |
set directory=~/.vim-swp// | |
" show line numbers | |
"set number | |
" show file position in bottom-right corner | |
set ruler | |
" iirc, the vim xml stuff is pretty annoying without this. | |
let xml_use_xhtml = 1 | |
" i hold shift down too long when i hit :w... | |
command W :w | |
command Wq :wq | |
command WQ :wq | |
command Q :q | |
" dvorak bindings for htns -> navigation. ... wish i could work out a way to | |
" hook this into OS X to work out the currently active keymap. | |
" | |
" k becomes 'find next' (in place of 'n') | |
" j becomes 'until before next occurrance of' (in place of t) | |
"set langmap=tj,jt,TJ,JT,nk,kn,NK,KN,sl,ls,SL,LS | |
noremap t j | |
noremap j t | |
noremap n k | |
noremap k n | |
noremap s l | |
noremap l s | |
noremap <S-t> 12j | |
noremap <S-n> 12k | |
" ctrl-(up/down) nav keys change tabs | |
noremap <C-t> <C-PageDown> | |
noremap <C-n> <C-PageUp> | |
inoremap <C-t> <C-PageDown> | |
inoremap <C-n> <C-PageUp> | |
" f1 does not need to do :h for me, thanks. especially since it's so close to | |
" ESC | |
nmap <F1> <nop> | |
imap <F1> <nop> | |
" do sane things with insane line endings, hopefully. | |
set fileformats=unix,mac,dos | |
" the one true shell | |
set shell=/bin/zsh | |
" for C files, expand #i<SPACE> to #include<SPACE>, and similarly for #define. | |
" set foldmethod=marker because C sucks at modularisation, and {{{/}}} makes | |
" code much easier to move around. 'zt' -> 'z(this)', closes all folds but the | |
" one under the cursor. | |
au FileType c,cpp iab #i #include| iab #d #define| set foldmethod=marker| noremap zt zMzo | |
" I had some stuff here that would automatically insert templates for html and | |
" C header files, but it wasn't working. I should find a better module for | |
" doing that. | |
" cfdg is 'context free design grammar'. neat recursive drawings. check it out. | |
" unfortunately for you i have deviously hidden my cfdg.vim syntax/ftplugin. | |
au BufNewFile,BufRead *.cfdg set ft=cfdg | |
" creatures agent object scripting. | |
au BufNewFile,BufRead *.cos set ft=caos | |
au BufNewFile,BufRead *.k set ft=kaos | |
au BufNewFile,BufRead *.fth,*.f set ft=forth | |
"au BufNewFile,BufRead *.s set ft=armasm ts=4 sw=4 noet | |
" matlab | |
au BufNewFile,BufRead *.m set sw=2 ts=2 noet | |
au BufNewFile,BufRead *.hsc set ft=haskell | |
au BufNewFile,BufRead *.glsl,*.vert,*.frag set ft=c | |
" don't highlight json files, but do indent them. | |
au BufNewFile,BufRead *.json syn off | set ft=javascript et | |
" more vimlatex stuff | |
augroup Tex | |
au! | |
au BufNewFile,BufRead *.tex map <F1> :w<CR>:call Tex_RunLaTeX()<CR> | |
augroup END | |
" vim -b : edit binary using xxd format | |
augroup Binary | |
au! | |
au BufReadPre *.bin let &bin=1 | |
au BufReadPost *.bin if &bin | %!xxd -p -c 64 | |
au BufReadPost *.bin set ft=xxd | endif | |
au BufWritePre *.bin if &bin | %!xxd -p -c 64 -r | |
au BufWritePre *.bin endif | |
au BufWritePost *.bin if &bin | %!xxd -p -c 64 | |
au BufWritePost *.bin set nomod | endif | |
augroup END | |
" change color schemes to a 256-colour one. | |
"set t_Co=256 | |
"colo leo | |
if !has("gui_running") | |
set bg=dark | |
endif | |
nnoremap <silent> \e :FuzzyFinderFile<CR> | |
let g:FuzzyFinderOptions = {'Base':{}} | |
let g:FuzzyFinderOptions.Base.key_open_tab = '<C-t>' | |
let g:FuzzyFinderOptions.Base.key_ignore_case = '<C-i>' | |
"set tags+=~/.vim/systags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment