""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " load plugins from vundle filetype off set rtp+=~/.vim/bundle/vundle/ call vundle#begin() " let vundle manage vundle Plugin 'gmarik/vundle' " utilities Plugin 'kien/ctrlp.vim' " fuzzy find files Plugin 'scrooloose/nerdtree' " file drawer, open with :NERDTreeToggle Plugin 'benmills/vimux' Plugin 'tpope/vim-fugitive' " the ultimate git helper Plugin 'tpope/vim-commentary' " comment/uncomment lines with gcc or gc in visual mode " colorschemes Plugin 'chriskempson/base16-vim' " JavaScript plugins Plugin 'pangloss/vim-javascript' Plugin 'jelera/vim-javascript-syntax' call vundle#end() filetype plugin indent on set nocompatible " not compatible with vi set autoread " detect when a file is changed " make backspace behave in a sane manner set backspace=indent,eol,start " set a map leader for more key combos let mapleader = ',' " Tab control set noexpandtab " tabs ftw set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' set tabstop=4 " the visible width of tabs set softtabstop=4 " edit as if the tabs are 4 characters wide set shiftwidth=4 " number of spaces to use for indent and unindent set shiftround " round indent to a multiple of 'shiftwidth' set clipboard=unnamed " faster redrawing set ttyfast " code folding settings set foldmethod=syntax " fold based on indent set foldnestmax=10 " deepest fold is 10 levels set nofoldenable " don't fold by default set foldlevel=1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => User Interface """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Searching set ignorecase " case insensitive searching set smartcase " case-sensitive if expresson contains a capital letter set hlsearch set incsearch " set incremental search, like modern browsers set nolazyredraw " don't redraw while executing macros set magic " Set magic on, for regex set showmatch " show matching braces set mat=2 " how many tenths of a second to blink " switch syntax highlighting on syntax on set encoding=utf8 let base16colorspace=256 " Access colors present in 256 colorspace" set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors" set background=dark colorscheme delek set number set autoindent " automatically set indent of new line set smartindent set laststatus=2 " show the satus line all the time """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" map ev :e! ~/.vimrc " edit ~/.vimrc map wc :wincmd q " moving up and down work as you would expect nnoremap j gj nnoremap k gk " helpers for dealing with other people's code nmap \t :set ts=4 sts=4 sw=4 noet nmap \s :set ts=4 sts=4 sw=4 et """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Functions """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" map :call WinMove('h') map :call WinMove('j') map :call WinMove('k') map :call WinMove('l') " Window movement shortcuts " move to the window in the direction shown, or create a new window function! WinMove(key) let t:curwin = winnr() exec "wincmd ".a:key if (t:curwin == winnr()) if (match(a:key,'[jk]')) wincmd v else wincmd s endif exec "wincmd ".a:key endif endfunction """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugin settings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " close NERDTree after a file is opened let g:NERDTreeQuitOnOpen=0 " show hidden files in NERDTree let NERDTreeShowHidden=1 " Toggle NERDTree nmap k :NERDTreeToggle " expand to the path of the file in the current buffer nmap y :NERDTreeFind " map fuzzyfinder (CtrlP) plugin " nmap t :CtrlP nmap r :CtrlPBuffer let g:ctrlp_map='t' let g:ctrlp_dotfiles=1 let g:ctrlp_working_path_mode = 'ra' " CtrlP ignore patterns let g:ctrlp_custom_ignore = { \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', \ 'file': '\.exe$\|\.so$' \ } " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2