From c8bd4750b839be76a4496705367e67ccccdefd5a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 21 Jan 2014 08:24:15 -0800 Subject: [PATCH] Selecta in Vim --- vimrc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vimrc b/vimrc index 7d86185..7bf26a7 100644 --- a/vimrc +++ b/vimrc @@ -200,6 +200,19 @@ function! 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 :setlocal invhlsearch " find all nnoremap fa :%s/\v +nnoremap f :call SelectaCommand("find * -type f", "", ":e") + " Toggle position highlighting augroup cursor_position autocmd!