Created
August 16, 2010 04:39
-
-
Save afterefx/526420 to your computer and use it in GitHub Desktop.
someone elses vim config
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
"----------------------------------------------------------------------------- | |
" Global Stuff | |
"----------------------------------------------------------------------------- | |
" Set filetype stuff to on | |
filetype on | |
filetype plugin on | |
filetype indent on | |
" Tabstops are 4 spaces | |
set tabstop=4 | |
set shiftwidth=4 | |
" set the search scan to wrap lines | |
set wrapscan | |
" set the search scan so that it ignores case when the search is all lower | |
" case but recognizes uppercase if it's specified | |
set ignorecase | |
set smartcase | |
" set the forward slash to be the slash of note. Backslashes suck | |
set shellslash | |
" Make command line two lines high | |
set ch=2 | |
" set visual bell -- i hate that damned beeping | |
set vb | |
" Allow backspacing over indent, eol, and the start of an insert | |
set backspace=2 | |
" Make sure that unsaved buffers that are to be put in the background are | |
" allowed to go in there (ie. the "must save first" error doesn't come up) | |
set hidden | |
" Make the 'cw' and like commands put a $ at the end instead of just deleting | |
" the text and replacing it | |
set cpoptions=ces$ | |
" Set the status line the way i like it | |
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ [%b][0x%B] | |
" tell VIM to always put a status line in, even if there is only one window | |
set laststatus=2 | |
" Don't update the display while executing macros | |
set lazyredraw | |
" Show the current command in the lower right corner | |
set showcmd | |
" Show the current mode | |
set showmode | |
" Switch on syntax highlighting. | |
syntax on | |
" Hide the mouse pointer while typing | |
set mousehide | |
" Set up the gui cursor to look nice | |
set guicursor=n-v-c:block-Cursor-blinkon0 | |
set guicursor+=ve:ver35-Cursor | |
set guicursor+=o:hor50-Cursor | |
set guicursor+=i-ci:ver25-Cursor | |
set guicursor+=r-cr:hor20-Cursor | |
set guicursor+=sm:block-Cursor-blinkwait175-blinkoff150-blinkon175 | |
" set the gui options the way I like | |
set guioptions=ac | |
" This is the timeout used while waiting for user input on a multi-keyed macro | |
" or while just sitting and waiting for another key to be pressed measured | |
" in milliseconds. | |
" | |
" i.e. for the ",d" command, there is a "timeoutlen" wait period between the | |
" "," key and the "d" key. If the "d" key isn't pressed before the | |
" timeout expires, one of two things happens: The "," command is executed | |
" if there is one (which there isn't) or the command aborts. | |
set timeoutlen=500 | |
" Keep some stuff in the history | |
set history=100 | |
" These commands open folds | |
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo | |
" When the page starts to scroll, keep the cursor 8 lines from the top and 8 | |
" lines from the bottom | |
set scrolloff=8 | |
" Allow the cursor to go in to "invalid" places | |
set virtualedit=all | |
" These things start comment lines | |
set comments=sl:/*,mb:\ *,ex:\ */,O://,b:#,:%,:XCOMM,n:>,fb:- | |
" Disable encryption (:X) | |
set key= | |
" Make the command-line completion better | |
set wildmenu | |
" Same as default except that I remove the 'u' option | |
set complete=.,w,b,t | |
" When completing by tag, show the whole tag, not just the function name | |
set showfulltag | |
" Set the textwidth to be 120 chars | |
set textwidth=120 | |
" get rid of the silly characters in window separators | |
set fillchars="" | |
" Turn tabs into spaces | |
set expandtab | |
" Add ignorance of whitespace to diff | |
set diffopt+=iwhite | |
" Enable search highlighting | |
set hlsearch | |
" Incrementally match the search | |
set incsearch | |
" Initial path seeding | |
set path= | |
set path+=/usr/local/include/** | |
set path+=/usr/include/** | |
set path+=~/code/** | |
" Set the tags files to be the following | |
set tags=./tags,tags | |
" Let the syntax highlighting for Java files allow cpp keywords | |
let java_allow_cpp_keywords = 1 | |
" Toggle paste mode | |
nmap <silent> ,p :set invpaste<CR>:set paste?<CR> | |
" cd to the directory containing the file in the buffer | |
nmap <silent> ,cd :lcd %:h<CR> | |
nmap <silent> ,md :!mkdir -p %:p:h<CR> | |
" Turn off that stupid highlight search | |
nmap <silent> ,n :set invhls<CR>:set hls?<CR> | |
" put the vim directives for my file editing settings in | |
nmap <silent> ,vi | |
\ ovim:set ts=4 sts=4 sw=4:<CR>vim600:fdm=marker fdl=1 fdc=0:<ESC> | |
" Show all available VIM servers | |
nmap <silent> ,ss :echo serverlist()<CR> | |
" The following beast is something i didn't write... it will return the | |
" syntax highlighting group that the current "thing" under the cursor | |
" belongs to -- very useful for figuring out what to change as far as | |
" syntax highlighting goes. | |
nmap <silent> <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") | |
\ . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") | |
\ . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") | |
\ . ">"<CR> | |
" set text wrapping toggles | |
nmap <silent> ,w :set invwrap<CR>:set wrap?<CR> | |
" Run the command that was just yanked | |
nmap <silent> ,rc :@"<cr> | |
" allow command line editing like emacs | |
cnoremap <C-A> <Home> | |
cnoremap <C-B> <Left> | |
cnoremap <C-E> <End> | |
cnoremap <C-F> <Right> | |
cnoremap <C-N> <End> | |
cnoremap <C-P> <Up> | |
cnoremap <ESC>b <S-Left> | |
cnoremap <ESC><C-B> <S-Left> | |
cnoremap <ESC>f <S-Right> | |
cnoremap <ESC><C-F> <S-Right> | |
cnoremap <ESC><C-H> <C-W> | |
" Maps to make handling windows a bit easier | |
noremap <silent> ,h :wincmd h<CR> | |
noremap <silent> ,j :wincmd j<CR> | |
noremap <silent> ,k :wincmd k<CR> | |
noremap <silent> ,l :wincmd l<CR> | |
noremap <silent> ,sb :wincmd p<CR> | |
noremap <silent> <C-F9> :vertical resize -10<CR> | |
noremap <silent> <C-F10> :resize +10<CR> | |
noremap <silent> <C-F11> :resize -10<CR> | |
noremap <silent> <C-F12> :vertical resize +10<CR> | |
noremap <silent> ,s8 :vertical resize 83<CR> | |
noremap <silent> ,cj :wincmd j<CR>:close<CR> | |
noremap <silent> ,ck :wincmd k<CR>:close<CR> | |
noremap <silent> ,ch :wincmd h<CR>:close<CR> | |
noremap <silent> ,cl :wincmd l<CR>:close<CR> | |
noremap <silent> ,cc :close<CR> | |
noremap <silent> ,cw :cclose<CR> | |
noremap <silent> ,ml <C-W>L | |
noremap <silent> ,mk <C-W>K | |
noremap <silent> ,mh <C-W>H | |
noremap <silent> ,mj <C-W>J | |
noremap <silent> <C-7> <C-W>> | |
noremap <silent> <C-8> <C-W>+ | |
noremap <silent> <C-9> <C-W>+ | |
noremap <silent> <C-0> <C-W>> | |
" Map CTRL-E to do what ',' used to do | |
nnoremap <c-e> , | |
vnoremap <c-e> , | |
" Buffer commands | |
noremap <silent> ,bd :bd<CR> | |
" Edit the vimrc file | |
nmap <silent> ,ev :e $MYVIMRC<CR> | |
nmap <silent> ,sv :so $MYVIMRC<CR> | |
" Make horizontal scrolling easier | |
nmap <silent> <C-o> 10zl | |
nmap <silent> <C-i> 10zh | |
" Highlight all instances of the current word under the cursor | |
nmap <silent> ^ :setl hls<CR>:let @/="<C-r><C-w>"<CR> | |
" Search the current file for what's currently in the search | |
" register and display matches | |
nmap <silent> ,gs | |
\ :vimgrep /<C-r>// %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR> | |
" Search the current file for the word under the cursor and display matches | |
nmap <silent> ,gw | |
\ :vimgrep /<C-r><C-w>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR> | |
" Search the current file for the WORD under the cursor and display matches | |
nmap <silent> ,gW | |
\ :vimgrep /<C-r><C-a>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR> | |
" Swap two words | |
nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`' | |
" Underline the current line with '=' | |
nmap <silent> ,ul :t.\|s/./=/g\|set nohls<cr> | |
" Delete all buffers | |
nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr> | |
" Syntax coloring lines that are too long just slows down the world | |
set synmaxcol=2048 | |
" I don't like it when the matching parens are automatically highlighted | |
let loaded_matchparen = 1 | |
"----------------------------------------------------------------------------- | |
" MiniBufExplorer Plugin Settings | |
"----------------------------------------------------------------------------- | |
" Yup, I don't like this one either | |
let loaded_minibufexplorer = 1 | |
"----------------------------------------------------------------------------- | |
" ShowMarks Plugin Stuff | |
"----------------------------------------------------------------------------- | |
" I don't think I like this | |
let g:loaded_showmarks = 1 | |
"----------------------------------------------------------------------------- | |
" Source Explorer Plugin Settings | |
"----------------------------------------------------------------------------- | |
" The switch of the Source Explorer | |
nmap <silent> <F8> :SrcExplToggle<CR> | |
" Set the height of Source Explorer window | |
let g:SrcExpl_winHeight = 16 | |
" Set 10 ms for refreshing the Source Explorer | |
let g:SrcExpl_refreshTime = 10 | |
" In order to Avoid conflicts, the Source Explorer should know what plugins | |
" are using buffers. And you need add their bufname into the list below | |
" according to the command ":buffers!" | |
let g:SrcExpl_pluginList = [ | |
\ "_NERD_tree_", | |
\ "Source_Explorer" | |
\ ] | |
" Enable/Disable the local definition searching, and note that this is not | |
" guaranteed to work, the Source Explorer doesn't check the syntax for now. | |
" It only searches for a match with the keyword according to command 'gd' | |
let g:SrcExpl_searchLocalDef = 1 | |
" Do not let the Source Explorer update the tags file when opening | |
let g:SrcExpl_isUpdateTags = 0 | |
" Use program 'ctags' with argument '--sort=foldcase -R' to create or | |
" update a tags file | |
let g:SrcExpl_updateTagsCmd = "retag.ksh" | |
" Set "<F9>" key for updating the tags file artificially | |
let g:SrcExpl_updateTagsKey = "<F9>" | |
"----------------------------------------------------------------------------- | |
" NERD Tree Plugin Settings | |
"----------------------------------------------------------------------------- | |
" Toggle the NERD Tree on an off with F7 | |
nmap <F7> :NERDTreeToggle<CR> | |
" Close the NERD Tree with Shift-F7 | |
nmap <S-F7> :NERDTreeClose<CR> | |
" Store the bookmarks file in perforce | |
let NERDTreeBookmarksFile="~/.vim/NERDTreeBookmarks" | |
" Show the bookmarks table on startup | |
let NERDTreeShowBookmarks=1 | |
" Don't display these kinds of files | |
let NERDTreeIgnore=[ '\.ncb$', '\.suo$', '\.vcproj\.RIMNET', '\.obj$', | |
\ '\.ilk$', '^BuildLog.htm$', '\.pdb$', '\.idb$', | |
\ '\.embed\.manifest$', '\.embed\.manifest.res$', | |
\ '\.intermediate\.manifest$', '^mt.dep$' ] | |
"----------------------------------------------------------------------------- | |
" FSwitch Settings | |
"----------------------------------------------------------------------------- | |
nmap <silent> ,of :FSHere<CR> | |
nmap <silent> ,ol :FSRight<CR> | |
nmap <silent> ,oL :FSSplitRight<CR> | |
nmap <silent> ,oh :FSLeft<CR> | |
nmap <silent> ,oH :FSSplitLeft<CR> | |
nmap <silent> ,ok :FSAbove<CR> | |
nmap <silent> ,oK :FSSplitAbove<CR> | |
nmap <silent> ,oj :FSBelow<CR> | |
nmap <silent> ,oJ :FSSplitBelow<CR> | |
"----------------------------------------------------------------------------- | |
" SnipMate Settings | |
"----------------------------------------------------------------------------- | |
"source ~/.vim/snippets/support_functions.vim | |
"source ~/.vim/snippets/support_functions_derek.vim | |
function! ListKnownSnippetLanguageTypes(A, L, P) | |
let filesanddirs = split(globpath(g:snippets_dir, a:A . "*"), "\n") | |
let dirsonly = [] | |
for f in filesanddirs | |
if isdirectory(f) | |
let each = split(f, '/') | |
let dirsonly = add(dirsonly, each[-1]) | |
end | |
endfor | |
return dirsonly | |
endfunction | |
function! ReloadSnippets(type) | |
call ResetSnippets() | |
if a:type != "" | |
call ExtractSnips(g:snippets_dir . a:type, a:type) | |
else | |
let alltypes = ListKnownSnippetLanguageTypes("", "", "") | |
for type in alltypes | |
call ExtractSnips(g:snippets_dir . type, type) | |
endfor | |
endif | |
endfunction | |
command! -complete=customlist,ListKnownSnippetLanguageTypes | |
\ -nargs=? RS call ReloadSnippets("<args>") | |
"----------------------------------------------------------------------------- | |
" FuzzyFinder Settings | |
"----------------------------------------------------------------------------- | |
nmap ,fb :FuzzyFinderBuffer<CR> | |
nmap ,ff :FuzzyFinderFile<CR> | |
nmap ,ft :FuzzyFinderTag<CR> | |
"----------------------------------------------------------------------------- | |
" UltiSnips Settings | |
"----------------------------------------------------------------------------- | |
set runtimepath+=~/.vim/ultisnips | |
let g:UltiSnipsExpandTrigger="<c-9>" | |
let g:UltiSnipsJumpForwardTrigger="<c-j>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-k>" | |
"----------------------------------------------------------------------------- | |
" Functions | |
"----------------------------------------------------------------------------- | |
function! RunSystemCall(systemcall) | |
let output = system(a:systemcall) | |
let output = substitute(output, "\n", '', 'g') | |
return output | |
endfunction | |
"----------------------------------------------------------------------------- | |
" Auto commands | |
"----------------------------------------------------------------------------- | |
augroup derek_scons | |
au! | |
au BufNewFile,BufRead SCons* setf scons | |
augroup END | |
augroup derek_xsd | |
au! | |
au BufEnter *.xsd,*.wsdl,*.xml setl tabstop=4 | setl shiftwidth=4 | |
au BufEnter *.xsd,*.wsdl,*.xml setl formatoptions=crq | setl textwidth=80 | |
augroup END | |
augroup Binary | |
au! | |
au BufReadPre *.bin let &bin=1 | |
au BufReadPost *.bin if &bin | %!xxd | |
au BufReadPost *.bin set filetype=xxd | endif | |
au BufWritePre *.bin if &bin | %!xxd -r | |
au BufWritePre *.bin endif | |
au BufWritePost *.bin if &bin | %!xxd | |
au BufWritePost *.bin set nomod | endif | |
augroup END | |
"----------------------------------------------------------------------------- | |
" Fix constant spelling mistakes | |
"----------------------------------------------------------------------------- | |
iab teh the | |
iab Teh The | |
iab taht that | |
iab Taht That | |
iab alos also | |
iab Alos Also | |
iab aslo also | |
iab Aslo Also | |
iab becuase because | |
iab Becuase Because | |
iab bianry binary | |
iab Bianry Binary | |
iab bianries binaries | |
iab Bianries Binaries | |
iab charcter character | |
iab Charcter Character | |
iab charcters characters | |
iab Charcters Characters | |
iab exmaple example | |
iab Exmaple Example | |
iab exmaples examples | |
iab Exmaples Examples | |
iab shoudl should | |
iab Shoudl Should | |
iab seperate separate | |
iab Seperate Separate | |
iab fone phone | |
iab Fone Phone | |
"----------------------------------------------------------------------------- | |
" Set up the window colors and size | |
"----------------------------------------------------------------------------- | |
if has("gui_running") | |
set guifont=Monaco:h12 | |
colorscheme xoria256 | |
if !exists("g:vimrcloaded") | |
winpos 0 0 | |
if ! &diff | |
winsize 130 90 | |
else | |
winsize 227 90 | |
endif | |
let g:vimrcloaded = 1 | |
endif | |
endif | |
:nohls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment