update server dotfiles
This commit is contained in:
parent
72e28e6cf2
commit
a8d446ab02
9 changed files with 203 additions and 178 deletions
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
kitty +icat --clear --silent --transfer-mode file
|
kitty +kitten icat --clear --transfer-mode file
|
||||||
|
|
||||||
|
|
110
.config/lf/lfrc
110
.config/lf/lfrc
|
@ -2,75 +2,64 @@
|
||||||
set ratios 1:2:4
|
set ratios 1:2:4
|
||||||
set shellopts '-eu'
|
set shellopts '-eu'
|
||||||
set ifs "\n"
|
set ifs "\n"
|
||||||
|
set findlen 1
|
||||||
set scrolloff 10
|
set scrolloff 10
|
||||||
set icons
|
set icons
|
||||||
set wrapscroll
|
set wrapscroll
|
||||||
set period 1
|
set period 1
|
||||||
set findlen 2
|
|
||||||
set previewer ~/.config/lf/preview
|
set previewer ~/.config/lf/preview
|
||||||
set cleaner ~/.config/lf/clean
|
set cleaner ~/.config/lf/clean
|
||||||
set promptfmt "\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m%d\033[33m%f\033[35m]\033[0m"
|
set promptfmt "\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m%d\033[33m%f\033[35m]\033[0m"
|
||||||
|
|
||||||
cmd open ${{
|
cmd open ${{
|
||||||
case $(file --mime-type "$(readlink -f $f)" -b) in
|
case $(file --mime-type "$(readlink -f $f)" -b) in
|
||||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
|
|
||||||
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
|
|
||||||
text/*|application/json|inode/x-empty) $EDITOR $fx;;
|
text/*|application/json|inode/x-empty) $EDITOR $fx;;
|
||||||
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
|
application/pgp-encrypted) $EDITOR $fx ;;
|
||||||
image/svg+xml) display -- $f ;;
|
|
||||||
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
|
|
||||||
setsid -f sxiv -aio 2>/dev/null | while read -r file; do
|
|
||||||
[ -z "$file" ] && continue
|
|
||||||
lf -remote "send select \"$file\""
|
|
||||||
lf -remote "send toggle"
|
|
||||||
done &
|
|
||||||
;;
|
|
||||||
audio/*) mpv --audio-display=no $f ;;
|
|
||||||
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
|
|
||||||
application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
|
|
||||||
application/pgp-encrypted) $EDITOR $fx ;;
|
|
||||||
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
|
|
||||||
esac
|
esac
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
|
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
|
||||||
|
|
||||||
cmd extract ${{
|
cmd extract ${{
|
||||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||||
set -f
|
set -f
|
||||||
printf "%s\n\t" "$fx"
|
printf "%s\n\t" "$fx"
|
||||||
printf "extract?[y/N]"
|
printf "extract?[y/N]"
|
||||||
read ans
|
read ans
|
||||||
[ $ans = "y" ] && aunpack $fx
|
[ $ans = "y" ] && aunpack $fx
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd delete ${{
|
cmd delete ${{
|
||||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||||
set -f
|
set -f
|
||||||
printf "%s\n\t" "$fx"
|
printf "%s\n\t" "$fx"
|
||||||
printf "delete?[y/N]"
|
printf "delete?[y/N]"
|
||||||
read ans
|
read ans
|
||||||
[ $ans = "y" ] && rm -rf -- $fx
|
[ $ans = "y" ] && rm -rf -- $fx
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd trash ${{
|
cmd trash ${{
|
||||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||||
set -f
|
set -f
|
||||||
printf "%s\n\t" "$fx"
|
printf "%s\n\t" "$fx"
|
||||||
printf "trash?[y/N]"
|
printf "trash?[y/N]"
|
||||||
read ans
|
read ans
|
||||||
[ $ans = "y" ] && trash-put $fx
|
if [ $ans = "y" ]; then
|
||||||
|
for f in $fx; do
|
||||||
|
echo $f
|
||||||
|
trash-put $f
|
||||||
|
done
|
||||||
|
fi
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd rsyncto ${{
|
cmd rsyncto %{{
|
||||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||||
set -f
|
set -f
|
||||||
clear; echo "rsync to where?"
|
clear; echo "rsync to where?"
|
||||||
read dest
|
read dest
|
||||||
for x in $fx; do
|
for x in $fx; do
|
||||||
eval rsync -aAXHv \"$x\" \"$dest\"
|
eval rsync -aAXHv \"$x\" \"$dest\"
|
||||||
done &&
|
done
|
||||||
notify-send "File(s) rsynced." "File(s) copies to $dest."
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
# y (select for copy) and P to paste soft-link
|
# y (select for copy) and P to paste soft-link
|
||||||
|
@ -93,21 +82,11 @@ cmd link %{{
|
||||||
lf -remote "send clear"
|
lf -remote "send clear"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd setbg "$1"
|
|
||||||
cmd bulkrename $vidir
|
cmd bulkrename $vidir
|
||||||
|
|
||||||
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 on-cd &{{
|
cmd on-cd &{{
|
||||||
DIR=$(echo $PWD | sed "s|$HOME|~|")
|
DIR=$(echo $PWD | sed "s|$HOME|~|")
|
||||||
printf "\033]0;$(hostname): $DIR\007" > /dev/tty
|
printf "\033]0; $DIR\007" > /dev/tty
|
||||||
}}
|
}}
|
||||||
on-cd
|
on-cd
|
||||||
|
|
||||||
|
@ -137,31 +116,42 @@ cmd paste &{{
|
||||||
cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -r -selection c
|
cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -r -selection c
|
||||||
|
|
||||||
# Bindings
|
# Bindings
|
||||||
map <c-f> $lf -remote "send $id select '$(fzf)'"
|
map <c-c>a $lf -remote "send $id select '$(fzf)'"
|
||||||
|
map <c-c>t $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/tags | sed 's/:\*$//' | fzf)'"
|
||||||
|
map <c-c>f $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-files | fzf)'"
|
||||||
|
map <c-c>d $lf -remote "send $id cd '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-dirs | fzf)'"
|
||||||
map J $dir=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf) && lf -remote "send $id cd $(eval echo $dir)"
|
map J $dir=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf) && lf -remote "send $id cd $(eval echo $dir)"
|
||||||
map D trash
|
map D trash
|
||||||
map <c-d> delete
|
map <c-d> delete
|
||||||
map E extract
|
map T $trash-restore $PWD
|
||||||
|
map <c-e> extract
|
||||||
map R rsyncto
|
map R rsyncto
|
||||||
map P link
|
map P link
|
||||||
map S share
|
map S share
|
||||||
map <c-g> $lazygit
|
map <c-g> $lazygit
|
||||||
map V push :!$EDITOR<space>
|
map <c-v> push :!$EDITOR<space>
|
||||||
map <c-n> push :mkdir<space>
|
map <c-n> push :mkdir<space>
|
||||||
|
map <c-t> push :&touch<space>
|
||||||
map <c-r> reload
|
map <c-r> reload
|
||||||
map <c-s> set hidden!
|
map <c-s> set hidden!
|
||||||
map <enter> shell
|
map <enter> shell
|
||||||
map x $$f
|
map x $$f
|
||||||
map X !$f
|
map X !$f
|
||||||
map o &mimeopen $f
|
map o &mimeopen $f
|
||||||
map O $mimeopen --ask $f
|
map O $mimeopen -a $f
|
||||||
|
|
||||||
map A rename # at the very end
|
map A rename # at the very end
|
||||||
map a push A<c-a> # at the very beginning
|
map a push A<c-a> # at the very beginning
|
||||||
map I push A<a-b> # after extension
|
map I push A<a-b> # after extension
|
||||||
map i push A<a-b><a-b><a-f> # before extension
|
map i push A<a-b><a-b><a-f> # before extension
|
||||||
map c push A<c-u> # new rename
|
map c push A<c-u> # new rename
|
||||||
map B bulkrename
|
map B bulkrename
|
||||||
|
map b dupe
|
||||||
|
map u :clear; unselect
|
||||||
|
map n &echo $f | xclip -r -selection c
|
||||||
|
map <esc> quit
|
||||||
|
map N
|
||||||
|
map g/ cd "/"
|
||||||
|
map W &setsid $TERMINAL -e $SHELL -c "lf; $SHELL"
|
||||||
|
|
||||||
# source directory shortcuts
|
# Load bookmark shortcuts
|
||||||
source "~/.config/lf/shortcutrc"
|
source "~/.config/lf/shortcutrc"
|
||||||
|
|
|
@ -1,73 +1,61 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
image() {
|
image() {
|
||||||
file=$1
|
f=$1
|
||||||
w=$2
|
w=$2
|
||||||
h=$3
|
h=$3
|
||||||
x=$4
|
x=$4
|
||||||
y=$5
|
y=$5
|
||||||
kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file"
|
chafa "$f" -f symbols -s "$((w-2))x$h" && exit 1
|
||||||
|
echo -e "\e[31mImage previewer not installed\e[0m"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
video() {
|
video() {
|
||||||
file=$1
|
f=$1
|
||||||
w=$2
|
w=$2
|
||||||
h=$3
|
h=$3
|
||||||
x=$4
|
x=$4
|
||||||
y=$5
|
y=$5
|
||||||
thumb="$(vidthumb "$file")"
|
thumb="$(vidthumb "$f")" || ( echo -e "\e[31mvidthumb script not in path\e[0m" && return 1 )
|
||||||
if [ "$thumb" != "" ]; then
|
image "$thumb" "$w" "$h" "$x" "$y"
|
||||||
kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$thumb"
|
return 1
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mediainfo "$file"
|
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
batorcat() {
|
batorcat() {
|
||||||
file="$1"
|
f=$1
|
||||||
shift
|
w=$2
|
||||||
if command -v bat > /dev/null 2>&1; then
|
command -v bat > /dev/null 2>&1 && bat --color=always --style=plain --pager=never --terminal-width "$((w-2))" "$f" && exit 0
|
||||||
bat --color=always --style=plain --pager=never "$file" "$@"
|
command -v batcat > /dev/null 2>&1 && batcat --color=always --style=plain --pager=never --terminal-width "$((w-2))" "$f" && exit 0
|
||||||
elif command -v batcat > /dev/null 2>&1; then
|
cat "$f" && exit 0
|
||||||
batcat --color=always --style=plain --pager=never "$file" "$@"
|
|
||||||
else
|
|
||||||
cat "$file"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
|
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
|
||||||
|
|
||||||
case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
|
case "$(xdg-mime query filetype "$1")" in
|
||||||
*.md) glow "$1" && exit 0 ;;
|
*/x-bzip-compressed-tar|*/x-compressed-tar|*/x-xz-compressed-tar) als -- "$1" && exit 0 || echo -e "\e[31matools not installed\e[0m" && exit 1;;
|
||||||
*.xml|*.html) w3m -dump "$1" && exit 0 ;;
|
*/x-7z-compressed|*/vnd.rar|*/x-tar|*/zip|*/x-java-archive|*/x-xz) 7z l "$1" | sed 1,11d && exit 0 || echo -e "\e[31m7zip not installed\e[0m" && exit 1;;
|
||||||
*.[1-8]) man "$1" | col -b && exit 0 ;;
|
*/x-cd-image) iso-info --no-header -l "$1" && exit 0 || echo -e "\e[31mlibcdio not installed\e[0m" && exit 1;;
|
||||||
*.o) nm "$1" && exit 0 ;;
|
*/x-bittorrent) transmission-show "$1" && exit 0 || echo -e "\e[31mtransmission-cli not installed\e[0m" && exit 1;;
|
||||||
esac
|
*/vnd.sun.xml.writer) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
|
||||||
|
*/msword) catdoc "$1" && exit 0 || echo -e "\e[31mcatdoc not installed\e[0m" && exit 1;;
|
||||||
case "$(file -bL --mime-type $1)" in
|
*/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" && exit 0 || echo -e "\e[31mdocx2txt not installed\e[0m" && exit 1;;
|
||||||
application/gzip) tar tzf "$1" ;;
|
*/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
|
||||||
application/x-bzip2) tar tjf "$1" ;;
|
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
|
||||||
application/x-xz) xz --list "$1" ;;
|
*/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mepubthumbnailer not installed (https://github.com/marianosimone/epub-thumbnailer)\e[0m" && exit 1;;
|
||||||
application/x-tar) tar tf "$1" ;;
|
*/pgp-encrypted) gpg -d -- "$1" && exit 0 || echo -e "\e[31mgpg not installed\e[0m" && exit 1;;
|
||||||
application/zip) unzip -l "$1" ;;
|
*/pkix-cert) openssl x509 -text -noout -in "$1" && exit 0 || echo -e "\e[31mopenssl not installed\e[0m" && exit 1;;
|
||||||
application/java-archive) unzip -l "$1" ;;
|
|
||||||
application/x-rar) unrar l "$1" ;;
|
|
||||||
application/x-7z-compressed) 7z l "$1" ;;
|
|
||||||
application/x-iso9660-image) iso-info --no-header -l "$1" ;;
|
|
||||||
application/x-bittorrent) transmission-show "$1" ;;
|
|
||||||
application/vnd.sun.xml.writer) odt2txt "$1" ;;
|
|
||||||
application/msword) catdoc "$1" ;;
|
|
||||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" ;;
|
|
||||||
application/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;;
|
|
||||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;;
|
|
||||||
application/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" ;;
|
|
||||||
application/pgp-encrypted) gpg -d -- "$1" ;;
|
|
||||||
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
|
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
|
||||||
video/*) video "$1" "$2" "$3" "$4" "$5" ;;
|
video/*) video "$1" "$2" "$3" "$4" "$5" ;;
|
||||||
*opendocument*) odt2txt "$1" ;;
|
*opendocument*) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
|
||||||
text/*|*/xml|application/json) batorcat "$1" ;;
|
*/markdown) lowdown -Tterm "$1" && exit 0 || echo -e "\e[31mlowdown not installed \e[0m" && exit 1;;
|
||||||
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;;
|
*/html) lynx -dump "$1" && exit 0 || w3m -dump "$1" && exit 0 || echo -e "\e[31neither lynx nor w3m installed\e[0m" && exit 1;;
|
||||||
*) mediainfo "$1" || exit 1 ;;
|
text/*|*/json|*/xml) batorcat "$1" "$2" ;;
|
||||||
|
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mpoppler-utils/poppler not installed\e[0m" && exit 1;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
case "$(file -bL --mime-type "$1")" in
|
||||||
|
text/*) batorcat "$1" "$2" ;;
|
||||||
|
esac
|
||||||
|
xdg-mime query filetype "$1"
|
||||||
|
mediainfo "$1"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,5 @@
|
||||||
map Cch cd "/home/luca/.cache"
|
map gh cd "/home/luca"
|
||||||
map Ccf cd "/home/luca/.config"
|
map gmn cd "/mnt"
|
||||||
map Cdt cd "/home/luca/.local/share"
|
map g/ cd "/"
|
||||||
map Crr cd "/home/luca/.local/src"
|
map go cd "/opt"
|
||||||
map Csc cd "/home/luca/.local/bin"
|
map ge cd "/etc"
|
||||||
map Cmn cd "/mnt"
|
|
||||||
map Cdl cd "/home/luca/Downloads"
|
|
||||||
map Cdm cd "/home/luca/Documents"
|
|
||||||
map Cms cd "/home/luca/Music"
|
|
||||||
map Cpc cd "/home/luca/Pictures"
|
|
||||||
map Cvd cd "/home/luca/Videos"
|
|
||||||
map Cdot cd "/home/luca/.local/share/dotfiles"
|
|
||||||
map Ebf $$EDITOR "/home/luca/.config/shell/bm-files"
|
|
||||||
map Ebd $$EDITOR "/home/luca/.config/shell/bm-dirs"
|
|
||||||
map Ecfx $$EDITOR "/home/luca/.config/x11/xresources"
|
|
||||||
map Ecfb $$EDITOR "/home/luca/.local/src/dwmblocks/config.h"
|
|
||||||
map Ecfv $$EDITOR "/home/luca/.config/nvim/init.vim"
|
|
||||||
map Ecfz $$EDITOR "/.zshrc"
|
|
||||||
map Ecfa $$EDITOR "/home/luca/.config/shell/aliasrc"
|
|
||||||
map Ecfp $$EDITOR "/home/luca/.config/shell/profile"
|
|
||||||
map Ecfm $$EDITOR "/home/luca/.config/mutt/muttrc"
|
|
||||||
map Ecfn $$EDITOR "/home/luca/.config/newsboat/config"
|
|
||||||
map Ecfu $$EDITOR "/home/luca/.config/newsboat/urls"
|
|
||||||
map Ecfmb $$EDITOR "/home/luca/.config/ncmpcpp/bindings"
|
|
||||||
map Ecfmc $$EDITOR "/home/luca/.config/ncmpcpp/config"
|
|
||||||
map Ecfl $$EDITOR "/home/luca/.config/lf/lfrc"
|
|
||||||
map EcfL $$EDITOR "/home/luca/.config/lf/scope"
|
|
||||||
map EcfX $$EDITOR "/home/luca/.config/sxiv/exec/key-handler"
|
|
||||||
|
|
|
@ -1,32 +1,42 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for command in apt su pkill ; do
|
for command in apt su ; do
|
||||||
alias $command="sudo $command"
|
alias $command="sudo $command"
|
||||||
done; unset command
|
done; unset command
|
||||||
|
|
||||||
# Verbosity and settings that you pretty much just always are going to want.
|
# Verbosity and settings that you pretty much just always are going to want.
|
||||||
alias \
|
alias \
|
||||||
cp="cp -iv" \
|
cp="cp -iv" \
|
||||||
mv="mv -iv" \
|
mv="mv -iv" \
|
||||||
rm="rm -vI" \
|
rm="rm -vI" \
|
||||||
mkd="mkdir -pv" \
|
bc="bc -ql" \
|
||||||
exa="exa -abghHliS" \
|
mkd="mkdir -pv" \
|
||||||
duf="duf -all" \
|
ffmpeg="ffmpeg -hide_banner" \
|
||||||
ls="ls -hN --color=auto --group-directories-first" \
|
exa="exa -abghHliS" \
|
||||||
grep="grep --color=auto" \
|
duf="duf -all" \
|
||||||
diff="diff --color=auto" \
|
ls="ls -hN --color=auto --group-directories-first" \
|
||||||
ccat="highlight --out-format=ansi" \
|
grep="grep --color=auto" \
|
||||||
ip="ip -color=auto"
|
diff="diff --color=auto" \
|
||||||
|
|
||||||
|
# Colorize commands when possible.
|
||||||
|
alias \
|
||||||
|
ls="ls -hN --color=auto --group-directories-first" \
|
||||||
|
grep="grep --color=auto" \
|
||||||
|
diff="diff --color=auto" \
|
||||||
|
ccat="highlight --out-format=ansi" \
|
||||||
|
ip="ip -color=auto"
|
||||||
|
|
||||||
# These common commands are just too long! Abbreviate them.
|
# These common commands are just too long! Abbreviate them.
|
||||||
alias \
|
alias \
|
||||||
ka="killall" \
|
ka="killall" \
|
||||||
e="$EDITOR" \
|
e="$EDITOR" \
|
||||||
au="apt uninstall" \
|
ar="apt remove" \
|
||||||
ar="apt reinstall" \
|
are="apt reinstall" \
|
||||||
ai="apt install" \
|
ai="apt install" \
|
||||||
aur="apt autoremove" \
|
aur="apt autoremove" \
|
||||||
|
au="apt upgrade" \
|
||||||
|
|
||||||
# Misc.
|
# Misc.
|
||||||
alias \
|
alias \
|
||||||
vim="nvim" \
|
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
||||||
|
vim="nvim" \
|
||||||
|
|
|
@ -8,6 +8,8 @@ export PATH="$PATH:${$(find -L ~/.local/bin -type d -printf %p:)%%:}"
|
||||||
# Adds `~/.local/share/npm-global` to $PATH
|
# Adds `~/.local/share/npm-global` to $PATH
|
||||||
export PATH=~/.npm-global/bin:$PATH
|
export PATH=~/.npm-global/bin:$PATH
|
||||||
|
|
||||||
|
unsetopt PROMPT_SP
|
||||||
|
|
||||||
# Default programs:
|
# Default programs:
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
|
|
||||||
|
@ -22,7 +24,6 @@ export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/shell/inputrc"
|
||||||
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
||||||
export ZSH_COMPDUMP="${XDG_CACHE_HOME:-$HOME/.cache}/zcompdump"
|
export ZSH_COMPDUMP="${XDG_CACHE_HOME:-$HOME/.cache}/zcompdump"
|
||||||
export GNUPGHOME="${XDG_CONFIG_HOME:-$HOME/.config}/gnupg"
|
export GNUPGHOME="${XDG_CONFIG_HOME:-$HOME/.config}/gnupg"
|
||||||
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
|
|
||||||
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
|
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
|
||||||
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
|
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
|
||||||
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
||||||
|
@ -39,7 +40,7 @@ export LESS_TERMCAP_se="$(printf '%b' '[0m')"
|
||||||
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
|
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
|
||||||
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
|
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
|
||||||
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
|
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
|
||||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
# export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
export PYENV_PROMPT=" %F{yellow\}%F{reset\} "
|
export PYENV_PROMPT=" %F{yellow\}%F{reset\} "
|
||||||
|
|
||||||
# This is the list for lf icons:
|
# This is the list for lf icons:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# Enable colors and change prompt:
|
autoload -U colors && colors
|
||||||
autoload -U colors && colors # Load colors
|
autoload edit-command-line && zle -N edit-command-line
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
autoload -U compinit
|
||||||
|
autoload -Uz edit-command-line
|
||||||
PS1="%B%F{blue}%n%F{cyan}@%F{blue}%m %F{magenta}[%f%3~%F{magenta}] %(?.%F{green}.%F{red})»%f%b "
|
PS1="%B%F{blue}%n%F{cyan}@%F{blue}%m %F{magenta}[%f%3~%F{magenta}] %(?.%F{green}.%F{red})»%f%b "
|
||||||
RPS1="%(?..%F{red}%?)"
|
RPS1="%(?..%F{red}%?)"
|
||||||
stty stop undef # Disable ctrl-s to freeze terminal.
|
stty stop undef # Disable ctrl-s to freeze terminal.
|
||||||
|
@ -8,19 +11,20 @@ setopt HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_VERIFY BANG_HIST interactive
|
||||||
# History in cache directory:
|
# History in cache directory:
|
||||||
HISTSIZE=10000000
|
HISTSIZE=10000000
|
||||||
SAVEHIST=10000000
|
SAVEHIST=10000000
|
||||||
|
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
|
||||||
|
|
||||||
# Load aliases if existent.
|
# Load aliases and shortcuts if existent.
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
|
||||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
|
||||||
|
|
||||||
# Basic auto/tab complete:
|
# Basic auto/tab complete:
|
||||||
autoload -U compinit
|
|
||||||
zstyle ':completion:*' menu select
|
zstyle ':completion:*' menu select
|
||||||
zmodload zsh/complist
|
zmodload zsh/complist
|
||||||
compinit
|
compinit
|
||||||
_comp_options+=(globdots) # Include hidden files.
|
_comp_options+=(globdots) # Include hidden files.
|
||||||
|
|
||||||
# vi mode
|
# vi mode
|
||||||
autoload -Uz edit-command-line
|
|
||||||
zle -N edit-command-line
|
zle -N edit-command-line
|
||||||
bindkey -M vicmd v edit-command-line
|
bindkey -M vicmd v edit-command-line
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
@ -80,17 +84,12 @@ bindkey '^o' _lfcd
|
||||||
|
|
||||||
# bind lazygit to ctrl-g
|
# bind lazygit to ctrl-g
|
||||||
lg () {
|
lg () {
|
||||||
lazygit
|
[ ! -d "$(pwd)/.git" ] && [[ $(read -ek "?Not in a git repository. Create a new git repository? (y/n): ") =~ ^[Yy]$ ]] && git init
|
||||||
tput cuu1;tput el
|
[ -d "$(pwd)/.git" ] && lazygit -p $(pwd)
|
||||||
|
zle reset-prompt
|
||||||
}
|
}
|
||||||
|
zle -N lg{,}
|
||||||
_lazygit () {
|
bindkey '^g' lg
|
||||||
BUFFER="lg"
|
|
||||||
zle accept-line
|
|
||||||
}
|
|
||||||
|
|
||||||
zle -N _lazygit
|
|
||||||
bindkey '^g' _lazygit
|
|
||||||
|
|
||||||
# Edit line in vim with ctrl-e:
|
# Edit line in vim with ctrl-e:
|
||||||
autoload edit-command-line; zle -N edit-command-line
|
autoload edit-command-line; zle -N edit-command-line
|
||||||
|
@ -104,7 +103,8 @@ bindkey '^[[F' end-of-line
|
||||||
bindkey '^[[1;5C' forward-word
|
bindkey '^[[1;5C' forward-word
|
||||||
bindkey '^[[1;5D' backward-word
|
bindkey '^[[1;5D' backward-word
|
||||||
|
|
||||||
|
# plugins
|
||||||
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins/fzf/key-bindings.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins/fzf/key-bindings.zsh"
|
PLUGINS_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins"
|
||||||
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins/autopyenv/autopyenv.plugin.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins/autopyenv/autopyenv.plugin.zsh"
|
[ -f "$PLUGINS_HOME/fzf/key-bindings.zsh" ] && source "$PLUGINS_HOME/fzf/key-bindings.zsh"
|
||||||
|
[ -f "$PLUGINS_HOME/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" ] && source "$PLUGINS_HOME/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
|
||||||
|
[ -f "$PLUGINS_HOME/autopyenv/autopyenv.plugin.zsh" ] && source "$PLUGINS_HOME/autopyenv/autopyenv.plugin.zsh"
|
||||||
|
|
28
.local/bin/trash-put
Executable file
28
.local/bin/trash-put
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
[ -e "$1" ] || exit 1
|
||||||
|
getfsroot() {
|
||||||
|
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||||
|
}
|
||||||
|
|
||||||
|
filepath="$(realpath "$1")"
|
||||||
|
filename="$(basename "$1")"
|
||||||
|
fsroot="$(getfsroot "$1")"
|
||||||
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||||
|
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||||
|
|| basedir="${fsroot}/.Trash"
|
||||||
|
infodir="$basedir/info"
|
||||||
|
filedir="$basedir/files"
|
||||||
|
|
||||||
|
mkdir -p "$infodir" 1>/dev/null 2>&1
|
||||||
|
mkdir -p "$filedir" 1>/dev/null 2>&1
|
||||||
|
find "$filedir" -regex ".*$filename.*" | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
|
||||||
|
ext=$(($(cat /dev/stdin)+1))
|
||||||
|
filedest="$filedir/$filename.~$ext~"
|
||||||
|
command mv -f "$filepath" "$filedest"
|
||||||
|
cat <<EOF > "$infodir/$(basename "$filedest")"
|
||||||
|
[Trash Info]
|
||||||
|
Path=$filepath
|
||||||
|
DeletionDate=$(date +%Y%m%dT%T)
|
||||||
|
EOF
|
||||||
|
)
|
31
.local/bin/trash-restore
Executable file
31
.local/bin/trash-restore
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
getfsroot() {
|
||||||
|
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||||
|
}
|
||||||
|
list() {
|
||||||
|
# 1st arg is trash files directory
|
||||||
|
# 2nd arg is directory to match trash files for
|
||||||
|
[ ! "$(ls -A "$1")" ] && exit 1
|
||||||
|
for file in "$1"/* ; do
|
||||||
|
[ "$(head -1 "$file")" = "[Trash Info]" ] && \
|
||||||
|
fpath=$(grep Path "$file" | cut -d '=' -f2) && \
|
||||||
|
echo "$fpath" | grep -qP "^$2/[^/]+$" && \
|
||||||
|
printf "%s %s %s\n" \
|
||||||
|
"$(basename "$file")" \
|
||||||
|
"$fpath" \
|
||||||
|
"$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
||||||
|
fsroot="$(getfsroot "$dir")"
|
||||||
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||||
|
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||||
|
|| basedir="${fsroot}/.Trash"
|
||||||
|
|
||||||
|
sel="$(list "$basedir/info" "$dir" | fzf)"
|
||||||
|
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
||||||
|
dest="$(echo "$sel" | cut -d ' ' -f2)"
|
||||||
|
command mv -ib "$file" "$dest"
|
||||||
|
command rm "$basedir/info/$(echo "$sel" | cut -d ' ' -f1)"
|
Loading…
Add table
Add a link
Reference in a new issue