diff --git a/.config/bat/config b/.config/bat/config new file mode 100644 index 000000000..713406601 --- /dev/null +++ b/.config/bat/config @@ -0,0 +1,3 @@ +--theme="base16" +--paging=never +--style=plain diff --git a/.config/glow/glow.yml b/.config/glow/glow.yml new file mode 100644 index 000000000..b4af2ad1f --- /dev/null +++ b/.config/glow/glow.yml @@ -0,0 +1,10 @@ +# style name or JSON path (default "auto") +style: "~/.config/glow/notty.json" +# show local files only; no network (TUI-mode only) +local: false +# mouse support (TUI-mode only) +mouse: false +# use pager to display markdown +pager: false +# word-wrap at width +width: 80 diff --git a/.config/glow/notty.json b/.config/glow/notty.json new file mode 100644 index 000000000..b49ec1de3 --- /dev/null +++ b/.config/glow/notty.json @@ -0,0 +1,87 @@ +{ + "document": { + "block_prefix": "\n", + "block_suffix": "\n", + "margin": 2 + }, + "block_quote": { + "indent": 1, + "indent_token": "│ " + }, + "paragraph": {}, + "list": { + "level_indent": 4 + }, + "heading": { + "block_suffix": "\n" + }, + "h1": { + "prefix": "# " + }, + "h2": { + "prefix": "## " + }, + "h3": { + "prefix": "### " + }, + "h4": { + "prefix": "#### " + }, + "h5": { + "prefix": "##### " + }, + "h6": { + "prefix": "###### " + }, + "text": {}, + "strikethrough": { + "block_prefix": "~~", + "block_suffix": "~~" + }, + "emph": { + "block_prefix": "*", + "block_suffix": "*" + }, + "strong": { + "block_prefix": "**", + "block_suffix": "**" + }, + "hr": { + "format": "\n--------\n" + }, + "item": { + "block_prefix": "• " + }, + "enumeration": { + "block_prefix": ". " + }, + "task": { + "ticked": "[✓] ", + "unticked": "[ ] " + }, + "link": {}, + "link_text": {}, + "image": {}, + "image_text": { + "format": "Image: {{.text}} →" + }, + "code": { + "block_prefix": "`", + "block_suffix": "`" + }, + "code_block": { + "margin": 2 + }, + "table": { + "center_separator": "┼", + "column_separator": "│", + "row_separator": "─" + }, + "definition_list": {}, + "definition_term": {}, + "definition_description": { + "block_prefix": "\n🠶 " + }, + "html_block": {}, + "html_span": {} +} diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 0e94c159c..b9de81eec 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -5,41 +5,29 @@ set ifs "\n" set scrolloff 10 set icons set period 1 -set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set hiddenfiles ".*" set previewer ~/.config/lf/preview set cleaner ~/.config/lf/clean -# source directory shortcuts -source "~/.config/lf/shortcutrc" 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) setsid -f zathura $fx >/dev/null 2>&1 ;; - text/*|application/json|inode/x-empty) $EDITOR $fx;; - image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; - 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 ;; - *.tar.bz|*.tar.bz2|*.tbz|*.tbz2|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.zip|*.rar|*.iso) - mntdir="$f-archivemount" - [ ! -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 setsid -f $OPENER $f >/dev/null 2>&1; done;; + 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;; + image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; + 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 }} @@ -181,7 +169,7 @@ cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -selection c # Bindings map $lf -remote "send $id select '$(fzf)'" -map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-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 D trash map delete map E extract @@ -211,7 +199,7 @@ map down map up map V push :!$EDITOR -map gb :git_branch -map gp ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}} -map gs ${{clear; git status; echo "press ENTER"; read ENTER}} -map gl ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}} +map $lazygit + +# source directory shortcuts +source "~/.config/lf/shortcutrc" diff --git a/.config/lf/pistol b/.config/lf/pistol deleted file mode 100755 index 3f37aee27..000000000 Binary files a/.config/lf/pistol and /dev/null differ diff --git a/.config/lf/preview b/.config/lf/preview index ed9465a65..79b983804 100755 --- a/.config/lf/preview +++ b/.config/lf/preview @@ -15,7 +15,12 @@ video() { h=$3 x=$4 y=$5 - kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$(~/.config/lf/vidthumb "$file")" + thumb="$(vidthumb "$file")" + if [ "$thumb" != "" ]; then + kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$thumb" + exit 1 + fi + mediainfo "$file" exit 1 } @@ -34,60 +39,35 @@ batorcat() { 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 - *.tgz|*.tar.gz) tar tzf "$1" ;; - *.tar.bz2|*.tbz2) tar tjf "$1" ;; - *.tar.txz|*.txz) xz --list "$1" ;; - *.tar) tar tf "$1" ;; - *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;; - *.rar) unrar l "$1" ;; - *.md) glow -s dark "$1" ;; - *.7z) 7z l "$1" ;; - *.[1-8]) man "$1" | col -b ;; - *.o) nm "$1";; - *.torrent) transmission-show "$1" ;; - *.iso) iso-info --no-header -l "$1" ;; - *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; - *.doc) catdoc "$1" ;; - *.docx) docx2txt "$1" - ;; - *.xml|*.html) w3m -dump "$1";; - *.xls|*.xlsx) - ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv - ;; - *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) - exiftool "$1" - ;; - *.pdf) - [ ! -f "${CACHE}.jpg" ] && \ - pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" - image "${CACHE}.jpg" "$2" "$3" "$4" "$5" - ;; - *.epub) - [ ! -f "$CACHE" ] && \ - epub-thumbnailer "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.cbz|*.cbr|*.cbt) - [ ! -f "$CACHE" ] && \ - comicthumb "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) - video "$1" "$2" "$3" "$4" "$5" - ;; - *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif) - image "$1" "$2" "$3" "$4" "$5" - ;; - *.svg) - [ ! -f "${CACHE}.jpg" ] && \ - convert "$1" "${CACHE}.jpg" - image "${CACHE}.jpg" "$2" "$3" "$4" "$5" - ;; - *.ino|*.c|*.php|*.py) - batorcat "$1" - ;; - *) - ~/.config/lf/pistol "$1" - ;; + *.md) glow "$1" && exit 0 ;; + *.xml|*.html) w3m -dump "$1" && exit 0 ;; + *.[1-8]) man "$1" | col -b && exit 0 ;; + *.o) nm "$1" && exit 0 ;; +esac + +case "$(file -bL --mime-type $1)" in + application/gzip) tar tzf "$1" ;; + application/x-bzip2) tar tjf "$1" ;; + application/x-xz) xz --list "$1" ;; + application/x-tar) tar tf "$1" ;; + application/zip) unzip -l "$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" ;; + video/*) video "$1" "$2" "$3" "$4" "$5" ;; + *opendocument*) odt2txt "$1" ;; + text/*|*/xml|application/json) batorcat "$1" ;; + */pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;; + *) mediainfo "$1" || exit 1 ;; esac exit 0 - diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs deleted file mode 100644 index 5a28707c3..000000000 --- a/.config/user-dirs.dirs +++ /dev/null @@ -1 +0,0 @@ -XDG_DESKTOP_DIR="$HOME/" diff --git a/.gitconfig b/.gitconfig index 1cf5be863..ba342b56d 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,5 +1,2 @@ [include] - path = ~/.gitconfig.local - -[credential] - helper = store + path = ~/.config/git/gitconfig diff --git a/.gitignore b/.gitignore index 2a01fb935..70b65d805 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .config/lvim/plugin/packer_compiled.lua +.config/pulse/ +.config/git/ diff --git a/.config/lf/vidthumb b/.local/bin/vidthumb similarity index 89% rename from .config/lf/vidthumb rename to .local/bin/vidthumb index 878e9685d..72143d0b0 100755 --- a/.config/lf/vidthumb +++ b/.local/bin/vidthumb @@ -1,10 +1,11 @@ #!/usr/bin/env bash +# Script to generate thumbnails for lf if ! [ -f "$1" ]; then exit 1 fi -cache="$HOME/.cache/vidthumb" +cache="${XDG_CACHE_HOME:-$HOME/.cache}/lf" index="$cache/index.json" movie="$(realpath "$1")" diff --git a/.local/share/zsh/plugins/autopyenv/autopyenv.plugin.zsh b/.local/share/zsh/plugins/autopyenv/autopyenv.plugin.zsh index ede1910a8..9de6bd19a 100644 --- a/.local/share/zsh/plugins/autopyenv/autopyenv.plugin.zsh +++ b/.local/share/zsh/plugins/autopyenv/autopyenv.plugin.zsh @@ -1,4 +1,4 @@ -PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/pyenvs}" +PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv}" function chpwd_activate(){ for pydir in $(ls $PYENV_DIR); do if [[ $(pwd|sed -e s@/@_@g) =~ "^$pydir$" ]]; then