From 106f60a6bfb2e5241f68c0db2278de69144ab45e Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Wed, 1 Jan 2014 14:24:09 -0500 Subject: [PATCH] New year, new vimrc. --- git/gitconfig | 2 +- vim/vimrc | 440 ++++++++++++++------------------------------------ 2 files changed, 121 insertions(+), 321 deletions(-) diff --git a/git/gitconfig b/git/gitconfig index c1abfd5..4869574 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -1,5 +1,5 @@ [user] - name = Josh Sherman + name = Joshua Sherman email = josh@gravityblvd.com [diff] diff --git a/vim/vimrc b/vim/vimrc index 7050998..19e5c6b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,335 +1,137 @@ -set nocompatible -"filetype off " required by Vundle - -set rtp+=~/.vim/bundle/vundle/ -call vundle#rc() - -" Required, let Vundle manage Vundle -Bundle 'gmarik/vundle' - -Bundle 'scrooloose/nerdtree' -"Bundle 'msanders/snipmate.vim' -Bundle 'ervandew/supertab' -Bundle 'scrooloose/syntastic' -Bundle 'tpope/vim-fugitive' -Bundle 'KohPoll/vim-less' - -Bundle 'bvemu.vim' -Bundle 'random.vim' - -Bundle 'Command-T' -Bundle 'SearchComplete' - -"filetype indent plugin on " Also required by Vundle - -" Supposed to fix https://github.com/millermedeiros/vim-statline/issues/6 -let g:statline_syntastic = 0 - -" Stole some shit from these: -" https://raw.github.com/scrooloose/vimfiles/master/vimrc -" http://amix.dk/vim/vimrc.html -" http://nvie.com/posts/how-i-boosted-my-vim/ - -set ttyfast -set history=1000 -set tm=500 - -set list -"set listchars=nbsp:¬,eol:¶,tab:>-,extends:»,precedes:«,trail:• -set listchars=nbsp:¬,eol:↳,tab:└─,extends:»,precedes:«,trail:• -autocmd filetype html,xml set listchars-=tab:>. - -set pastetoggle= - -if v:version >= 703 - set undodir=~/.vim/undofiles - set undofile - - set colorcolumn=+1 -endif - set autoindent -"set backspace=2 +set background=dark set backspace=indent,eol,start +set colorcolumn=+1 set foldmethod=marker set hidden -set incsearch -set ignorecase +set history=1000 set hlsearch -set smartcase -set nocindent -set showmatch +set ignorecase +set incsearch +set laststatus=2 +set list +set listchars=nbsp:¬,eol:↳,tab:└─,extends:»,precedes:«,trail:• set mat=2 -set smartindent +set mouse=a +set nocindent +set nocompatible +set number +set pastetoggle= +set rtp+=~/.vim/bundle/vundle/ set shiftwidth=4 +set showmatch +set smartcase +set smartindent +set t_Co=256 set tabstop=4 set textwidth=0 -set number - -let mapleader = "," - -nnoremap n :NERDTree -nnoremap w :w -nnoremap ww :w! -nnoremap q :q -nnoremap 8 :set colorcolumn=80 -nnoremap 9 :set colorcolumn=+1 -nnoremap f :set list -nnoremap g :set nolist -nnoremap 3 :set number -nnoremap 4 :set nonumber -nnoremap [ :previous -nnoremap ] :next -nnoremap tt /\t$ -nnoremap ss / $ - -nnoremap ; : - -nmap ,/ :nohlsearch - -" dammit josh, stop using the arrow keys!!! -map -map -map -map - -map + > -map - < - -noremap m mmHmt:%s///ge'tzt'm - -"map e :e! ~/.vim_runtime/vimrc -"autocmd! bufwritepost vimrc source ~/.vim_runtime/vimrc -autocmd BufWritePost * silent !~/Source/dotfiles/scripts/refresh - -set wildmode=list:longest +set tm=500 +set ttyfast +set undodir=~/.vim/undofiles +set undofile +set undolevels=1000 set wildmenu -set wildignore=*.o,*.obj,*~ +set wildmode=list:longest -"set mouse=a +call vundle#rc() -set t_Co=256 -set background=dark +Bundle 'gmarik/vundle' +Bundle 'bvemu.vim' +Bundle 'bling/vim-airline' +Bundle 'bling/vim-bufferline' +Bundle 'Command-T' +Bundle 'ervandew/supertab' +Bundle 'joshtronic/php.vim' +"Bundle 'kien/ctrlp.vim' " Replacement for Cmd-T? +Bundle 'KohPoll/vim-less' +"Bundle 'kshenoy/vim-signature' " Error when saving file with error +Bundle 'Lokaltog/vim-easymotion' +"Bundle 'msanders/snipmate.vim' " Was fucking up supertab +Bundle 'othree/html5.vim' +Bundle 'pangloss/vim-javascript.git' +Bundle 'random.vim' +Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} +Bundle 'scrooloose/nerdcommenter' +Bundle 'scrooloose/nerdtree' +Bundle 'scrooloose/syntastic' +Bundle 'SearchComplete' +Bundle 'tpope/vim-fugitive' +Bundle 'tpope/vim-surround' +" Picks a colorscheme if has('gui_running') colorscheme macvim else - colorscheme default - colorscheme random colorscheme bvemu endif +autocmd BufEnter * match ExtraWhitespace /\s\+$/ +autocmd BufNewFile,BufRead *.less set filetype=less +autocmd BufReadPost * call SetCursorPosition() +autocmd BufWritePost * silent !~/Source/dotfiles/scripts/refresh +autocmd ColorScheme * highlight ExtraWhitespace guibg=red +autocmd FileType c set omnifunc=ccomplete#CompleteCpp +autocmd FileType css set omnifunc=csscomplete#CompleteCSS +autocmd FileType html set omnifunc=htmlcomplete#CompleteTags +autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS +autocmd FileType php set omnifunc=phpcomplete#CompletePHP +autocmd FileType python set omnifunc=pythoncomplete#Complete +autocmd FileType svn,*commit* setlocal spell +autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@ .. :edit %:h | + \ endif + +highlight Conditional ctermfg=2 +highlight Constant cterm=NONE ctermfg=2 +highlight ExtraWhitespace ctermbg=red guibg=red +highlight Function cterm=NONE ctermfg=2 +highlight link javaScriptBraces NONE +highlight NonText ctermfg=237 guifg=#303030 +highlight Number cterm=NONE ctermfg=darkred +highlight Search cterm=NONE ctermfg=NONE +highlight SpecialKey ctermfg=237 guifg=#303030 +highlight Statement cterm=NONE ctermfg=2 +highlight String cterm=NONE ctermfg=darkred + +let mapleader = ',' +let g:airline_powerline_fonts = 1 +let g:airline_theme_patch_func = 'AirlineThemePatch' +let g:NERDTreeMouseMode = 3 +let g:NERDTreeWinSize = 40 + +nmap ,/ :nohlsearch +nnoremap ; : +nnoremap [ :previous +nnoremap ] :next +nnoremap { :first +nnoremap } :last +nnoremap 3 :set nonumber +nnoremap # :set number +nnoremap 8 :set colorcolumn=80 +nnoremap * :set colorcolumn=+1 +nnoremap f :set nolist +nnoremap F :set list +nnoremap n :NERDTree +nnoremap q :q +nnoremap ss / $ +nnoremap tt /\t$ +nnoremap w :w +nnoremap ww :w! + syntax on syntax sync fromstart -hi NonText ctermfg=237 guifg=#303030 -hi SpecialKey ctermfg=237 guifg=#303030 - -highlight ExtraWhitespace ctermbg=red guibg=red -au ColorScheme * highlight ExtraWhitespace guibg=red -au BufEnter * match ExtraWhitespace /\s\+$/ -au InsertEnter * match ExtraWhitespace /\s\+\%#\@ 0 - let b:statusline_long_line_warning = "[" . - \ '#' . len(long_line_lens) . "," . - \ 'm' . s:Median(long_line_lens) . "," . - \ '$' . max(long_line_lens) . "]" - else - let b:statusline_long_line_warning = "" - endif - endif - return b:statusline_long_line_warning -endfunction - -"return a list containing the lengths of the long lines in this buffer -function! s:LongLines() - let threshold = (&tw ? &tw : 80) - let spaces = repeat(" ", &ts) - - let long_line_lens = [] - - let i = 1 - while i <= line("$") - let len = strlen(substitute(getline(i), '\t', spaces, 'g')) - if len > threshold - call add(long_line_lens, len) - endif - let i += 1 - endwhile - - return long_line_lens -endfunction - -"find the median of the given array of numbers -function! s:Median(nums) - let nums = sort(a:nums) - let l = len(nums) - - if l % 2 == 1 - let i = (l-1) / 2 - return nums[i] - else - return (nums[l/2] + nums[(l/2)-1]) / 2 - endif -endfunction - -let g:syntastic_enable_signs=1 -let g:syntastic_auto_loc_list=2 - -let g:snips_author = "Martin Grenfell" - -let g:NERDTreeMouseMode = 2 -let g:NERDTreeWinSize = 40 - -nnoremap :nohls -inoremap :nohls - -"visual search mappings -function! s:VSetSearch() - let temp = @@ - norm! gvy - let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') - let @@ = temp -endfunction - vnoremap * :call VSetSearch()// vnoremap # :call VSetSearch()?? -"jump to last cursor position when opening a file -"dont do it when writing a commit log entry -autocmd BufReadPost * call SetCursorPosition() +" Jumps to last cursor position except on commit messages function! SetCursorPosition() if &filetype !~ 'svn\|commit\c' if line("'\"") > 0 && line("'\"") <= line("$") @@ -339,17 +141,15 @@ function! SetCursorPosition() end endfunction -"spell check when writing commit logs -" TODO make it work for COMMIT_EDITMSG -autocmd filetype svn,*commit* setlocal spell +" Search for selected text +function! s:VSetSearch() + let temp = @@ + norm! gvy + let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') + let @@ = temp +endfunction -"http://vimcasts.org/episodes/fugitive-vim-browsing-the-git-object-database/ -"hacks from above (the url, not jesus) to delete fugitive buffers when we -"leave them - otherwise the buffer list gets poluted -" -"add a mapping on .. to view parent tree -autocmd BufReadPost fugitive://* set bufhidden=delete -autocmd BufReadPost fugitive://* - \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' | - \ nnoremap .. :edit %:h | - \ endif +" Force airline's color scheme +function! AirlineThemePatch(palette) + let a:palette.normal.airline_a = [ '#ffffff', '#268bd2', 255, 33 ] +endfunction