" set up pathogen, https://github.com/tpope/vim-pathogen filetype on " without this vim emits a zero exit status, later, because of :ft off filetype off call pathogen#infect() filetype plugin indent on " don't bother with vi compatibility set nocompatible " enable syntax highlighting syntax enable set autoindent set autoread " reload files when changed on disk, i.e. via `git checkout` set backspace=2 " Fix broken backspace in some setups set backupcopy=yes " see :help crontab set clipboard=unnamed " yank and paste with the system clipboard set directory-=. " don't store swapfiles in the current directory set encoding=utf-8 set expandtab " expand tabs to spaces set ignorecase " case-insensitive search set incsearch " search as you type set laststatus=2 " always show statusline set list " show trailing whitespace set listchars=tab:▸\ ,trail:▫ set number " show line numbers set ruler " show where you are set scrolloff=3 " show context above/below cursorline set shiftwidth=2 " normal mode indentation commands use 2 spaces set showcmd set smartcase " case-sensitive search if any caps set softtabstop=2 " insert mode tab and backspace use 2 spaces set tabstop=8 " actual tabs occupy 8 characters set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc set wildmenu " show a navigable menu for tab completion set wildmode=longest,list,full " Enable basic mouse behavior such as resizing buffers. set mouse=a if exists('$TMUX') " Support resizing in tmux set ttymouse=xterm2 endif " keyboard shortcuts let mapleader = ',' map h map j map k map l map l :Align nmap a :Ack nmap b :CtrlPBuffer nmap d :NERDTreeToggle nmap f :NERDTreeFind nmap t :CtrlP nmap T :CtrlPClearCache:CtrlP nmap ] :TagbarToggle nmap :call whitespace#strip_trailing() nmap g :GitGutterToggle nmap c Kwbd map V :source ~/.vimrc:filetype detect:exe ":echo 'vimrc reloaded'" " plugin settings let g:ctrlp_match_window = 'order:ttb,max:20' let g:NERDSpaceDelims=1 let g:gitgutter_enabled = 0 " Use The Silver Searcher https://github.com/ggreer/the_silver_searcher if executable('ag') let g:ackprg = 'ag --nogroup --column' " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' endif " fdoc is yaml autocmd BufRead,BufNewFile *.fdoc set filetype=yaml " md is markdown autocmd BufRead,BufNewFile *.md set filetype=markdown " extra rails.vim help autocmd User Rails silent! Rnavcommand decorator app/decorators -glob=**/* -suffix=_decorator.rb autocmd User Rails silent! Rnavcommand observer app/observers -glob=**/* -suffix=_observer.rb autocmd User Rails silent! Rnavcommand feature features -glob=**/* -suffix=.feature autocmd User Rails silent! Rnavcommand job app/jobs -glob=**/* -suffix=_job.rb autocmd User Rails silent! Rnavcommand mediator app/mediators -glob=**/* -suffix=_mediator.rb autocmd User Rails silent! Rnavcommand stepdefinition features/step_definitions -glob=**/* -suffix=_steps.rb " automatically rebalance windows on vim resize autocmd VimResized * :wincmd = " Fix Cursor in TMUX if exists('$TMUX') let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" else let &t_SI = "\]50;CursorShape=1\x7" let &t_EI = "\]50;CursorShape=0\x7" endif " Go crazy! if filereadable(expand("~/.vimrc.local")) " In your .vimrc.local, you might like: " " set autowrite " set nocursorline " set nowritebackup " set whichwrap+=<,>,h,l,[,] " Wrap arrow keys between lines " " autocmd! bufwritepost .vimrc source ~/.vimrc " noremap! jj source ~/.vimrc.local endif