diff --git a/vim/dot_vimrc b/vim/dot_vimrc index 4acaeb0..c98c4d2 100644 --- a/vim/dot_vimrc +++ b/vim/dot_vimrc @@ -1,5 +1,5 @@ -" Vundle -filetype off " required! +" Install Vundle Packages +filetype off set rtp+=~/.vim/bundle/vundle/ call vundle#rc() @@ -36,7 +36,8 @@ Bundle 'sandeepcr529/Buffet.vim' " -- Nav in file -- " Ctags file parsing -Bundle 'taglist.vim' +"Bundle 'taglist.vim' +Bundle 'majutsushi/tagbar' " Syntax checking Bundle 'scrooloose/syntastic' " Project Searching @@ -59,7 +60,7 @@ Bundle 'vim-scripts/Wombat' Bundle 'wombat256.vim' Bundle 'gregsexton/MatchTag' " Custom Status Line -Bundle 'Lokaltog/vim-powerline' +"Bundle 'Lokaltog/vim-powerline' "Powerline Config "If using a patched font: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts "let g:Powerline_symbols = 'fancy' @@ -68,42 +69,68 @@ Bundle 'Lokaltog/vim-powerline' Bundle 'ViViDboarder/vim-forcedotcom' Bundle 'pdurbin/vim-tsv' -"Allow arrow keys +" *************************** +" Built in settings +" *************************** + +"Allows filetype detection +filetype on + +" Set settings values +filetype plugin indent on + +" Allow arrow keys set nocompatible -"Use more convenient leader +" Use more convenient leader let mapleader="," -"Enable mouse input +" Enable mouse input set mousehide set mouse=a -"tab functionality -"tabs inserted as 4 spaces -"backspace deletes all spaces -"autoindent enabled +" Tab functionality set expandtab set tabstop=4 set shiftwidth=4 set softtabstop=4 set autoindent -"Ensure backspace actually works +" Ensure backspace actually works set backspace=2 -filetype plugin indent on - -set virtualedit=onemore " allow for cursor beyond last character -set scrolljump=5 " lines to scroll when cursor leaves screen -set scrolloff=3 " minimum lines to keep above and below cursor +" +" allow for cursor beyond last character +set virtualedit=onemore +" lines to scroll when cursor leaves screen +set scrolljump=5 +" minimum lines to keep above and below cursor +set scrolloff=3 " Display filename at bottom of window set ls=2 -"Set backup dirs +" Set backup dirs set backup set backupdir=~/.vim/backup set directory=~/.vim/tmp -"set theme based on $VIM_COLOR variable +"enable line numbers +set nu + +" Highlights the line the cursor is on +set cursorline +:hi CursorLine cterm=NONE ctermbg=darkred guibg=darkred guifg=white + +" Syntax Hightlighting +syntax on + +"Enable search highlighting +set hls + +" ******************************** +" GUI SETTINGS +" ***************************** + +" Set theme based on $VIM_COLOR variable try if !empty($VIM_COLOR) colorscheme $VIM_COLOR @@ -119,98 +146,110 @@ catch /^Vim\%((\a\+)\)\=:E185/ " This happens when first installing bundles endtry -"Highlights the line the cursor is on -set cursorline -:hi CursorLine cterm=NONE ctermbg=darkred guibg=darkred guifg=white -"Toggle highlighting with \hr (highlight row) -nnoremap hr :set cursorline! - -if has("gui_win32") - set guifont=Consolas:h10:b +" Set gui fonts +if has("gui_running") + if has("gui_win32") + set guifont=Consolas:h10:b + elseif has("gui_macvim") + try + "set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 + set guifont=ERROR\ Sans\ Mono\ for\ Powerline:h11 + catch + " Failed to set font + endtry + endif endif -"enable line numbers -set nu +" Set xterm title, and inform vim of screen/tmux's syntax for doing the same +set titlestring=vim\ %{expand(\"%t\")} +if &term =~ "^screen" + " pretend this is xterm. it probably is anyway, but if term is left as + " `screen`, vim doesn't understand ctrl-arrow. + if &term == "screen-256color" + set term=xterm-256color + else + set term=xterm + endif -"Toggle Line numbers with Ctrl+N double tap -nmap :set invnumber -nmap ln :set invnumber + " gotta set these *last*, since `set term` resets everything + set t_ts=k + set t_fs=\ +endif +set title -"Toggle line wrap with Ctrl+L double tap -nmap :set wrap! -nmap lw :set wrap! +" ******************************** +" SET HOTKEYS +" ******************************** -"Toggle White Space -nmap ws :set list! - -"Allows filetype detection -filetype on - -"Move between splits using Ctrl+hjkl -"map k -"map j -"map l -"map h - -"map Shift+U to redo -nnoremap - -"Buffet shortcut -nnoremap :Bufferlist -nnoremap bl :Bufferlist - -"Tab Man shortcut -"nnoremap :TMToggle - -"LustyJugler settings -"let g:LustyJugglerShowKeys=1 "Show numbers for Lusty Buffers -"let g:LustyJugglerSuppressRubyWarning=1 -"nnoremap :LustyJuggler -"nnoremap . :LustyJugglePrevious - -"NERDTree -nnoremap :NERDTreeToggle -nnoremap nn :NERDTreeToggle -nnoremap nf :NERDTreeFind - -"NERDComments -nnoremap // :TComment -vnoremap // :TCommentBlock - -"CTags List -"nnoremap :TlistToggle -"let Tlist_Exit_OnlyWindow=1 -"let Tlist_Winwidth=30 -nnoremap :TagbarToggle - -"Syntax Hightlighting -syntax on - -"Remap jk to esc +" Remap jk to esc inoremap jk -"vnoremap jk "Makes it difficult to select lines as j is common -"Remap Ctrl+Space for auto Complete +" Bind Make to F5 like other IDEs +nnoremap :make + +" Remap Ctrl+Space for auto Complete inoremap inoremap +" Toggle highlighting with \hr (highlight row) +nnoremap hr :set cursorline! + +" Toggle Line numbers with Ctrl+N double tap +nmap :set invnumber +nmap ln :set invnumber + +" Toggle line wrap with Ctrl+L double tap +nmap :set wrap! +nmap lw :set wrap! + +" Toggle White Space +nmap ws :set list! + +" Map Shift+U to redo +nnoremap + " Stupid shift key fixes -"cmap W w cmap WQ wq cmap Wq wq cmap W w cmap Q q +cmap Q! q! -"Enable search highlighting -set hls -"clearing highlighted search +" Clearing highlighted search nmap / :set hlsearch! hlsearch? noremap :set hlsearch! hlsearch? +" Clear search +nmap cs :nohlsearch + +" Code fold +nmap cf ?{zf%:nohlsearch " Change Working Directory to that of the current file cmap cwd lcd %:p:h cmap cd. lcd %:p:h +" ******************************** +" PLUGIN SETTINGS +" ******************************** + +" Buffet shortcut +nnoremap :Bufferlist +nnoremap bl :Bufferlist + +" NERDTree +nnoremap :NERDTreeToggle +nnoremap nn :NERDTreeToggle +nnoremap nf :NERDTreeFind + +" NERDComments +nnoremap // :TComment +vnoremap // :TCommentBlock + +" CTags List +nnoremap :TagbarToggle +" Autofocus tagbar +let g:tagbar_autofocus = 1 + " --------------- " Command T and ctrlp.vim " Snagged from mutewinter @ https://github.com/mutewinter/dot_vim @@ -228,61 +267,38 @@ let g:CommandTCancelMap = '' " Dynamically use Command T or ctrlp.vim based on availability of Ruby. " We do this because Command T is much faster than ctrlp.vim. if has('ruby') - " -------- - " Use Command T since we've got Ruby - " -------- + " Use Command T since we've got Ruby - " Conditional Mappings - if has('unix') + " Mappings nnoremap :CommandT - nnoremap :CommandTFlush - else - nnoremap :CommandT - nnoremap :CommandTFlush - endif - " Leader Commands - nnoremap t :CommandT - nnoremap tb :CommandTBuffer - nnoremap tt :CommandTTag - - if has("gui_macvim") - "macmenu &File.New\ Tab key= - "map :CommandT - endif + " Leader Commands + nnoremap t :CommandT + nnoremap b :CommanTBuffer + nnoremap tt :CommandTTag else - " -------- - " Use ctrlp.vim since we don't have Ruby - " -------- + " Use ctrlp.vim since we don't have Ruby - " Conditional Mappings - if has('unix') + " Conditional Mappings let g:ctrlp_map = '' - else - let g:ctrlp_map = '' - endif - " Leader Commands - "nnoremap t :CtrlPRoot - nnoremap b :CtrlPBuffer + " Leader Commands + nnoremap b :CtrlPBuffer endif " Also map leader commands nnoremap u :CtrlPCurFile nnoremap m :CtrlPMRUFiles +" fugitive " Add some shortcuts for git commands nnoremap gs :Gstatus nnoremap gc :Gcommit nnoremap gb :Gblame -" Bind Make to F5 like other IDEs -nnoremap :make - " Toggle QuickFix window nnoremap :QFix nmap a :Ack nmap * :Ack -"nnoremap ** :Ack