ftp -o - https://jcs.org/move_in | sh -
at pixel 213 lines 6.1 kB view raw
1" vim:ts=8 2" 3" vim 7 config " joshua stein <jcs@jcs.org> 4" 5 6" defaults for everything 7let c_minlines=500 8set backspace=indent,eol,start 9set hidden 10set ignorecase " make searching fun 11set incsearch " but highlight as i type 12set laststatus=2 13set modelines=5 " explicitly enable on mac os 14set nofoldenable " this shit is annoying 15set nohlsearch " don't highlight matches 16set nostartofline 17set pastetoggle=<C-p> " control+p to toggle pasting 18set ruler 19set scrolloff=10 " context is good 20set shiftwidth=4 " match default tab spacing 21set showcmd 22set showmatch " where'd the opening ')' go? 23set showmode 24set smartcase " be smart about searching 25set spellfile=~/.vimspell.add " my goodwords 26set spelllang=en_us 27set tabstop=4 " default tabs at 4 spaces 28set wildmode=longest,list,full " better filename tab completion 29 30set t_Co=256 " use all 256 colors 31syntax on " enable syntax highlighting 32colorscheme jcs " and load my colors 33 34" don't pollute directories with swap files, keep them in one place 35silent !mkdir -p ~/.vim/{backup,swp}/ 36set backupdir=~/.vim/backup// 37set directory=~/.vim/swp// 38 39if &term =~ "xterm.*" 40 let &t_ti = &t_ti . "\e[?2004h" 41 let &t_te = "\e[?2004l" . &t_te 42 43 function XTermPasteBegin(ret) 44 set pastetoggle=<Esc>[201~ 45 set paste 46 return a:ret 47 endfunction 48 49 map <expr> <Esc>[200~ XTermPasteBegin("i") 50 imap <expr> <Esc>[200~ XTermPasteBegin("") 51 cmap <Esc>[200~ <nop> 52 cmap <Esc>[201~ <nop> 53endif 54 55" nerdtree customizations 56 57let NERDTreeDirArrows=0 " use normal ascii 58let NERDTreeMinimalUI=1 " and save space 59let NERDTreeWinSize=29 " leave 80 chars for editing 60let NERDTreeMapOpenRecursively="+" 61let NERDTreeMapCloseChildren="-" " easier for me to remember 62let NERDTreeIgnore = ['\.(o|pyc)$'] 63 64" restore cursor position from viminfo 65autocmd BufReadPost * 66 \ if line("'\"") >= 1 && line("'\"") <= line("$") | 67 \ exe "normal! g`\"" | 68 \ endif 69 70" file type-specific settings 71 72autocmd FileType * setlocal colorcolumn=0 73 74" .phtml are php files 75au BufNewFile,BufRead *.phtml setlocal ft=php 76 77" these are rubyish files 78au BufNewFile,BufRead *.rake,*.mab setlocal ft=ruby 79au BufNewFile,BufRead *.erb setlocal ft=eruby 80 81au BufNewFile,BufRead *.pjs setlocal ft=php.javascript 82 83au BufRead,BufNewFile *.go setlocal ft=go 84 85" ruby - what tabs? 86au FileType ruby,eruby setlocal ts=2 sw=2 tw=79 et sts=2 autoindent colorcolumn=80 87 88" and your yaml 89au FileType yaml setlocal ts=2 sw=2 et colorcolumn=80 90 91" source code gets wrapped at <80 and auto-indented 92au FileType asm,c,cpp,go,java,javascript,php,html,make,objc,perl setlocal tw=79 autoindent colorcolumn=80 93 94" makefiles and c have tabstops at 8 for portability 95au FileType make,c,cpp setlocal ts=8 sw=8 96 97" email - expand tabs, wrap at 68 for future quoting, enable spelling 98au FileType mail setlocal tw=68 et spell colorcolumn=69 99 100" commit messages are like email 101au FileType cvs,gitcommit setlocal tw=68 et colorcolumn=69 spell 102 103" and make sure there's a blank line for me to start typing (openbsd's cvs does 104" this by default) 105au FileType cvs s/^CVS:/ 106CVS:/|1 107 108" git log messages are always the same file, but viminfo has stale data about 109" line pos 110au FileType gitcommit call setpos('.', [0, 1, 1, 0]) 111 112" fix for crontab erroring out because it can't see any changes 113au FileType crontab setlocal bkc=yes 114 115" when writing new files, mkdir -p their paths 116augroup BWCCreateDir 117 au! 118 autocmd BufWritePre * if expand("<afile>")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif 119augroup END 120 121 122" highlight stray spaces and tabs when out of insert mode 123" match ExtraWhitespace /\s\+$/ 124au BufWinEnter * match ExtraWhitespace /\s\+$/ 125au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ 126au InsertLeave * match ExtraWhitespace /\s\+$/ 127" performance hack 128if version >= 702 129 au BufWinLeave * call clearmatches() 130endif 131 132 133" macros 134 135" control+d - delete the current line and all remaining text of an email up to 136" the line of my signature (or the rest of the file) - useful for deleting lots 137" of useless quoted text 138function KillToSig() 139 let curline = line(".") 140 if search("^-- ") > 0 141 exec curline 142 normal! ^d/^-- / 143O 144 exec curline 145 else 146 normal! dGo 147 endif 148endfunction 149map  <Esc>:let curline=line(".")<CR>:exec KillToSig()<CR>:exec curline<CR> 150 151" control+] toggles colorcolumn 152" XXX: this is kind of buggy, no idea why 153let s:cc = "" 154function ToggleColorColumn() 155 let curline=line(".") 156 if &colorcolumn 157 let s:cc=&colorcolumn 158 set colorcolumn=0 159 echo s:cc 160 else 161 exec "set colorcolumn=" . s:cc 162 end 163 exec curline 164endfunction 165map  <Esc>:let curline=line(".")<CR><C-o>:exec ToggleColorColumn()<CR><C-o>:exec curline<CR> 166 167" make buffer windows easier to navigate 168map <C-h> <C-w>h 169map <C-j> <C-w>j 170map <C-k> <C-w>k 171map <C-l> <C-w>l 172 173map <C-n> :bn<CR> 174map <C-p> :bp<CR> 175" sbd plugin 176map <C-x> :Sbd<CR> 177 178" prevent those from running the nerdtree 179autocmd FileType nerdtree noremap <buffer> <C-h> <nop> 180autocmd FileType nerdtree noremap <buffer> <C-j> <nop> 181autocmd FileType nerdtree noremap <buffer> <C-k> <nop> 182autocmd FileType nerdtree noremap <buffer> <C-l> <nop> 183autocmd FileType nerdtree noremap <buffer> <C-n> <nop> 184autocmd FileType nerdtree noremap <buffer> <C-p> <nop> 185 186" me fail english? that's unpossible! 187abbr seperate separate 188abbr furnature furniture 189abbr rediculous ridiculous 190abbr definetly definitely 191abbr shold should 192abbr appologize apologize 193abbr propogate propagate 194abbr eachother each other 195 196" i hold shift a lot, make :W work like :w and :Q like :q 197cabbr W w 198cabbr Q q 199 200" disable annoying behavior where starting an auto-indented line with a hash 201" makes it unindent and refuse to >> 202:inoremap # X# 203 204" :w !sudo tee % 205 206" load pathogen for nerdtree and things 207call pathogen#infect() 208 209" " use camel case word motions 210" map w <Plug>CamelCaseMotion_w 211" map b <Plug>CamelCaseMotion_b 212" map e <Plug>CamelCaseMotion_e 213" sunmap w 214" sunmap b 215" sunmap e