diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index bfb03aa..35d133f 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -305,16 +305,21 @@ nnoremap <space>C :fzfcdhome<cr> nnoremap <space>w :grep<space> " external commands -" extract currently selected file(s) -noremap ,xx :!atool -x %f<cr> -" compress currently selected file(s) -noremap ,xc :!atool -a %c:r.tar.gz %f<cr> -" archive currently selected file(s) -noremap ,xa :!atool -a %c:r.tar %f<cr> -" zip currently selected file(s) -noremap ,xz :!atool -a %c:r.zip %f<cr> -" combine selected PDFs into single one (named output.pdf) -noremap ,pc :!pdftk %f cat output output.pdf +if executable('atool') + " extract currently selected file(s) + noremap ,xx :!atool -x %f<cr> + " compress currently selected file(s) + noremap ,xc :!atool -a %c:r.tar.gz %f<cr> + " archive currently selected file(s) + noremap ,xa :!atool -a %c:r.tar %f<cr> + " zip currently selected file(s) + noremap ,xz :!atool -a %c:r.zip %f<cr> +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 " 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> " batch rename or delete files in current dir -nnoremap ,rr :!edir<cr> -nnoremap ,rf :!edir --files<cr> -nnoremap ,rd :!edir --dirs<cr> +if executable('edir') + nnoremap ,rr :!edir<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') " integrate zoxide search and add any vifm-visited paths automatically