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
Raw Normal View History

2020-03-13 19:45:21 +00:00
# Basic settings
set shell sh
set preview false
2019-09-30 16:09:51 +00:00
set icons on
2020-03-13 19:45:21 +00:00
set hidden true
set drawbox true
set ignorecase true
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
# Custom functions
2019-09-30 16:09:51 +00:00
cmd open ${{
2020-03-13 19:45:21 +00:00
case $(file --mime-type "$f" -bL) in
text/*|application/json) nvim "$f";;
video/*|image/*/application/pdf) xdg-open "$f" & disown;;
*) xdg-open "$f" ;;
2019-09-30 16:09:51 +00:00
esac
}}
2020-03-13 19:45:21 +00:00
cmd mkdir ${{
printf "Directory Name: "
read ans
mkdir $ans
}}
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
cmd mkfile ${{
printf "File Name: "
read ans
$EDITOR $ans
}}
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
cmd chmod ${{
printf "Mode Bits: "
read ans
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
for file in "$fx"
do
chmod $ans $file
done
}}
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
cmd sudomkfile ${{
printf "File Name: "
read ans
sudo $EDITOR $ans
}}
2019-09-30 16:09:51 +00:00
2020-03-13 19:45:21 +00:00
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\""
2019-09-30 16:09:51 +00:00
}}
2020-03-13 19:45:21 +00:00
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\""
2019-09-30 16:09:51 +00:00
}}
2020-03-13 19:45:21 +00:00
# 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
2019-09-30 16:09:51 +00:00
}}
2020-03-13 19:45:21 +00:00
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