zsh: zsh-tab goodness
This commit is contained in:
parent
a2d6c90dcb
commit
4b264db471
2 changed files with 55 additions and 0 deletions
46
.lessfilter
Executable file
46
.lessfilter
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
mime=$(file -Lbs --mime-type "$1")
|
||||||
|
category=${mime%%/*}
|
||||||
|
kind=${mime##*/}
|
||||||
|
ext=${1##*.}
|
||||||
|
if [ "$kind" = json ]; then
|
||||||
|
if [ "$(command -v jq)" ]; then
|
||||||
|
jq -Cr . "$1"
|
||||||
|
fi
|
||||||
|
elif [ "$kind" = vnd.sqlite3 ]; then
|
||||||
|
if [ "$(command -v yes)" ] && [ "$(command -v sqlite3)" ] && [ "$(command -v bat)" ]; then
|
||||||
|
yes .q | sqlite3 "$1" | bat --color=always -plsql
|
||||||
|
fi
|
||||||
|
# https://github.com/wofr06/lesspipe/pull/107
|
||||||
|
elif [ -d "$1" ]; then
|
||||||
|
if [ "$(command -v exa)" ]; then
|
||||||
|
exa --git -hl --color=always --icons "$1"
|
||||||
|
fi
|
||||||
|
# https://github.com/wofr06/lesspipe/pull/110
|
||||||
|
elif [ "$kind" = pdf ]; then
|
||||||
|
if [ "$(command -v pdftotext)" ] && [ "$(command -v sed)" ]; then
|
||||||
|
pdftotext -q "$1" - | sed "s/\f/$(hr ─)\n/g"
|
||||||
|
fi
|
||||||
|
# https://github.com/wofr06/lesspipe/pull/115
|
||||||
|
elif [ "$kind" = rfc822 ]; then
|
||||||
|
if [ "$(command -v bat)" ]; then
|
||||||
|
bat --color=always -lEmail "$1"
|
||||||
|
fi
|
||||||
|
# https://github.com/wofr06/lesspipe/pull/106
|
||||||
|
elif [ "$category" = image ]; then
|
||||||
|
if [ "$(command -v chafa)" ]; then
|
||||||
|
chafa -f symbols "$1"
|
||||||
|
fi
|
||||||
|
if [ "$(command -v exiftool)" ]; then
|
||||||
|
exiftool "$1" | bat --color=always -plyaml
|
||||||
|
fi
|
||||||
|
# https://github.com/wofr06/lesspipe/pull/117
|
||||||
|
elif [ "$category" = text ]; then
|
||||||
|
if [ "$(command -v bat)" ]; then
|
||||||
|
bat --color=always "$1"
|
||||||
|
elif [ "$(command -v pygmentize)" ]; then
|
||||||
|
pygmentize "$1" | less
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
9
.zshrc
9
.zshrc
|
@ -19,7 +19,14 @@ zi load zsh-users/zsh-history-substring-search
|
||||||
zi ice wait lucid
|
zi ice wait lucid
|
||||||
zi load Aloxaf/fzf-tab
|
zi load Aloxaf/fzf-tab
|
||||||
zi ice wait lucid
|
zi ice wait lucid
|
||||||
|
zi load Freed-Wu/fzf-tab-source
|
||||||
|
zi ice wait lucid
|
||||||
|
|
||||||
|
## fzf-tab
|
||||||
|
zstyle ':fzf-tab:*' fzf-bindings 'tab:accept'
|
||||||
|
zstyle ':fzf-tab:*' continuous-trigger '/'
|
||||||
|
zstyle ':fzf-tab:*' fzf-min-height 30
|
||||||
|
|
||||||
## History
|
## History
|
||||||
HISTSIZE=50000
|
HISTSIZE=50000
|
||||||
SAVEHIST=50000
|
SAVEHIST=50000
|
||||||
|
@ -106,6 +113,8 @@ export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||||
|
|
||||||
## Pager
|
## Pager
|
||||||
export LESS="--mouse --wheel-lines=1 -nRXF"
|
export LESS="--mouse --wheel-lines=1 -nRXF"
|
||||||
|
export LESSCOLORIZER="bat"
|
||||||
|
export LESSOPEN="|lesspipe.sh %s"
|
||||||
export PAGER="bat"
|
export PAGER="bat"
|
||||||
export BAT_PAGER="less -r"
|
export BAT_PAGER="less -r"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue