1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00
dotfiles/lfcd/.config/lf/lfrc

143 lines
2.4 KiB
Plaintext

# Basic settings
set shell sh
set preview false
set icons on
set hidden true
set drawbox true
set ignorecase true
# Custom functions
cmd open ${{
case $(file --mime-type "$f" -bL) in
text/*|application/json) nvim "$f";;
video/*|image/*/application/pdf) xdg-open "$f" & disown;;
*) xdg-open "$f" ;;
esac
}}
cmd mkdir ${{
printf "Directory Name: "
read ans
mkdir $ans
}}
cmd mkfile ${{
printf "File Name: "
read ans
$EDITOR $ans
}}
cmd chmod ${{
printf "Mode Bits: "
read ans
for file in "$fx"
do
chmod $ans $file
done
}}
cmd sudomkfile ${{
printf "File Name: "
read ans
sudo $EDITOR $ans
}}
cmd fzf_jump ${{
res="$(find . -maxdepth 3 | fzf --reverse --header='Jump to location')"
if [ -f "$res" ]; then
cmd="select"
elif [ -d "$res" ]; then
cmd="cd"
fi
lf -remote "send $id $cmd \"$res\""
}}
cmd broot_jump ${{
f=$(mktemp)
res="$(broot --outcmd $f && cat $f | sed 's/cd //')"
rm -f "$f"
if [ -f "$res" ]; then
cmd="select"
elif [ -d "$res" ]; then
cmd="cd"
fi
lf -remote "send $id $cmd \"$res\""
}}
# Archive bindings
cmd extract ${{
case "$f" in
*.zip) unzip "$f" ;;
*.tar.gz) tar -xzvf "$f" ;;
*.tar.bz2) tar -xjvf "$f" ;;
*.tar) tar -xvf "$f" ;;
*) echo "Unsupported format" ;;
esac
}}
cmd zip %zip -r "$f" "$f"
cmd tar %tar cvf "$f.tar" "$f"
cmd targz %tar cvzf "$f.tar.gz" "$f"
cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f"
# Bindings
# Remove some defaults
map m
map o
map n
map "'"
map '"'
map d
map c
map e
map f
# File Openers
map ee $$EDITOR "$f"
# Archive Mappings
map az zip
map at tar
map ag targz
map ab targz
map ae extract
# Broot Mapping
map f broot_jump
# Basic Functions
map . set hidden!
map DD delete
map p paste
map x cut
map y copy
map <enter> open
map mf mkfile
map mr sudomkfile
map md mkdir
map ch chmod
map o open_config
map r rename
map H top
map L bottom
map R reload
map C clear
map U unselect
# Movement
map gd. cd ~/Documents
map gD cd ~/Downloads
map gdbb cd ~/Documents/Business/Boekhouding
map gdbi cd ~/Documents/Business/Interne\ zaken
map gdf cd ~/Documents/Finances
map gddd cd ~/Documents/Data\ Dumps
map gdl cd ~/Documents/ledger
map gdo cd ~/Documents/org
map gs cd ~/Sync
map gm. cd ~/music
map gw. cd ~/Pictures/wallpaper/
map gww cd ~/Pictures/wallpaper/Wallpaper
map gws cd ~/Pictures/wallpaper/Wallpaper\ Small
map gw9 cd ~/Pictures/wallpaper/Wallpaper\ 90