Selecta in Vim

This commit is contained in:
Eryn Wells 2014-01-21 08:24:15 -08:00
parent a4e999b5f2
commit c8bd4750b8

15
vimrc
View file

@ -200,6 +200,19 @@ function! <SID>strip_trailing_whitespace()
endfunction
function! SelectaCommand(choice_command, selecta_args, vim_command)
try
silent let selection = system(a:choice_command . " | selecta " . a:selecta_args)
catch /Vim:Interrupt/
" Swallow ^C so the redraw below happens; otherwise there will be leftovers of selecta on screen.
redraw!
return
endtry
redraw!
exec a:vim_command . " " . selection
endfunction
" Key Mappings {{{
let mapleader=','
@ -226,6 +239,8 @@ nnoremap <silent> <leader><space> :setlocal invhlsearch<CR>
" find all
nnoremap <leader>fa :%s/\v
nnoremap <leader>f :call SelectaCommand("find * -type f", "", ":e")<cr>
" Toggle position highlighting
augroup cursor_position
autocmd!