lf updates including better rename commands

This commit is contained in:
Luke Smith 2020-04-10 08:00:42 -04:00
parent a2277bc99b
commit 0dad5d69ef
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -1,21 +1,23 @@
# Luke's lf settings # Luke's lf settings
# Basic vars # Basic vars
set shell sh set shell bash
set previewer ~/.config/lf/scope set previewer ~/.config/lf/scope
set shellopts '-eu' set shellopts '-eu'
set ifs "\n" set ifs "\n"
set scrolloff 10 set scrolloff 10
set color256 set color256
set icons # Enable icons. Requires nerd fonts and LF_ICONS variable. set icons
set period 1
# cmds/functions # cmds/functions
cmd open ${{ cmd open ${{
case $(file --mime-type $f -b) in case $(file --mime-type $f -b) in
image/vnd.djvu|application/pdf|application/octet-stream) setsid zathura $fx >/dev/null 2>&1 & ;;
text/troff) man ./ $f;; text/troff) man ./ $f;;
text/*) $EDITOR $fx;; text/*) $EDITOR $fx;;
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;; image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;;
image/*) rotdir $f | setsid sxiv -aio 2>/dev/null | lf-select & ;; image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid sxiv -aio 2>/dev/null | lf-select & ;;
audio/*) mpv $f ;; audio/*) mpv $f ;;
video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;; video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;;
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;; application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;;
@ -23,9 +25,10 @@ cmd open ${{
esac esac
}} }}
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
cmd delete ${{ cmd delete ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f set -f
printf "%s\n\t" "$fx" printf "%s\n\t" "$fx"
printf "delete?[y/N]" printf "delete?[y/N]"
@ -34,6 +37,7 @@ cmd delete ${{
}} }}
cmd moveto ${{ cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f set -f
clear; echo "Move to where?" clear; echo "Move to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
@ -42,6 +46,7 @@ cmd moveto ${{
}} }}
cmd copyto ${{ cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f set -f
clear; echo "Copy to where?" clear; echo "Copy to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
@ -61,13 +66,21 @@ map g top
map D delete map D delete
map C copyto map C copyto
map M moveto map M moveto
map a push %mkdir<space> map <c-n> push :mkdir<space>
map r push :rename<space>
map R $lf -remote "send $id push :rename<space>$f"
map b bulkrename
map <c-r> reload map <c-r> reload
map <enter> shell map <enter> shell
map x $$f map x $$f
map X !$f map X !$f
map o &mimeopen "$f" map o &mimeopen $f
map O $mimeopen --ask "$f" map O $mimeopen --ask $f
map A rename # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
map i push A<a-b><a-b><a-f> # before extention
map a push A<a-b> # after extention
map b bulkrename
map <c-e> down
map <c-y> up
map V push :!nvim<space>