" Use pathogen to load other plugins execute pathogen#infect() Helptags filetype plugin indent on """"""""""""""""""""""""""""""""""""""""" " Some Basics " Note : vim-sensible does some of these " settings already """"""""""""""""""""""""""""""""""""""""" set encoding=utf-8 " Search settings set incsearch set ignorecase set smartcase set hlsearch " Indentation and tab functionality set tabstop=2 set shiftwidth=2 set softtabstop=2 set expandtab set autoindent set smarttab set smartindent " Code Folding set nofoldenable set foldmethod=indent set foldnestmax=10 set viewoptions=cursor,folds,slash,unix " let g:skipview_files = ['*\.vim'] " Line numbers set number " Line Wrapping set nowrap " Automatically update externally updated files set autoread " Command expiration set timeout set ttimeoutlen=15 " New window split settings set splitright " Remember buffer info on close set viminfo^=% """"""""""""""""""""""""""""""""""""""""" " Keybinds """"""""""""""""""""""""""""""""""""""""" let mapleader="\" " Wrapped lines treated like normal ones nnoremap j gj nnoremap k gk " Set CTRL+S to save becuase I smack that every 10 seconds on whatever application I use " browse is only available in gvim command -nargs=0 -bar Update if &modified \| if empty(bufname('%')) \| browse confirm write \| else \| confirm write \| endif \| endif nnoremap :Update inoremap :Update vnoremap :Update " CTRL+w to close the current buffer nnoremap :call CloseWindow() " Buffer magic nnoremap l :ls:b " Switch indentation settings nnoremap y :set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nnoremap Y :set expandtab tabstop=8 shiftwidth=8 softtabstop=4 nnoremap m :set expandtab tabstop=2 shiftwidth=2 softtabstop=2 nnoremap M :set noexpandtab tabstop=8 softtabstop=4 shiftwidth=4 " To wrap or not to wrap nnoremap w :setlocal wrap!:setlocal wrap? " Window Switching and Resizing nnoremap :wincmd k nnoremap :wincmd j nnoremap :wincmd h nnoremap :wincmd l nnoremap + :wincmd + nnoremap _ :wincmd - nnoremap ) :wincmd > nnoremap ( :wincmd < nnoremap r :wincmd r nnoremap R :wincmd R " Ctrl+d to duplicate a line, vmode versions is best for SHIFT+V, not the others nnoremap yyp vnoremap yp inoremap :yank:put " Open new files in new buffer or new windows nnoremap :e nnoremap :sp nnoremap :vs " Move lines of text via Alt+[jk] (Like sublime!) nnoremap :m+1== nnoremap :m-2== vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " Clear searches so there aren't underlined words. nnoremap :nohlsearch """"""""""""""""""""""""""""""""""""""""" " Ctrl-P Settings """"""""""""""""""""""""""""""""""""""""" " Keybinding and functionality let g:ctrlp_map = "o" let g:ctrlp_cmd = 'CtrlPLastMode' let g:ctrlp_extensions = ['line'] " Move Ctrl-P to top of the screen let g:ctrlp_match_window_bottom = 0 let g:ctrlp_match_window_reversed = 0 " Ignore some filetypes let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py' let g:ctrlp_switch_buffer = 'E' "let g:ctrlp_by_filename = 1 let g:ctrlp_clear_cache_on_exit = 0 " Uncomment to show hidden directories. "let g:ctrlp_show_hidden = 1 """"""""""""""""""""""""""""""""""""""""" " NerdTree """"""""""""""""""""""""""""""""""""""""" " Directory tree toggle nnoremap e :NERDTreeToggle """"""""""""""""""""""""""""""""""""""""" " NerdCommenter """"""""""""""""""""""""""""""""""""""""" map cc NERDCommenterToggle " For some reason, CommentToggle doesn't work unless this is " remapped, so remapping it to something I won't ever use. map NERDCommenterComment " Not sure if I want default c prefix or a different one. " Note : Insert is disabled by default "map /c\ NERDCommenterComment "map /n NERDCommenterNested "map /\ NERDCommenterToggle "map /m NERDCommenterMinimal "map /i NERDCommenterInvert "map /s NERDCommenterSexy "map /y NERDCommenterYank "map /$ NERDCommenterToEOL "map /A NERDCommenterAppend ""map / NERDCommenterInsert "map /a NERDCommenterAltDelims "map /b NERDCommenterAlignLeft "map /l NERDCommenterAlignBoth "map /u NERDCommenterUncomment """""""""""""""""""""""""""""""""""""""" " UltiSnips """""""""""""""""""""""""""""""""""""""" let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" """"""""""""""""""""""""""""""""""""""""" " TagList """"""""""""""""""""""""""""""""""""""""" nnoremap t :TlistToggle """"""""""""""""""""""""""""""""""""""""" " Easytags """"""""""""""""""""""""""""""""""""""""" let g:easytags_updatetime_min = 2000 """"""""""""""""""""""""""""""""""""""""" " Tex Settings """"""""""""""""""""""""""""""""""""""""" let g:tex_flavor = "latex" let g:LatexBox_latexmk_options = "-pvc -pdfps" autocmd FileType tex setlocal spell spelllang=en_us """"""""""""""""""""""""""""""""""""""""" " Colors and Themes """"""""""""""""""""""""""""""""""""""""" syntax enable "Set 256 color mode (not always needed). "if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal" " set t_Co=256 "endif " Use a nice color scheme colors Monokai """""""""""""""""""""""""""""""""""""""" " Useful Stuff """""""""""""""""""""""""""""""""""""""" " Return to last edit position on reopen autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " Delete trailing whitespaces on saving. func! DeleteTrailingWS() exe "normal mz" %s/\s\+$//ge exe "normal `z" endfunc autocmd BufWrite * :call DeleteTrailingWS() " Allow the use of ALT as a function key. let c='a' while c <= 'z' exec "set =\e".c exec "imap \e".c." " let c = nr2char(1+char2nr(c)) endw " Close current window or vim if no unsaved windows are open. fun! CloseWindow() if &modified echo "Save first or manual exit." else if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 q else :bd endif endif endfunction