aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.config/lf
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-01-21 23:29:58 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-01-21 23:29:58 +0300
commite4672d66a9302f557ce26b0a418746deffe0decc (patch)
treefe1e226c629061411c9fe8de7d16e861deaff223 /dotfiles/.config/lf
parent64d645f2bd1d18aeefdde07621a1a4d1e07cb1cd (diff)
downloadswayrice-e4672d66a9302f557ce26b0a418746deffe0decc.tar.gz
swayrice-e4672d66a9302f557ce26b0a418746deffe0decc.zip
Friendship ended with ranger, again. lf it is now
Too many changes made, basically all of them related to lf. Sorry ranger. You're too slow 🦔.
Diffstat (limited to 'dotfiles/.config/lf')
-rw-r--r--dotfiles/.config/lf/icons84
-rw-r--r--dotfiles/.config/lf/lfrc92
2 files changed, 176 insertions, 0 deletions
diff --git a/dotfiles/.config/lf/icons b/dotfiles/.config/lf/icons
new file mode 100644
index 0000000..776e078
--- /dev/null
+++ b/dotfiles/.config/lf/icons
@@ -0,0 +1,84 @@
+export LF_ICONS="di=📁:\
+fi=📃:\
+tw=🤝:\
+ow=📂:\
+ln=⛓:\
+or=❌:\
+ex=🏎:\
+*.txt=📜:\
+*.mom=📜:\
+*.me=📜:\
+*.ms=📜:\
+*.png=🖼:\
+*.webp=🖼:\
+*.ico=🖼:\
+*.jpg=🖼:\
+*.jpe=🖼:\
+*.jpeg=🖼:\
+*.gif=🖼:\
+*.svg=🖊:\
+*.tif=🖼:\
+*.tiff=🖼:\
+*.nef=📷:\
+*.xcf=🖌:\
+*.html=🌎:\
+*.url=🌎:\
+*.xml=📰:\
+*.gpg=🔒:\
+*.css=🎨:\
+*.pdf=📖:\
+*.djvu=📖:\
+*.epub=📖:\
+*.csv=📓:\
+*.xlsx=📓:\
+*.tex=📘:\
+*.md=📘:\
+*.r=📊:\
+*.R=📊:\
+*.rmd=📊:\
+*.Rmd=📊:\
+*.m=📊:\
+*.mp3=🎵:\
+*.opus=🎵:\
+*.ogg=🎵:\
+*.m4a=🎵:\
+*.flac=🎵:\
+*.wav=🎵:\
+*.mod=🎵:\
+*.xm=🎵:\
+*.mkv=🎥:\
+*.mp4=🎥:\
+*.webm=🎥:\
+*.mpeg=🎥:\
+*.avi=🎥:\
+*.mov=🎥:\
+*.mpg=🎥:\
+*.wmv=🎥:\
+*.m4b=🎥:\
+*.flv=🎥:\
+*.zip=📦:\
+*.rar=📦:\
+*.7z=📦:\
+*.tar.gz=📦:\
+*.apk=📦:\
+*.z64=🎮:\
+*.v64=🎮:\
+*.n64=🎮:\
+*.gba=🎮:\
+*.nes=🎮:\
+*.gdi=🎮:\
+*.gcm=🎮:\
+*.1=ℹ:\
+*.nfo=ℹ:\
+*.info=ℹ:\
+*.log=📙:\
+*.iso=📀:\
+*.img=📀:\
+*.qcow2=📀:\
+*.bib=📚:\
+*.ged=👪:\
+*.part=💔:\
+*.torrent=🔽:\
+*.jar=♨:\
+*.java=♨:\
+"
diff --git a/dotfiles/.config/lf/lfrc b/dotfiles/.config/lf/lfrc
new file mode 100644
index 0000000..4c2a3ba
--- /dev/null
+++ b/dotfiles/.config/lf/lfrc
@@ -0,0 +1,92 @@
+# Personal lf conf
+# Inspired by the official example conf and Luke Smith's voidrice's
+
+set icons
+set scrolloff 10
+set ratios 1:4:3
+set period 1
+set ifs "\n"
+set info size
+set previewer ~/.local/bin/scope
+
+# Custom commands
+
+cmd on-cd &{{
+ # '&' commands run silently in background (which is what we want here),
+ # but are not connected to stdout.
+ # To make sure our escape sequence still reaches stdout we pipe it to /dev/tty
+ printf "\033]0; lf - $PWD\007" > /dev/tty
+}}
+
+on-cd
+
+cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
+
+cmd delete ${{
+ clear; tput cup $(($(tput lines)/3)); tput bold
+ set -f
+ printf "%s\n\t" "$fx"
+ printf "delete?[y/N]"
+ read ans
+ [ $ans = "y" ] && rm -rf -- $fx
+}}
+
+# compress current file or selected files with tar and gunzip
+cmd tar ${{
+ set -f
+ mkdir $1
+ cp -r $fx $1
+ tar -czf $1.tar.gz $1
+ rm -rf $1
+}}
+
+# extract the current file with the right command
+# (xkcd link: https://xkcd.com/1168/)
+cmd extract ${{
+ set -f
+ case $f in
+ *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
+ *.tar.gz|*.tgz) tar xzvf $f;;
+ *.tar.xz|*.txz) tar xJvf $f;;
+ *.zip) unzip $f;;
+ *.rar) unrar x $f;;
+ *.7z) 7z x $f;;
+ esac
+}}
+
+# change dir with fzf
+cmd fzf_jump ${{
+ res="$(find . -type d | fzf --header='Jump to location')"
+ if [ -d "$res" ]; then
+ cmd="cd"
+ else
+ cmd="select"
+ fi
+ lf -remote "send $id $cmd \"$res\""
+}}
+
+# drag and drop prompt
+cmd dragon $dragon-drag-and-drop -a $fx
+
+# copy path to clipboard
+cmd yank-path &printf '%s' "$fx" | wl-copy
+
+# Bindings
+map A rename
+map c
+map cc clear
+map cd push :cd<space>
+map cw push A<c-u> # rename from zero
+map I push A<c-a> # rename from the beginning
+map i push A<a-b><a-b><a-f> # rename before extention
+map a push A<a-b> # rename after extention
+map <c-n> push :mkdir<space>
+map <c-r> reload
+map <enter> shell
+map D delete
+map <enter> shell
+map f :fzf_jump
+map t :dragon
+map W $setsid $TERMINAL & # open new terminal window
+map Y :yank-path
+map L $LESSOPEN='| ~/.local/bin/scope %s' less -R $f # open file preview in pager