No longer using printf for prompts

This commit is contained in:
agryphus 2024-01-15 19:07:45 -05:00
parent 23f6ee058d
commit f051d5d014
2 changed files with 24 additions and 20 deletions

View file

@ -356,3 +356,6 @@ Vagrantfile 
*.pdf  *.pdf 
*.iso  *.iso 
*.org  *.org 
*.ovpn 󰳌
*.txt 

View file

@ -1,5 +1,8 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# https://github.com/gokcehan/lf/blob/master/doc.md
# ^ List of all options
## LF VARS ## LF VARS
set shellopts '-eu' # Treat undefined env vars as errors. Exit upon error. set shellopts '-eu' # Treat undefined env vars as errors. Exit upon error.
@ -29,20 +32,22 @@ map L open new_window
map o $mimeopen --ask "$f" map o $mimeopen --ask "$f"
# CRUD commands # CRUD commands
map D delete # map D delete
map D push :delete?<space>[y/N]:<space>
map N push :mkdir<space> map N push :mkdir<space>
map n push :touch<space> map n push :touch<space>
map u extract map x push :chmod<space>
map U push :extract?<space>[y/N]:<space>
map Y $printf "%s" "$fx" | xclip -selection clipboard map Y $printf "%s" "$fx" | xclip -selection clipboard
# Renaming commands # Renaming commands
map A :rename; cmd-end # at the very end map A :rename; cmd-end # at the very end
map a :rename; cmd-right # after extension map a :rename; cmd-right # after extension
map c push A<c-u> # new rename map r push A<c-u> # new rename
map i :rename # before extension map i :rename # before extension
map I :rename; cmd-home # at the very beginning map I :rename; cmd-home # at the very beginning
map r drag-and-drop map R drag-and-drop
# Fuzzy finding # Fuzzy finding
map <c-f> $lf -remote "send $id select \"$(fzf)\"" map <c-f> $lf -remote "send $id select \"$(fzf)\""
@ -51,19 +56,19 @@ map F broot_jump
map b set_bg one map b set_bg one
map B set_bg all map B set_bg all
## COMMAND DEFINITIONS ## COMMAND DEFINITIONS
cmd touch %touch $1 && lf -remote "send $id load" && lf -remote "send $id select $1" cmd touch %touch $1 && lf -remote "send $id load" && lf -remote "send $id select $1"
cmd mkdir %mkdir $1 && lf -remote "send $id load" && lf -remote "send $id select $1" cmd mkdir %mkdir $1 && lf -remote "send $id load" && lf -remote "send $id select $1"
cmd delete ${{ cmd chmod %chmod $1 "$fx" && lf -remote "send $id reload"
clear; tput cup $(($(tput lines)/3)); tput bold
set -f cmd delete? ${{
printf "%s\n\t" "$fx" [ -v 2 ] || exit 0 # Makes sure argument was passed in
printf "delete?[y/N]" [ ! "$2" = "y" ] && exit 0 # Exit if delete not confirmed
read ans rm -rf -- $fx
[ $ans = "y" ] && rm -rf -- $fx
}} }}
cmd set_bg ${{ cmd set_bg ${{
@ -85,13 +90,9 @@ cmd drag-and-drop ${{
GKD_BACKEND=11 setsid -f dragon "$fx" >/dev/null 2>&1 GKD_BACKEND=11 setsid -f dragon "$fx" >/dev/null 2>&1
}} }}
cmd extract ${{ cmd extract? ${{
clear; tput cup $(($(tput lines)/3)); tput bold [ -v 2 ] || exit 0 # Makes sure argument was passed in
set -f [ ! "$2" = "y" ] && exit 0 # Exit if delete not confirmed
printf "%s\n\t" "$fx"
printf "extract?[y/N]"
read ans
[ ! $ans = "y" ] && exit 0
case $(file --mime-type "$(readlink -f $f)" -b) in case $(file --mime-type "$(readlink -f $f)" -b) in
application/x-rar) application/x-rar)
@ -120,8 +121,8 @@ cmd open ${{
[ ! -z $@ ] && [ "$@" = "new_window" ] && new_window=1 [ ! -z $@ ] && [ "$@" = "new_window" ] && new_window=1
function launch { function launch {
swallower="gobble" # swallower="gobble"
[ -z "$WAYLAND_DISPLAY" ] && swallower="devour" # [ ! -n "${WAYLAND_DISPLAY}" ] && swallower="devour"
swallower="devour" swallower="devour"
if [ ! -v new_window ]; then if [ ! -v new_window ]; then