774e7b2439
subrepo: subdir: "dotfiles/.vim/plugged/zoxide.vim" merged: "7add42b04" upstream: origin: "https://github.com/nanotee/zoxide.vim.git" branch: "master" commit: "7add42b04" git-subrepo: version: "0.4.3" origin: "???" commit: "???"
41 lines
1.3 KiB
VimL
41 lines
1.3 KiB
VimL
if exists('g:loaded_zoxide')
|
|
finish
|
|
endif
|
|
let g:loaded_zoxide = 1
|
|
|
|
let s:save_cpo = &cpo
|
|
set cpo&vim
|
|
|
|
let s:z_cmd = substitute(get(g:, 'zoxide_prefix', 'z'), '\A', '', 'g')
|
|
let s:z_cmd_cap = toupper(s:z_cmd[0]) .. strcharpart(s:z_cmd, 1)
|
|
|
|
" Z
|
|
" Lz
|
|
" Tz
|
|
execute 'command! -nargs=* -complete=dir ' .. s:z_cmd_cap .. ' call zoxide#z("cd", <f-args>)'
|
|
execute 'command! -nargs=* -complete=dir L' .. s:z_cmd .. ' call zoxide#z("lcd", <f-args>)'
|
|
execute 'command! -nargs=* -complete=dir T' .. s:z_cmd .. ' call zoxide#z("tcd", <f-args>)'
|
|
|
|
" Zi
|
|
" Lzi
|
|
" Tzi
|
|
execute 'command! -nargs=* -bang ' .. s:z_cmd_cap .. 'i call zoxide#zi("cd", <bang>0, <f-args>)'
|
|
execute 'command! -nargs=* -bang L' .. s:z_cmd .. 'i call zoxide#zi("lcd", <bang>0, <f-args>)'
|
|
execute 'command! -nargs=* -bang T' .. s:z_cmd .. 'i call zoxide#zi("tcd", <bang>0, <f-args>)'
|
|
|
|
if get(g:, 'zoxide_hook', 'none') ==# 'pwd'
|
|
if has('nvim')
|
|
augroup zoxide_cd
|
|
autocmd!
|
|
autocmd DirChanged window,tab,tabpage,global if !v:event['changed_window'] | call zoxide#exec(['add'], [v:event['cwd']]) | endif
|
|
augroup END
|
|
else
|
|
augroup zoxide_cd
|
|
autocmd!
|
|
autocmd DirChanged window,tabpage,global call zoxide#exec(['add'], [expand('<afile>')])
|
|
augroup END
|
|
endif
|
|
endif
|
|
|
|
let &cpo = s:save_cpo
|
|
unlet s:save_cpo
|