mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-14 20:27:18 +00:00
145 lines
2.6 KiB
Plaintext
145 lines
2.6 KiB
Plaintext
# Basic settings
|
|
set previewer ~/.config/lf/previewer.sh
|
|
set cleaner ~/.config/lf/clear_img.sh
|
|
set preview true
|
|
set hidden true
|
|
set drawbox true
|
|
set icons true
|
|
set ignorecase true
|
|
set scrolloff 5
|
|
|
|
# Use $EDITOR for text
|
|
cmd open ${{
|
|
case $(file --mime-type "$f" -bL) in
|
|
text/*|application/json) $EDITOR "$f";;
|
|
*) devour xdg-open "$f" ;;
|
|
esac
|
|
}}
|
|
|
|
# File/Directory control functions
|
|
cmd mkdir %{{
|
|
printf "Directory Name: "
|
|
read ans
|
|
mkdir $ans
|
|
}}
|
|
|
|
cmd mkfile %{{
|
|
printf "File Name: "
|
|
read ans
|
|
touch $ans
|
|
}}
|
|
|
|
cmd chmod %{{
|
|
printf "Mode Bits: "
|
|
read ans
|
|
|
|
for file in "$fx"; do
|
|
chmod $ans $file
|
|
done
|
|
|
|
lf -remote 'send reload'
|
|
}}
|
|
|
|
# Add z.lua functionality for easy autojumps
|
|
cmd zlua %{{
|
|
printf "z.lua input: "
|
|
read ans
|
|
|
|
/usr/local/src/z.lua/z.lua $ans
|
|
}}
|
|
|
|
|
|
# Archive bindings
|
|
cmd unarchive ${{
|
|
case "$f" in
|
|
*.zip) unzip "$f" ;;
|
|
*.tar.gz) tar -xzvf "$f" ;;
|
|
*.tar.bz2) tar -xjvf "$f" ;;
|
|
*.tar) tar -xvf "$f" ;;
|
|
*) echo "Unsuported 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"
|
|
|
|
# Trash-cli bindings
|
|
cmd trash ${{
|
|
files=$(printf "$fx" | tr '\n' ':')
|
|
while [ "$files" ]; do
|
|
# extract the substring from start of string up to delimeter.
|
|
# this is the first "element" of the string
|
|
file=${files%%:*}
|
|
|
|
trash-put "$(basename "$file")"
|
|
# if there's only one element left, set `files` to an empty string.
|
|
# this causes us to exit this `while` loop.
|
|
# else, we delete the first "element" of the string from files, and
|
|
# move onto the next.
|
|
if [ "$files" = "$file" ]; then
|
|
files=''
|
|
else
|
|
files="${files#*;}"
|
|
fi
|
|
done
|
|
}}
|
|
|
|
cmd clear_trash %trash-empty
|
|
|
|
cmd restore_trash ${{
|
|
trash-restore
|
|
}}
|
|
|
|
# Bindings
|
|
# Remove some defaults
|
|
map m
|
|
map n
|
|
map "'"
|
|
map '"'
|
|
map d
|
|
map c
|
|
|
|
# Archive mappings
|
|
map az zip
|
|
map at tar
|
|
map ag targz
|
|
map au unarchive
|
|
|
|
# Trash mappings
|
|
map dd trash
|
|
map tc clear_trash
|
|
map tr restore_trash
|
|
|
|
# Basic functions
|
|
map . set hidden!
|
|
map DD delete
|
|
map p paste
|
|
map x cut
|
|
map y copy
|
|
map <enter> open
|
|
map md mkdir
|
|
map mf mkfile
|
|
map ch chmod
|
|
map r rename
|
|
map H top
|
|
map L bottom
|
|
map R reload
|
|
map C clear
|
|
map z zlua
|
|
|
|
# Movement
|
|
map gh cd ~
|
|
map gc cd ~/.config
|
|
map gl cd ~/.local
|
|
map gs cd ~/.local/bin/scripts
|
|
map gtr cd ~/.local/share/Trash/files
|
|
map gE. cd /etc
|
|
map gEp cd /etc/portage
|
|
map gU. cd /usr
|
|
map gUs cd /usr/share
|
|
map gUl cd /usr/local
|
|
map gM cd /mnt
|
|
|