|
|
@ -9,9 +9,24 @@ set ignorecase true |
|
|
|
|
|
|
|
# Custom Functions |
|
|
|
cmd open ${{ |
|
|
|
case $(file --mime-type "$f" -bL) in |
|
|
|
text/*|application/json) $EDITOR "$f";; |
|
|
|
*) xdg-open "$f" ;; |
|
|
|
echo "$fx" > /tmp/b |
|
|
|
case $fx in |
|
|
|
*.py|*.java|*.json|*.h|*.c|*.cpp|*.js) $EDITOR "$f";; |
|
|
|
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.zip|*.rar|*.iso) |
|
|
|
mntdir="$f-archivemount" |
|
|
|
echo $mntdir > /tmp/a |
|
|
|
[ ! -d "$mntdir" ] && { |
|
|
|
mkdir "$mntdir" |
|
|
|
archivemount "$f" "$mntdir" |
|
|
|
echo "$mntdir" >> "/tmp/__lf_archivemount_$id" |
|
|
|
} |
|
|
|
lf -remote "send $id cd \"$mntdir\"" |
|
|
|
lf -remote "send $id reload" |
|
|
|
;; |
|
|
|
*) |
|
|
|
for f in $fx; do |
|
|
|
$OPENER $f > /dev/null 2> /dev/null & |
|
|
|
done;; |
|
|
|
esac |
|
|
|
}} |
|
|
|
|
|
|
@ -40,13 +55,21 @@ cmd chmod ${{ |
|
|
|
lf -remote 'send reload' |
|
|
|
}} |
|
|
|
|
|
|
|
cmd sudomkfile ${{ |
|
|
|
printf "File Name: " |
|
|
|
read ans |
|
|
|
sudo $EDITOR $ans |
|
|
|
cmd trash %trash-put $fx |
|
|
|
|
|
|
|
cmd setwallpaper ${{ |
|
|
|
echo "$fx" > /tmp/c |
|
|
|
echo convert "$fx" "$HOME/.local/backgrounds/wall.jpg" > /tmp/d |
|
|
|
convert "$fx" "$HOME/.local/backgrounds/wall.jpg" |
|
|
|
feh --bg-fill "$HOME/.local/backgrounds/wall.jpg" |
|
|
|
}} |
|
|
|
|
|
|
|
cmd setwallpaper %cp "$f" ~/.dotfiles/backgrounds/wall.png && xwallpaper --zoom "$f" |
|
|
|
cmd git_branch ${{ |
|
|
|
git branch | fzf | xargs git checkout |
|
|
|
pwd_shell=$(pwd) |
|
|
|
lf -remote "send $id updir" |
|
|
|
lf -remote "send $id cd \"$pwd_shell\"" |
|
|
|
}} |
|
|
|
|
|
|
|
cmd fzf_jump ${{ |
|
|
|
res="$(find . -maxdepth 3 | fzf --reverse --header='Jump to location')" |
|
|
@ -58,28 +81,29 @@ cmd fzf_jump ${{ |
|
|
|
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\"" |
|
|
|
cmd cd_jump ${{ |
|
|
|
printf "Keyword: " |
|
|
|
read ans |
|
|
|
lf -remote "send $id cd $ans" |
|
|
|
}} |
|
|
|
|
|
|
|
cmd open_config ${{ |
|
|
|
$EDITOR $(bookmenu -b ~/.config/bookmenu/configs -f fzf -o) |
|
|
|
cmd on-cd &{{ |
|
|
|
# display git repository status in your prompt |
|
|
|
source /usr/share/git/completion/git-prompt.sh |
|
|
|
GIT_PS1_SHOWDIRTYSTATE=auto |
|
|
|
GIT_PS1_SHOWSTASHSTATE=auto |
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=auto |
|
|
|
GIT_PS1_SHOWUPSTREAM=auto |
|
|
|
GIT_PS1_COMPRESSSPARSESTATE=auto |
|
|
|
git=$(__git_ps1 " [GIT BRANCH:> %s]") || true |
|
|
|
fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m" |
|
|
|
lf -remote "send $id set promptfmt \"$fmt\"" |
|
|
|
}} |
|
|
|
|
|
|
|
cmd dragon %dragon-drag-and-drop -a -x $fx |
|
|
|
cmd dragon-stay %dragon-drag-and-drop -a $fx |
|
|
|
cmd dragon-individual %dragon-drag-and-drop $fx |
|
|
|
cmd cpdragon %cpdragon |
|
|
|
cmd mvdragon %mvdragon |
|
|
|
cmd dlfile %dlfile |
|
|
|
cmd open ${{ |
|
|
|
case "$f" in |
|
|
|
esac |
|
|
|
}} |
|
|
|
|
|
|
|
# Archive bindings |
|
|
|
cmd unarchive ${{ |
|
|
@ -101,14 +125,9 @@ cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f" |
|
|
|
cmd trash ${{ |
|
|
|
files=$(printf "$fx" | tr '\n' ';') |
|
|
|
while [ "$files" ]; do |
|
|
|
# extract the substring from start of string up to delimiter. |
|
|
|
# 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 |
|
|
@ -118,6 +137,7 @@ cmd trash ${{ |
|
|
|
}} |
|
|
|
|
|
|
|
cmd clear_trash %trash-empty |
|
|
|
cmd trash %trash-put $fx |
|
|
|
|
|
|
|
cmd restore_trash ${{ |
|
|
|
trash-restore |
|
|
@ -125,8 +145,7 @@ cmd restore_trash ${{ |
|
|
|
|
|
|
|
cmd stripspace %stripspace "$f" |
|
|
|
|
|
|
|
# Bindings |
|
|
|
# Remove some defaults |
|
|
|
# Old keybinds cleanup |
|
|
|
map m |
|
|
|
map o |
|
|
|
map n |
|
|
@ -138,8 +157,8 @@ map e |
|
|
|
map f |
|
|
|
|
|
|
|
# File Openers |
|
|
|
map ee $$EDITOR "$f" |
|
|
|
map u $view "$f" |
|
|
|
map e $$EDITOR "$f" |
|
|
|
map u xdg-open "$f" |
|
|
|
|
|
|
|
# Archive Mappings |
|
|
|
map az zip |
|
|
@ -149,34 +168,21 @@ map ab targz |
|
|
|
map au unarchive |
|
|
|
|
|
|
|
# Trash Mappings |
|
|
|
map dd trash |
|
|
|
map tt trash |
|
|
|
map tc clear_trash |
|
|
|
map tr restore_trash |
|
|
|
|
|
|
|
# Broot Mapping |
|
|
|
map f broot_jump |
|
|
|
|
|
|
|
# Dragon Mapping |
|
|
|
map dr dragon |
|
|
|
map ds dragon-stay |
|
|
|
map di dragon-individual |
|
|
|
map dm mvdragon |
|
|
|
map dc cpdragon |
|
|
|
map dl dlfile |
|
|
|
|
|
|
|
map ss stripspace |
|
|
|
|
|
|
|
# Basic Functions |
|
|
|
map . set hidden! |
|
|
|
map DD delete |
|
|
|
map D delete |
|
|
|
map p paste |
|
|
|
map x cut |
|
|
|
map dd cut |
|
|
|
map y copy |
|
|
|
map <enter> open |
|
|
|
map mf mkfile |
|
|
|
map mr sudomkfile |
|
|
|
map md mkdir |
|
|
|
map ms $mkscript |
|
|
|
map ch chmod |
|
|
|
map bg setwallpaper |
|
|
|
map o open_config |
|
|
@ -188,69 +194,20 @@ map R reload |
|
|
|
map C clear |
|
|
|
map U unselect |
|
|
|
|
|
|
|
# Movement |
|
|
|
map gtr cd ~/.local/share/Trash/files |
|
|
|
map gus cd /run/media/brodie |
|
|
|
|
|
|
|
map gv. cd ~/videos |
|
|
|
map gva cd ~/videos/anime |
|
|
|
|
|
|
|
map gy. cd ~/videos/youtube |
|
|
|
map gyt cd ~/videos/youtube/ToUpload |
|
|
|
map gyu cd ~/videos/youtube/Uploaded |
|
|
|
map gya cd ~/videos/youtube/asset |
|
|
|
map go. cd ~/videos/podcast |
|
|
|
map got cd ~/videos/podcast/ToUpload |
|
|
|
map gou cd ~/videos/podcast/Uploaded |
|
|
|
|
|
|
|
map gp. cd ~/pictures |
|
|
|
map gpm cd ~/pictures/mpvscreenshots |
|
|
|
map gpa cd ~/pictures/Anime |
|
|
|
map gps cd ~/pictures/screenshots |
|
|
|
map cd cd_jump |
|
|
|
map cf fzf_jump |
|
|
|
|
|
|
|
map gw. cd ~/pictures/Wallpapers |
|
|
|
map gww cd ~/pictures/Wallpapers/Wallpapers |
|
|
|
map gwm cd ~/pictures/Wallpapers/MobileWallpapers |
|
|
|
|
|
|
|
map gt. cd ~/documents/Textbooks |
|
|
|
map gt1 cd ~/documents/Textbooks/1stYear |
|
|
|
map gt2 cd ~/documents/Textbooks/2ndYear |
|
|
|
map gt3 cd ~/documents/Textbooks/3rdYear |
|
|
|
map gu3 cd ~/documents/Uni/3rdYear |
|
|
|
map gd cd ~/documents |
|
|
|
|
|
|
|
map gD cd ~/downloads |
|
|
|
map ge cd ~/desktop |
|
|
|
|
|
|
|
map gs. cd ~/scripts |
|
|
|
map gsl cd ~/scripts/lf |
|
|
|
map gsa cd ~/scripts/alsa |
|
|
|
map gsi cd ~/scripts/i3 |
|
|
|
map gse cd ~/scripts/lemonbar |
|
|
|
map gsp cd ~/scripts/polybar |
|
|
|
map gsb cd ~/scripts/bspwm |
|
|
|
map gsu cd ~/scripts/pulse |
|
|
|
map gdt cd ~/scripts/transmission |
|
|
|
|
|
|
|
map gr. cd ~/repos |
|
|
|
map grb cd ~/repos/bookmenu |
|
|
|
map grf cd ~/repos/cleanfullscreen |
|
|
|
map grm cd ~/repos/dmenu |
|
|
|
map grd cd ~/repos/dotfiles |
|
|
|
map gri cd ~/repos/init |
|
|
|
map grk cd ~/repos/kanban-board |
|
|
|
map grl cd ~/repos/lbryurlconvert |
|
|
|
map grP cd ~/repos/PerlProjects |
|
|
|
map grr cd ~/repos/reading-list |
|
|
|
map grs cd ~/repos/st |
|
|
|
map grw cd ~/repos/website |
|
|
|
# Git Mappings |
|
|
|
map gib :git_branch |
|
|
|
map gip ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}} |
|
|
|
map gis ${{clear; git status; echo "press ENTER"; read ENTER}} |
|
|
|
map gil ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}} |
|
|
|
|
|
|
|
# Movement |
|
|
|
map ~ cd ~ |
|
|
|
map g/ cd / |
|
|
|
map gm cd /media |
|
|
|
map gd cd ~/.dotfiles |
|
|
|
map gc cd ~/.config |
|
|
|
map gC cd ~/.local/share/cell |
|
|
|
map gl cd ~/.local |
|
|
|
map gE cd /etc |
|
|
|
map gU. cd /usr |
|
|
|
map gUs cd /usr/share |
|
|
|
|
|
|
|
map \;j cd ~ |
|
|
|
map gs cd ~/.local/share/bin |
|
|
|
|