Skip to content

Instantly share code, notes, and snippets.

@nongio-zz
Last active August 29, 2015 14:09
Show Gist options
  • Save nongio-zz/87af49b85ce898d3428e to your computer and use it in GitHub Desktop.
Save nongio-zz/87af49b85ce898d3428e to your computer and use it in GitHub Desktop.
unite vim config
" Unite
"unite ctrl-p functionality
call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <space>b :Unite -quick-match buffer<cr>
nnoremap <space>p :<C-u>Unite file_rec/async<cr>
"unite grep
nnoremap <space>f :<C-u>Unite grep:.<cr>
nnoremap <space>F :<C-u>Unite grep<CR>
"unite history yank
let g:unite_source_history_yank_enable = 1
nnoremap <space>y :Unite history/yank<cr>
" unite grep using the_platinum_searcher
if executable('pt')
let g:unite_source_rec_async_command = 'pt --nocolor --nogroup -g .'
let g:unite_source_grep_command = 'pt'
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_grep_encoding = 'utf-8'
endif
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
" Play nice with supertab
let b:SuperTabDisabled=1
" Enable navigation with control-j and control-k in insert mode
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
" Not showing the trailing space as red if has vim-trailing-color installed
autocmd InsertLeave <buffer> match ExtraWhitespace //
autocmd InsertEnter <buffer> match ExtraWhitespace //
autocmd BufWinEnter <buffer> match ExtraWhitespace //
" Other Customizations
nnoremap <silent><buffer><expr> <C-x> unite#do_action('split')
nnoremap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
nnoremap <silent><buffer><expr> <C-t> unite#do_action('tabopen')
nmap <buffer> <ESC> <Plug>(unite_exit)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment