Selecta in Vim
This commit is contained in:
parent
a4e999b5f2
commit
c8bd4750b8
1 changed files with 15 additions and 0 deletions
15
vimrc
15
vimrc
|
@ -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!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue