From 8f6be4a9861d29cd189b07f332a56cb83bd86abd Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 14 Mar 2022 17:31:20 +0100 Subject: In progress --- .config/emacs/org/config.org | 3 +- .config/lf/icons | 267 +++++++++++++++++++++++++++++++++++++++++++ .config/lf/lfrc | 62 ++++++++++ .config/zsh/.zshrc | 12 ++ .local/bin/rotdir | 14 +++ 5 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 .config/lf/icons create mode 100644 .config/lf/lfrc create mode 100755 .local/bin/rotdir diff --git a/.config/emacs/org/config.org b/.config/emacs/org/config.org index 5bff1f7..30a397f 100644 --- a/.config/emacs/org/config.org +++ b/.config/emacs/org/config.org @@ -754,7 +754,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." *** undo-tree #+BEGIN_SRC emacs-lisp - (require 'undo-tree) + (require 'undo-tree) + (setq undo-tree-auto-save-history nil) #+END_SRC ** Compilation diff --git a/.config/lf/icons b/.config/lf/icons new file mode 100644 index 0000000..249ada9 --- /dev/null +++ b/.config/lf/icons @@ -0,0 +1,267 @@ +fi= +di= +ln= +pi=| +so=ﯲ +db= +cd=c +or= +su= +sg= +tw= +ow=w +st= +ex= +*.7z= +*.a= +*.aac= +*.ace= +*.ai= +*.alz= +*.apk= +*.arc= +*.arj= +*.asf= +*.asm= +*.asp= +*.au= +*.aup= +*.avi= +*.avi= +*.bash= +*.bat= +*.bmp= +*.bz2= +*.bz= +*.c++= +*.c= +*.cab= +*.cbr= +*.cbz= +*.cc= +*.cgm= +*.class= +*.clj= +*.cljc= +*.cljs= +*.cmake= +*.cmd= +*.coffee= +*.conf= +*.cp= +*.cpio= +*.cpp= +*.cs= +*.css= +*.cue= +*.cvs= +*.cxx= +*.d= +*.dart= +*.db= +*.deb= +*.diff= +*.dl= +*.dll= +*.doc= +*.docx= +*.dump= +*.dwm= +*.dz= +*.ear= +*.edn= +*.eex= +*.efi= +*.ejs= +*.elf= +*.elm= +*.emf= +*.epub= +*.erl= +*.esd= +*.ex= +*.exe= +*.exs= +*.f#= +*.fifo=| +*.fish= +*.flac= +*.flc= +*.fli= +*.flv= +*.flv= +*.fs= +*.fsi= +*.fsscript= +*.fsx= +*.gem= +*.gif= +*.git= +*.gl= +*.go= +*.gz= +*.gzip= +*.h= +*.hbs= +*.hh= +*.hpp= +*.hrl= +*.hs= +*.htaccess= +*.htm= +*.html= +*.htpasswd= +*.ico= +*.img= +*.ini= +*.iso= +*.jar= +*.java= +*.jl= +*.jpeg= +*.jpg= +*.js= +*.json= +*.jsx= +*.key= +*.less= +*.lha= +*.lhs= +*.log= +*.lrz= +*.lua= +*.lz4= +*.lz= +*.lzh= +*.lzma= +*.lzo= +*.m2v= +*.m4a= +*.m4v= +*.markdown= +*.md= +*.mid= +*.midi= +*.mjpeg= +*.mjpg= +*.mka= +*.mkv= +*.ml=λ +*.mli=λ +*.mng= +*.mov= +*.mp3= +*.mp4= +*.mp4v= +*.mpc= +*.mpeg= +*.mpg= +*.msi= +*.mustache= +*.nix= +*.nuv= +*.o= +*.oga= +*.ogg= +*.ogm= +*.ogv= +*.ogx= +*.opus= +*.pbm= +*.pcx= +*.pdf= +*.pgm= +*.php= +*.pl= +*.pm= +*.png= +*.ppk= +*.ppm= +*.ppt= +*.pptx= +*.pro= +*.ps1= +*.psb= +*.psd= +*.pub= +*.py= +*.pyc= +*.pyd= +*.pyo= +*.qt= +*.ra= +*.rar= +*.rb= +*.rc= +*.rlib= +*.rm= +*.rmvb= +*.rom= +*.rpm= +*.rs= +*.rss= +*.rtf= +*.rz= +*.s= +*.sar= +*.scala= +*.scss= +*.sh= +*.slim= +*.sln= +*.so= +*.spx= +*.sql= +*.styl= +*.suo= +*.svg= +*.svgz= +*.swm= +*.t7z= +*.t= +*.tar= +*.taz= +*.tbz2= +*.tbz= +*.tga= +*.tgz= +*.tif= +*.tiff= +*.tlz= +*.ts= +*.twig= +*.txz= +*.tz= +*.tzo= +*.tzst= +*.vim= +*.vimrc= +*.vob= +*.war= +*.wav= +*.wav= +*.webm= +*.wim= +*.wmv= +*.xbm= +*.xbps= +*.xcf= +*.xhtml= +*.xls= +*.xlsx= +*.xml= +*.xpm= +*.xspf= +*.xul= +*.xwd= +*.xz= +*.yaml= +*.yml= +*.yuv= +*.z= +*.zip= +*.zoo= +*.zsh= +*.zst= +*.src= +*.ebuild= \ No newline at end of file diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..e800495 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,62 @@ +# Basic vars +set shellopts '-eu' +set ifs "\n" +set scrolloff 10 +set icons +set period 1 +set previewer '~/.config/lf/scope' +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" + +# cmds/functions +cmd open ${{ + 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) bsdsetsid zathura $fx >/dev/null 2>&1 ;; + text/*|application/json|inode/x-empty) $EDITOR $fx;; + image/x-xcf) bsdsetsid gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | + bsdsetsid sxiv -aibo 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; + audio/*) bsdsetsid st -e mpv --no-audio-display --audio-channels=stereo $f ;; + video/*) bsdsetsid mpv --fullscreen --really-quiet --audio-channels=stereo $f >/dev/null 2>&1 ;; + application/pdf|application/vnd*|application/epub*) bsdsetsid zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + *) for f in $fx; do bsdsetsid xdg-open $f >/dev/null 2>&1; done;; + esac +}} + +cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" +cmd bulkrename $vidir $fx + +map gr cd / +map gm cd ~/hdd +map za set hidden! +map zh set info size:time +map $lf -remote "send $id select '$(fzf)'" +map open +map D delete +map S $$SHELL +map push :mkdir +map push :mkdir +map reload +map x $$f +map X !$f +map o &mimeopen $f +map O $mimeopen --ask $f + +map A rename # at the very end +map c push A # new rename +map I push A # at the very beginning +map i push A # before extention +map a push A # after extention +map B bulkrename +map bulkrename + +map down +map up +map V push :!nvim diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index a437d68..977be7b 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -81,6 +81,18 @@ globalias() { zle -N globalias +# Use lf to switch directories and bind it to ctrl-o +lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' '^ulfcd\n' + bindkey -v "^ " globalias bindkey -v " " magic-space bindkey -M isearch " " magic-space diff --git a/.local/bin/rotdir b/.local/bin/rotdir new file mode 100755 index 0000000..013ef86 --- /dev/null +++ b/.local/bin/rotdir @@ -0,0 +1,14 @@ +#!/bin/sh + +# Courtesy of Luke Smith + +# When I open an image from the file manager in sxiv (the image viewer), I want +# to be able to press the next/previous keys to key through the rest of the +# images in the same directory. This script "rotates" the content of a +# directory based on the first chosen file, so that if I open the 15th image, +# if I press next, it will go to the 16th etc. Autistic, I know, but this is +# one of the reasons that sxiv is great for being able to read standard input. + +[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 +base="$(basename "$1")" +exa "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' -- cgit v1.2.3