vifm: Make external commands conditional on executables
Only create shortcuts for external commands if those have associated executables on the system. If we don't have an `atool` installed, it does not make sense to have shortcuts for invoking it - likewise for vidir, find, and so on.
This commit is contained in:
parent
086ad20add
commit
6bc3f0e8c1
1 changed files with 28 additions and 13 deletions
|
@ -305,16 +305,21 @@ nnoremap <space>C :fzfcdhome<cr>
|
||||||
nnoremap <space>w :grep<space>
|
nnoremap <space>w :grep<space>
|
||||||
|
|
||||||
" external commands
|
" external commands
|
||||||
" extract currently selected file(s)
|
if executable('atool')
|
||||||
noremap ,xx :!atool -x %f<cr>
|
" extract currently selected file(s)
|
||||||
" compress currently selected file(s)
|
noremap ,xx :!atool -x %f<cr>
|
||||||
noremap ,xc :!atool -a %c:r.tar.gz %f<cr>
|
" compress currently selected file(s)
|
||||||
" archive currently selected file(s)
|
noremap ,xc :!atool -a %c:r.tar.gz %f<cr>
|
||||||
noremap ,xa :!atool -a %c:r.tar %f<cr>
|
" archive currently selected file(s)
|
||||||
" zip currently selected file(s)
|
noremap ,xa :!atool -a %c:r.tar %f<cr>
|
||||||
noremap ,xz :!atool -a %c:r.zip %f<cr>
|
" zip currently selected file(s)
|
||||||
" combine selected PDFs into single one (named output.pdf)
|
noremap ,xz :!atool -a %c:r.zip %f<cr>
|
||||||
noremap ,pc :!pdftk %f cat output output.pdf
|
endif
|
||||||
|
|
||||||
|
if executable('pdftk')
|
||||||
|
" combine selected PDFs into single one (named output.pdf)
|
||||||
|
noremap ,pc :!pdftk %f cat output output.pdf
|
||||||
|
endif
|
||||||
|
|
||||||
" preview thumbnails of current folder
|
" preview thumbnails of current folder
|
||||||
" select thumbnails with m/M in nsxiv
|
" select thumbnails with m/M in nsxiv
|
||||||
|
@ -323,9 +328,19 @@ nnoremap ,t :!vifm-thumbnailer -t %u %c<cr>
|
||||||
nnoremap ,T :!vifm-thumbnailer -r -t %u %c<cr>
|
nnoremap ,T :!vifm-thumbnailer -r -t %u %c<cr>
|
||||||
|
|
||||||
" batch rename or delete files in current dir
|
" batch rename or delete files in current dir
|
||||||
nnoremap ,rr :!edir<cr>
|
if executable('edir')
|
||||||
nnoremap ,rf :!edir --files<cr>
|
nnoremap ,rr :!edir<cr>
|
||||||
nnoremap ,rd :!edir --dirs<cr>
|
nnoremap ,rf :!edir --files<cr>
|
||||||
|
nnoremap ,rd :!edir --dirs<cr>
|
||||||
|
nnoremap ,rR :!edir --all --depth=10<cr>
|
||||||
|
elseif executable('vidir')
|
||||||
|
nnoremap ,rr :!vidir<cr>
|
||||||
|
if executable('find')
|
||||||
|
nnoremap ,rf :!find . -maxdepth 1 -type f | vidir -<cr>
|
||||||
|
nnoremap ,rd :!find . -maxdepth 1 -type d | vidir -<cr>
|
||||||
|
nnoremap ,rR :!find . | vidir -<cr>
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if executable('zoxide')
|
if executable('zoxide')
|
||||||
" integrate zoxide search and add any vifm-visited paths automatically
|
" integrate zoxide search and add any vifm-visited paths automatically
|
||||||
|
|
Loading…
Reference in a new issue