set nocompatible " be iMproved filetype plugin indent on " required! set rtp+=~/vimfiles/bundle/vundle/ call vundle#rc() let g:vundle_default_git_proto = 'git' " let Vundle manage Vundle " required! Bundle 'gmarik/vundle' " My Bundles here: " " original repos on github Bundle 'bling/vim-airline' Bundle 'Lokaltog/vim-easymotion' Bundle 'vim-scripts/Vimtodo' Bundle 'molokai' Bundle 'oblitum/rainbow' Bundle 'vimwiki/vimwiki' Bundle 'chriskempson/vim-tomorrow-theme' Bundle 'sk1418/last256' Bundle 'kshenoy/vim-signature' Bundle 'rking/ag.vim' Bundle 'xolox/vim-misc' Bundle 'w0ng/vim-hybrid' Bundle 'tpope/vim-surround' Bundle 'tpope/vim-commentary' Bundle 'tmhedberg/matchit' " map copy/paste map p "+p map y "+y set clipboard=unnamed cnoremap + " search set hlsearch set incsearch set number set ignorecase vmap // y/\V" set scrolloff=5 " Navigate 4x faster when holding down Ctrl nmap 4j nmap 4k nmap 4h nmap 4l imap " ctags "nnoremap :ts " Jump to matching pairs easily, with Tab "nnoremap % "vnoremap % " remap : nnoremap ; : " set spelling "setlocal spell spelllang=en_us nmap s :set spell! map S z= set sps=best,10 " set the locaiton for swp files set directory=e:\personal set backupdir=e:\personal " flashes matching brackets or parentheses set showmatch " Fix for legacy vi inconsistency map Y y$ syntax on "colorscheme Tomorrow colorscheme hybrid if &diff colorscheme hybrid set lines=999 columns=999 unmap unmap nmap ]c nmap [c endif " terminal color if &term =~ "xterm" "256 color -- let &t_Co=256 " restore screen after quitting set t_ti=ESC7ESC[rESC[?47h t_te=ESC[?47lESC8 if has("terminfo") let &t_Sf="\ESC[3%p1%dm" let &t_Sb="\ESC[4%p1%dm" else let &t_Sf="\ESC[3%dm" let &t_Sb="\ESC[4%dm"sjl/gundo.vim endif endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Text, tab and indent related """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Display extra whitespace set list listchars=tab:»·,trail:· set autoindent set smartindent set smarttab set shiftwidth=2 set softtabstop=2 set tabstop=2 set expandtab " Linebreak on 500 characters set lbr set tw=500 set ai "Auto indent set si "Smart indent set wrap "Wrap lines set splitright " Puts new vsplit windows to the right of the current set splitbelow " Puts new split windows to the bottom of the current " set the language set langmenu=none " set visual bell -- i hate that damned beeping set vb " set history length set history=700 " disable the menu set guioptions-=m "remove menu bar set guioptions-=T "remove toolbar " show the current line set cul " set the font set guifont=Consolas:h11 " show the filename in the bottom of the window set modeline set ls=2 " rainbow conf au FileType c,r,xdm,m4,cpp,objc,objcpp call rainbow#load() " search for tags in the current directory then one up until the tags are " found set tags=tags;/ " Shortcut to rapidly toggle `set list` nmap l :set list! " window navigation nmap :wincmd k nmap :wincmd j nmap :wincmd h nmap :wincmd l " resize windows nmap :resize +5 nmap :resize -5 nmap :vertical resize +5 nmap :vertical resize -5 " show the column nnoremap c :silent set colorcolumn=100:set colorcolumn? nnoremap C :silent set colorcolumn=:set colorcolumn? " allow backspacing over everything in insert-mode set backspace=indent,eol,start " Remap VIM 0 to first non-blank character map 0 ^ au BufNewFile,BufRead *.xdm set filetype=xml au BufNewFile,BufRead *.xdm.m4 setlocal filetype=xml au BufNewFile,BufRead *.c.m4 set filetype=c " Ag let g:agprg="ag -i -p path.agignore --search-binary" let g:aghighlight=1 let g:agformat="%f:%l:%m" nnoremap :cnext nnoremap :cprevious nnoremap e :Ag! =GetRootPath() nnoremap r :Ag! =GetRootPath() nnoremap E :AgFile! =GetRootPath() nnoremap d :call DiffTilComit() function! GetRootPath() let path_2 = expand("%:p:h") " deleted return path_1 endfunction function! DiffTilComit() let path_1 = expand("%:t") let path_2 = expand("%:p:h").'\.svn\text-base\'.path_1.'.svn-base' let path_3 = expand("%:p:h").'\'.path_1 exe 'tabnew '.path_3 exe 'vert diffsplit '.path_2 endfunction " toggle between number and relativenumber function! ToggleNumber() if(&relativenumber == 1) set norelativenumber set number else set relativenumber endif endfunc nnoremap :call ToggleNumber() " strips trailing whitespace at the end of files. this " is called on buffer write in the autogroup above. function! StripTrailingWhitespaces() " save last search & cursor position let _s=@/ let l = line(".") let c = col(".") %s/\s\+$//e let @/=_s call cursor(l, c) endfunction nnoremap st :call StripTrailingWhitespaces() " autoreload $MYVIMRC augroup reload_vimrc " { autocmd! autocmd BufWritePost $MYVIMRC source $MYVIMRC augroup END " } nnoremap b] :bnext nnoremap b[ :bprevious nnoremap n :silent !"C:\Program Files (x86)\Notepad++\notepad++.exe" %:p set autoread augroup project autocmd! autocmd BufRead,BufNewFile *.h,*.c,*.m4 set filetype=c.doxygen augroup END let &path.="C:\Projects\trunk," vmap v (expand_region_expand) vmap (expand_region_shrink) "I search things usual way using /something "I hit cs, replace first match, and hit "I hit n.n.n.n.n. reviewing and replacing all matches vnoremap s //e=&selection=='exclusive'?'+1':'' \:call histdel('search',-1)let @/=histget('search',-1)gv omap s :normal vs " set the curent directory set autochdir " Return to last edit position (You want this!) [N] autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif au FileType qf call AdjustWindowHeight(3, 15) function! AdjustWindowHeight(minheight, maxheight) let l = 1 let n_lines = 0 let w_width = winwidth(0) while l <= line('$') " number to float for division let l_len = strlen(getline(l)) + 0.0 let line_width = l_len/w_width let n_lines += float2nr(ceil(line_width)) let l += 1 endw exe max([min([n_lines, a:maxheight]), a:minheight]) . "wincmd _" endfunction " sync scroll nnoremap sw :set scb! "fullscreen function! ToggleFullScreen() if has('win32') :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0) endif endfunction " for quickfix set nowrap au FileType qf set nowrap " ignore .svn in newtr let g:netrw_list_hide= '.*\.svn$'