1
0
Fork 0

Merge pull request 'fix' (#1) from fix into main

Reviewed-on: #1
This commit is contained in:
Luca Bilke 2022-08-03 11:39:24 +02:00
commit 2bbaee83f0
11 changed files with 165 additions and 98 deletions

3
.config/bat/config Normal file
View File

@ -0,0 +1,3 @@
--theme="base16"
--paging=never
--style=plain

10
.config/glow/glow.yml Normal file
View File

@ -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

87
.config/glow/notty.json Normal file
View File

@ -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": {}
}

View File

@ -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 <c-f> $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 <c-d> delete
map E extract
@ -211,7 +199,7 @@ map <c-e> down
map <c-y> up
map V push :!$EDITOR<space>
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 <c-g> $lazygit
# source directory shortcuts
source "~/.config/lf/shortcutrc"

Binary file not shown.

View File

@ -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

View File

@ -1 +0,0 @@
XDG_DESKTOP_DIR="$HOME/"

View File

@ -1,5 +1,2 @@
[include]
path = ~/.gitconfig.local
[credential]
helper = store
path = ~/.config/git/gitconfig

2
.gitignore vendored
View File

@ -1 +1,3 @@
.config/lvim/plugin/packer_compiled.lua
.config/pulse/
.config/git/

View File

@ -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")"

View File

@ -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