Remove pick vim junk

This commit is contained in:
Max Bucknell 2017-02-01 19:39:21 +00:00
parent 0ac0c1994d
commit 1a5ca3ad09
2 changed files with 0 additions and 124 deletions

View file

@ -1,60 +0,0 @@
if !exists("g:pick_executable")
let g:pick_executable = "pick"
endif
function! PickCommand(choice_command, pick_args, vim_command)
try
let selection = system(a:choice_command . " | " . g:pick_executable . " " . a:pick_args)
redraw!
if v:shell_error == 0
try
exec a:vim_command . " " . selection
catch /E325/
endtry
endif
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from pick on the screen
redraw!
endtry
endfunction
function! PickFile()
call PickCommand(s:FileListCommand(), "", ":edit")
endfunction
function! PickFileVerticalSplit()
call PickCommand(s:FileListCommand(), "", ":vsplit")
endfunction
function! PickFileSplit()
call PickCommand(s:FileListCommand(), "", ":split")
endfunction
function! PickFileTab()
call PickCommand(s:FileListCommand(), "", ":tabedit")
endfunction
function! PickBuffer()
call PickCommand(s:BufferListCommand(), "", ":buffer")
endfunction
function! PickTag()
call PickCommand(s:TagCommand(), "", ":tag")
endfunction
function! s:FileListCommand()
return "find * -type f -o -type l"
endfunction
function! s:BufferListCommand()
let bufnrs = filter(range(1, bufnr("$")), 'buflisted(v:val)')
let buffers = map(bufnrs, 'bufname(v:val)')
return 'echo "' . join(buffers, "\n") . '"'
endfunction
function! s:TagCommand()
let l:tag_files = join(split(&tags, ","), " ")
return "cat " . l:tag_files . " 2> /dev/null | awk -F$'\t' '{print $1}' | sort -u | grep -v '^!'"
endfunction

View file

@ -69,70 +69,6 @@ set virtualedit=block
" I am always adding /g. No longer, suckers!
set gdefault
" Find files
"
" My fuzzy file finder has changed, but the commands I use to interact
" with it have not. These have the advantage of being close together on
" my keyboard, as well as vaguely mnemonic.
let g:pick_executable = "pick"
let g:pick_index_file = ".pick_index"
function! PickCommand(choice_command, pick_args, vim_command)
try
let selection = system(a:choice_command . " | " . g:pick_executable . " " . a:pick_args)
redraw!
if v:shell_error == 0
try
exec a:vim_command . " " . selection
catch /E325/
endtry
endif
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from pick on the screen
redraw!
endtry
endfunction
function! s:FileListCommand()
if filereadable(g:pick_index_file) == 0
echo "Rebuilding"
call system("find * -type f -o -type l > " . g:pick_index_file)
endif
let l:choice_command = "cat " . g:pick_index_file
return l:choice_command
endfunction
function! s:BufferListCommand()
let bufnrs = filter(range(1, bufnr("$")), 'buflisted(v:val)')
let buffers = map(bufnrs, 'bufname(v:val)')
return 'echo "' . join(buffers, "\n") . '"'
endfunction
function! PickBuffer()
call PickCommand(s:BufferListCommand(), "", ":buffer")
endfunction
function! PickFile()
call PickCommand(s:FileListCommand(), "", ":edit")
endfunction
function! PickFileVerticalSplit()
call PickCommand(s:FileListCommand(), "", ":vsplit")
endfunction
function! RefreshPickIndex()
call system("rm " . g:pick_index_file)
endfunction
nnoremap <leader>t :call PickFile()<cr>
nnoremap <leader>b :call PickBuffer()<cr>
nnoremap <leader>n :call PickFileVerticalSplit()<cr>
nnoremap <c-f> :call RefreshPickIndex()<cr>
" Navigate to test, and back
" Find test counterpart.