set nocompatible " be iMproved, required filetype off " required set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' Plugin 'airblade/vim-gitgutter' Plugin 'altercation/vim-colors-solarized' Plugin 'scrooloose/nerdtree' Plugin 'vim-syntastic/syntastic' Plugin 'farmergreg/vim-lastplace.git' Plugin 'yggdroot/indentline' call vundle#end() " required filetype plugin indent on " required " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal syntax enable set background=dark "" Default Tab Setup set tabstop=2 set softtabstop=0 set shiftwidth=2 set expandtab set smarttab "set cindent " Interferes with filetype based intentation, automatic for set cinoptions=(0,u0,U0 "set smartindent " No effect with cindent enabled set autoindent " Retains intentation from previous line set copyindent set preserveindent " Might interfere with smarttab ? set paste set wildmenu " Tab Completion Menu set smartindent " Puppet Manifests Tab Setup "" Status Bar Setup set laststatus=2 set noshowmode set showcmd "" Needed for proper tabline display of anonymous buffers set hidden set mouse=r " Search options set ignorecase "ignore case when searching set smartcase "first search casesensivtive, then set incsearch "Just to searchresult while typing set hlsearch " Highlight search results hi Search guibg=lightRed " Press Space to turn off highlighting and clear any message already displayed. :nnoremap :nohlsearch:echo " ------------------------------------ Colors / Theme ------------------------------------------- "let g:solarized_visibility = "high" "let g:solarized_contrast = "low" "let g:solarized_termcolors = 256 let g:airline_solarized_bg='dark' colorscheme solarized augroup CursorLine au! au VimEnter,WinEnter,BufWinEnter * setlocal cursorline au WinLeave * setlocal nocursorline augroup END " ------------------------------------ Keybindings ------------------------------------------- " toggle numbers noremap :set invnumber inoremap :set invnumber map :NERDTreeToggle " splits nnoremap " ------------------------------------ AirLine ------------------------------------------- let g:airline_theme='solarized' let g:airline#extensions#tabline#enabled = 1 "let g:airline#extensions#tabline#left_sep = ' ' "let g:airline#extensions#tabline#left_alt_sep = '|' "let g:airline#extensions#tabline#formatter = 'default' " powerline symbols let g:airline_symbols = {} let g:airline_left_sep = '' let g:airline_left_alt_sep = '' let g:airline_right_sep = '' let g:airline_right_alt_sep = '' let g:airline_symbols.branch = '' let g:airline_symbols.readonly = '' let g:airline_symbols.linenr = '☰' let g:airline_symbols.maxlinenr = '' " ------------------------------------ SynTastic------------------------------------------- set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 let g:syntastic_mode_map = { 'passive_filetypes': ['cpp', 'c'] } " ------------------------------------ NERDTree ------------------------------------------- "" NERDTree Setup let g:NERDTreeDirArrowExpandable = '>' let g:NERDTreeDirArrowCollapsible = 'v' " close vim if only in nerdtree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " ------------------------------------ GitGutter ------------------------------------------- "" GitGutter Setup set updatetime=250 let g:gitgutter_enabled = 1 let g:gitgutter_signs = 1 let g:gitgutter_highlight_lines = 0 if executable('/usr/bin/git') == 0 let g:gitgutter_git_executable = "/bin/true" let g:gitgutter_enabled = 1 endif let g:gitgutter_max_signs = 500 " default value let g:gitgutter_realtime = 1 let g:gitgutter_eager = 1 " ------------------------------------ Indent Line ------------------------------------------- let g:indentLine_color_term = 0 "let g:indentLine_char_list = ['|', '¦', '┆', '┊'] " ------------------------------------ Whitespace Highlighting ------------------------------------------- autocmd ColorScheme * highlight ExtraWhitespaces ctermbg=red guibg=red "" Extra Whitespace Highlighting highlight ExtraWhitespaces ctermbg=red guibg=red "Show tabs and spaces after the inital (tabs and) spaces "Show trailing whitespace only after some text (ignores blank lines) "Show tabs that are not at the start of a line (and all spaces after too) function! MatchExtraWhitespacesNow() if exists("b:sew") if b:sew == 1 match ExtraWhitespaces /^\t* \+\zs\(\t\+ *\)\+\|\S\zs\(\s\+$\| *\zs\(\t\+ *\)\+\)/ else if exists("b:sewb") if b:sewb == 1 match ExtraWhitespaces /\S\zs\s\+$/ else :call clearmatches() endif endif endif endif endfunction function! MatchExtraWhitespacesNowInsert() if exists("b:sew") if b:sew == 1 match ExtraWhitespaces /^\t* \+\zs\(\t\+ *\)\+\|\S\zs\(\s\+\%#\@StripExtraWhitespaces() if exists("b:sewb") if b:sewb == 1 let l = line(".") let c = col(".") "Remove trailing whitespace only after some text (ignores blank lines) %s/\S\zs\s\+$//ge if exists("b:sew") if b:sew == 1 "Remove tabs and spaces after the inital (tabs and) spaces %s/^\t* \+\zs\(\t\+ *\)\+//ge "Replace tabs that are not at the start of a line "(and all spaces after too) with a single space to keep "tokens apart %s/\S *\zs\(\t\+ *\)\+/ /ge endif endif call cursor(l, c) endif endif endfunction autocmd BufWinEnter * :call MatchExtraWhitespacesNow() autocmd InsertEnter * :call MatchExtraWhitespacesNowInsert() autocmd InsertLeave * :call MatchExtraWhitespacesNow() autocmd BufWinLeave * :call clearmatches() autocmd FileType c,changelog,conf,config,cpp,csh,diff,dosini,eruby,fstab,git,gitcommit,gitconfig,gitrebase,haskell,make,pamconf,puppet,ruby,sh,spec,sshconfig,sudoers,tex,vim,yaml,zsh let b:sewb=1 | let b:sew=0 | :call MatchExtraWhitespacesNow() autocmd BufWritePre :call StripExtraWhitespaces() command Sewb let b:sewb=1 | let b:sew=0 | :call MatchExtraWhitespacesNow() command Sew let b:sewb=1 | let b:sew=1 | :call MatchExtraWhitespacesNow() command Sewbnow let b:sewb=1 | let b:sew=0 | :call StripExtraWhitespaces() | :call MatchExtraWhitespacesNow() command Sewnow let b:sewb=1 | let b:sew=1 | :call StripExtraWhitespaces() | :call MatchExtraWhitespacesNow() command Nosewb let b:sewb=0 | let b:sew=0 | :call MatchExtraWhitespacesNow() command Nosew let b:sew=0 | :call MatchExtraWhitespacesNow() ""------------------------------------ Vimdiff Setup ---------------------------------------------------- highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red "" Disable syntax highlighting in diff mode only if &diff syntax off endif " ------------------------------------ More Cool Stuff ------------------------------------------- "" UTF-8 Setup if has("multi_byte") if &termencoding == "" let &termencoding = &encoding endif set encoding=utf-8 setglobal fileencoding=utf-8 "setglobal bomb set fileencodings=ucs-bom,utf-8,latin1 endif