Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
135 lines (115 sloc) 4.55 KB
set nocompatible | filetype indent plugin on | syn on
" Install plugins using vim-addon-manager, which self-installs if needed
fun! SetupVAM()
let c = get(g:, 'vim_addon_manager', {})
let g:vim_addon_manager = c
let c.plugin_root_dir = expand('$HOME', 1) . '/.vim/vim-addons'
" most used options you may want to use:
" let c.log_to_buf = 1
" let c.auto_install = 0
let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
execute '!git clone --depth=1 git:// '
\ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
call vam#ActivateAddons([], {'auto_install' : 0})
call SetupVAM()
VAMActivate vim-addon-commenting
VAMActivate inkpot " 256-color colorscheme
VAMActivate fugitive " git hotness
VAMActivate unite " file/buffer/grep search
VAMActivate unite-ack " file/buffer/grep search
VAMActivate vimproc " async library (used by unite) requires vim +lua
VAMActivate Tagbar " method/attribute browser based on tags
VAMActivate ack " fast search across files
VAMActivate rails " helpers for Rails development
VAMActivate vim-airline " sexy statusbar
VAMActivate github:tpope/vim-vinegar " use - to pull up file browser
VAMActivate vim-sneak " Super-charged f/t navigation (uses s or z key)
" Set cursor to last position you were at when you opened the file
set viminfo='10,\"100,:20,%,n~/.viminfo
autocmd BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
" Use 256 colors and a nice colorscheme
set t_Co=256
colorscheme inkpot
" Backspace over everything
set backspace=2
" Search case-insensitive (unless mixed case) incrementally with highlight, CR will clear
set ignorecase
set smartcase
set incsearch
set hlsearch
nnoremap <cr> :nohl<cr><cr>
" Respect modelines
set modeline
" Use the ruler to give cursor position
set ruler
"" Always show the status line
set laststatus=2
" Default to 2 spaces for tabs
set tabstop=2
set shiftwidth=2
set expandtab
" Preserve column when jumping around
set nostartofline
" Sometimes fugitive diffs get confused and lose highlighting
nnoremap <F2> :diffoff \| syn on<cr>
nnoremap <F3> :cnext<cr>
nnoremap <F4> :cprev<cr>
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gd :Gdiff<cr>
nnoremap <leader>gb :Gblame<cr>
nnoremap <leader>tt :TagbarToggle<cr>
nnoremap <leader>d :bdelete<cr>
nnoremap <leader>n :set number!<cr>
" Highlight trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" Highlight 81st column
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" Use jk as another form of Esc
inoremap jk <Esc>
" Use ag instead of ack
let g:ackprg = 'ag --nogroup --nocolor --column'
nnoremap <C-k> :<C-u>Ack <C-r><C-w> lib app<CR>
" Unite bindings
" Use the fuzzy matcher for everything
call unite#filters#matcher_default#use(['matcher_fuzzy'])
" Use the rank sorter for everything
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#source('file_rec/async', 'ignore_pattern', 'node_modules')
" Map space to the prefix for Unite
nnoremap [unite] <Nop>
nmap <space> [unite]
" General fuzzy search
nnoremap <silent> [unite]<space> :<C-u>Unite -buffer-name=files buffer file_rec/async<CR>
" Quick file search
nnoremap <silent> [unite]f :<C-u>Unite -buffer-name=files file_rec/async file/new -start-insert<CR>
" Quick grep from cwd
nnoremap <silent> [unite]g :<C-u>Unite -buffer-name=grep -auto-preview grep:.::<C-R><C-W><CR>
" Quick MRU search
nnoremap <silent> [unite]m :<C-u>Unite -buffer-name=mru file_mru<CR>
" Quick Buffer search
nnoremap <silent> [unite]b :<C-u>Unite -buffer-name=buffer buffer<CR>
" For ack.
" Use ag for search
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
let g:unite_source_grep_recursive_opt = ''
elseif executable('ack-grep')
let g:unite_source_grep_command = 'ack-grep'
" Match whole word only. This might/might not be a good idea
let g:unite_source_grep_default_opts = '--no-heading --no-color -a -w'
let g:unite_source_grep_recursive_opt = ''
elseif executable('ack')
let g:unite_source_grep_command = 'ack'
let g:unite_source_grep_default_opts = '--no-heading --no-color -a -w'
let g:unite_source_grep_recursive_opt = ''
" Shorten the default update date of 500ms
let g:unite_update_time = 200
let g:unite_source_file_mru_limit = 1000
let g:unite_cursor_line_highlight = 'TabLineSel'