Compare commits
29 commits
Author | SHA1 | Date | |
---|---|---|---|
a10c7e07ee | |||
958a3b4b1c | |||
73b59f6005 | |||
d56bb87479 | |||
48569c7781 | |||
26a96cbcd9 | |||
3ff115320c | |||
1db9e9af20 | |||
9f31eb8183 | |||
ecbe93f3b3 | |||
cfd6ccee3b | |||
6003f7b93e | |||
8838e4f3e0 | |||
ea4d127103 | |||
0299dab15e | |||
5a125aeecd | |||
026c7f42fb | |||
c80e99245a | |||
c36010b775 | |||
03b7e4a6a9 | |||
771b32ef53 | |||
e62e1687a3 | |||
c1ff140bbe | |||
34a70cac5c | |||
7985c5af47 | |||
7bb2ace464 | |||
ea4ab5403a | |||
8dbf08de1e | |||
eb0c7e6162 |
12 changed files with 4515 additions and 323 deletions
298
.zshrc
298
.zshrc
|
@ -1,297 +1,13 @@
|
|||
### Source local secrets
|
||||
[ -f ${HOME}/.config/zsh/secrets ] && . ${HOME}/.config/zsh/secrets
|
||||
|
||||
## local completions
|
||||
if [ -d "${HOME}/.config/zsh/completions" ]; then
|
||||
export fpath=(${HOME}/.config/zsh/completions "${fpath[@]}")
|
||||
fi
|
||||
|
||||
### edit cmds
|
||||
export VISUAL=vim
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^X^E" edit-command-line
|
||||
### antibody
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
. ${HOME}/.config/zsh/antibody.zsh
|
||||
|
||||
### KiTTY completion
|
||||
|
||||
if which kitty > /dev/null; then
|
||||
kitty + complete setup zsh | source /dev/stdin
|
||||
fi
|
||||
|
||||
### fasd
|
||||
|
||||
if which fasd > /dev/null; then
|
||||
eval "$(fasd --init auto)"
|
||||
unalias sd
|
||||
fi
|
||||
|
||||
### Pipenv
|
||||
|
||||
if which pipenv > /dev/null; then
|
||||
if [ -f ${HOME}/.config/zsh/pipenv.zsh ]; then
|
||||
eval "$(cat ${HOME}/.config/zsh/pipenv.zsh)"
|
||||
if [[ $TTY == *tty* ]]; then
|
||||
source ${HOME}/.zshrc.tty
|
||||
else
|
||||
eval "$(pipenv --completion)"
|
||||
fi
|
||||
source ${HOME}/.zshrc.graphic
|
||||
fi
|
||||
|
||||
### virtualenvwrapper
|
||||
|
||||
if [ -f /usr/bin/virtualenvwrapper_lazy.sh ]; then
|
||||
source /usr/bin/virtualenvwrapper_lazy.sh
|
||||
if [[ -f ${HOME}/.zshrc.local ]]; then
|
||||
source ${HOME}/.zshrc.local
|
||||
fi
|
||||
|
||||
|
||||
### FZF
|
||||
|
||||
[ -f ${HOME}/.config/zsh/fzf.zsh ] && . ${HOME}/.config/zsh/fzf.zsh
|
||||
|
||||
### ASDF
|
||||
|
||||
if [ -d /opt/asdf-vm ]; then
|
||||
. /opt/asdf-vm/asdf.sh
|
||||
if [[ -f ${HOME}/.zshrc.koyeb ]]; then
|
||||
source ${HOME}/.zshrc.koyeb
|
||||
fi
|
||||
|
||||
### Misc
|
||||
|
||||
## TERM
|
||||
# Many target machines do not understand TERM=xterm-kitty
|
||||
if [ "z${TMUX}" = "z" ]; then
|
||||
function ssh {
|
||||
TERM=xterm-color /bin/ssh ${@}
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ ! -z $TMUX ]]; then
|
||||
export TERM=tmux-256color
|
||||
fi
|
||||
|
||||
## Editor
|
||||
export EDITOR=vim
|
||||
|
||||
## Locale
|
||||
export LANG=.UTF-8
|
||||
export LANGUAGE=en_US
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export LC_NUMERIC=en_US.UTF-8
|
||||
export LC_TIME=it_IT.UTF-8
|
||||
export LC_COLLATE=en_US.UTF-8
|
||||
export LC_MONETARY=it_IT.UTF-8
|
||||
export LC_MESSAGES=en_US.UTF-8
|
||||
export LC_PAPER=it_IT.UTF-8
|
||||
export LC_NAME=en_US.UTF-8
|
||||
export LC_ADDRESS=en_US.UTF-8
|
||||
export LC_TELEPHONE=en_US.UTF-8
|
||||
export LC_MEASUREMENT=it_IT.UTF-8
|
||||
export LC_IDENTIFICATION=en_US.UTF-8
|
||||
export LC_ALL=
|
||||
|
||||
## Flutter && Dart
|
||||
export ANDROID_SDK=${HOME}/Android/Sdk
|
||||
export PATH=${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:$PATH
|
||||
export PATH=/opt/flutter/bin/:"$HOME/.pub-cache/bin":$PATH
|
||||
export CHROME_EXECUTABLE=/usr/bin/chromium
|
||||
|
||||
## Go
|
||||
export GOPATH=${HOME}/.go
|
||||
export PATH=${GOPATH}/bin:$PATH
|
||||
|
||||
## Ruby
|
||||
#export PATH=${PATH}:/home/leo/.gem/ruby/2.7.0/bin
|
||||
|
||||
## Elixir
|
||||
export ERL_AFLAGS="-kernel shell_history enabled"
|
||||
|
||||
## Python
|
||||
PYTHON_VERSION=$(python -c 'import sys; print("{}.{}".format(*sys.version_info[0:2]))')
|
||||
|
||||
## Aliases
|
||||
alias t="tmux -2"
|
||||
alias sy="systemctl"
|
||||
alias ssy="sudo systemctl"
|
||||
alias syu="systemctl --user"
|
||||
alias sl="cmatrix -b -s"
|
||||
alias cd..="cmatrix -b -s -C yellow"
|
||||
alias lt="ls -lt"
|
||||
alias l="ls -1"
|
||||
alias lh="ls -lh"
|
||||
alias la="ls -la"
|
||||
alias ll="ls -l"
|
||||
alias lrt="ls -lrt"
|
||||
alias wgpg="gpg --homedir /home/leo/.gnupg-work"
|
||||
alias agpg="gpg --homedir /home/leo/.gnupg-ai"
|
||||
alias ai_all="cat ${HOME}/Documents/personal/ai/code/prod/hosts.yml|yq '[.hosts|to_entries[]|{"key": .key, "value": .value.groups}]|from_entries'"
|
||||
alias pacbrowse="pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'"
|
||||
alias pikbrowse="pikaur -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pikaur -Qil {} | less)'"
|
||||
alias vf="cd \$(git rev-parse --show-toplevel)"
|
||||
alias vvf="cd \$(${HOME}/.bin/vvf.sh)"
|
||||
alias vim="vim -T xterm"
|
||||
|
||||
## Drone CLI
|
||||
|
||||
export DRONE_SERVER=https://drone.troubles.io
|
||||
export DRONE_TOKEN=${drone_token}
|
||||
|
||||
# ensure Git completion
|
||||
fpath+=/usr/share/git/completion
|
||||
|
||||
## mailbundle
|
||||
alias mutt="neomutt"
|
||||
alias mailbundle="/opt/mailbundle/config/bin/autorun"
|
||||
|
||||
## torbrowser
|
||||
export PATH=/opt/tor-browser_en-US:$PATH
|
||||
|
||||
## platform-tools
|
||||
export PATH=/opt/android-sdk/platform-tools:$PATH
|
||||
|
||||
## Custom functions
|
||||
function lookhosts {
|
||||
if which rg 2>&1 > /dev/null; then
|
||||
GREP=rg
|
||||
else
|
||||
GREP=grep
|
||||
fi
|
||||
${GREP} $@ /etc/hosts
|
||||
}
|
||||
|
||||
function reload_work_gpg {
|
||||
kill -9 $(ps aux|egrep "gpg-agent.*work"|grep -v grep|awk '{print $2}')
|
||||
}
|
||||
|
||||
function sway-screens {
|
||||
local screens=$(swaymsg -t get_outputs -r)
|
||||
local show_active
|
||||
local show_inactive
|
||||
local var_style="plain"
|
||||
local active_screens=()
|
||||
local inactive_screens=()
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-a|--active)
|
||||
show_active=1
|
||||
;;
|
||||
-n|--inactive)
|
||||
show_inactive=1
|
||||
;;
|
||||
-s|--style)
|
||||
case $2 in
|
||||
json)
|
||||
var_style="json"
|
||||
;;
|
||||
plain)
|
||||
;;
|
||||
*)
|
||||
echo "unknown style ${2}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "z${show_active}" != "z" ]; then
|
||||
for s in $(echo $screens|jq -r '.[] | select(.active) | .name'); do
|
||||
active_screens+=($s)
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "z${show_inactive}" != "z" ]; then
|
||||
for s in $(echo $screens|jq -r '.[] | select(.active|not) | .name'); do
|
||||
inactive_screens+=($s)
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${var_style}" = "plain" ]; then
|
||||
if [ ${#active_screens[@]} -gt 0 ]; then
|
||||
echo "ACTIVE=${active_screens[@]}"
|
||||
fi
|
||||
if [ ${#inactive_screens[@]} -gt 0 ]; then
|
||||
echo "INACTIVE=${inactive_screens[@]}"
|
||||
fi
|
||||
else
|
||||
local active=""
|
||||
for s in $active_screens; do
|
||||
active+="\"$s\","
|
||||
done
|
||||
active=${active%,}
|
||||
|
||||
local inactive=""
|
||||
for s in $inactive_screens; do
|
||||
inactive+="\"$s\","
|
||||
done
|
||||
inactive=${inactive%,}
|
||||
|
||||
local content=""
|
||||
if [ "z${show_active}" != "z" ]; then
|
||||
content+="\"active\": [${active}],"
|
||||
fi
|
||||
if [ "z${show_inactive}" != "z" ]; then
|
||||
content+="\"inactive\": [${inactive}],"
|
||||
fi
|
||||
content=${content%,}
|
||||
|
||||
echo "{${content}}" | jq
|
||||
fi
|
||||
}
|
||||
|
||||
urlencode() {
|
||||
# urlencode <string>
|
||||
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:$i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
urldecode() {
|
||||
# urldecode <string>
|
||||
|
||||
local url_encoded="${1//+/ }"
|
||||
printf '%b' "${url_encoded//%/\\x}"
|
||||
}
|
||||
|
||||
## Custom completion
|
||||
# certo
|
||||
eval "$(_CERTO_COMPLETE=source_zsh certo)"
|
||||
|
||||
## powerline
|
||||
|
||||
if which powerline-daemon > /dev/null; then
|
||||
powerline-daemon -q
|
||||
. /usr/lib/python${PYTHON_VERSION}/site-packages/powerline/bindings/zsh/powerline.zsh
|
||||
fi
|
||||
|
||||
## Colored manual
|
||||
|
||||
function _man() {
|
||||
man $@ | bat -p --language="man"
|
||||
}
|
||||
|
||||
alias man="_man"
|
||||
|
||||
## Local only
|
||||
|
||||
if [ -f ${HOME}/.zshrc.local ]; then
|
||||
. ${HOME}/.zshrc.local
|
||||
fi
|
||||
|
||||
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
|
444
.zshrc.graphic
Normal file
444
.zshrc.graphic
Normal file
|
@ -0,0 +1,444 @@
|
|||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
### Source local secrets
|
||||
[ -f ${HOME}/.config/zsh/secrets ] && . ${HOME}/.config/zsh/secrets
|
||||
|
||||
## local completions
|
||||
if [ -d "${HOME}/.config/zsh/completions" ]; then
|
||||
export fpath=(${HOME}/.config/zsh/completions "${fpath[@]}")
|
||||
fi
|
||||
|
||||
### edit cmds
|
||||
export VISUAL=vim
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^X^E" edit-command-line
|
||||
### antibody
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
. ${HOME}/.config/zsh/antibody.zsh
|
||||
|
||||
### antidote
|
||||
. ~/.antidote/antidote.zsh
|
||||
antidote load
|
||||
|
||||
#. ~/.zsh_plugins.zsh
|
||||
|
||||
# bash compat
|
||||
autoload -U +X bashcompinit
|
||||
bashcompinit
|
||||
|
||||
### fasd
|
||||
|
||||
if which fasd > /dev/null; then
|
||||
eval "$(fasd --init auto)"
|
||||
unalias sd
|
||||
fi
|
||||
|
||||
### Pipenv
|
||||
|
||||
if which pipenv > /dev/null; then
|
||||
if [ -f ${HOME}/.config/zsh/pipenv.zsh ]; then
|
||||
eval "$(cat ${HOME}/.config/zsh/pipenv.zsh)"
|
||||
else
|
||||
eval "$(pipenv --completion)"
|
||||
fi
|
||||
fi
|
||||
|
||||
### virtualenvwrapper
|
||||
|
||||
if [ -f /usr/bin/virtualenvwrapper_lazy.sh ]; then
|
||||
source /usr/bin/virtualenvwrapper_lazy.sh
|
||||
fi
|
||||
|
||||
|
||||
### FZF
|
||||
|
||||
[ -f ${HOME}/.config/zsh/fzf.zsh ] && . ${HOME}/.config/zsh/fzf.zsh
|
||||
|
||||
### ASDF
|
||||
|
||||
if [ -d /opt/asdf-vm ]; then
|
||||
. /opt/asdf-vm/asdf.sh
|
||||
fi
|
||||
|
||||
### Misc
|
||||
|
||||
## TERM
|
||||
# Many target machines do not understand TERM=xterm-kitty
|
||||
if [ "z${TMUX}" = "z" ]; then
|
||||
function ssh {
|
||||
TERM=xterm-color /bin/ssh ${@}
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ ! -z $TMUX ]]; then
|
||||
export TERM=tmux-256color
|
||||
export TMUX_BASE=$(tmux display -p '#{pane_current_path}')
|
||||
fi
|
||||
|
||||
## Editor
|
||||
export EDITOR=vim
|
||||
|
||||
## Locale
|
||||
export LANG=en_US.UTF-8
|
||||
export LANGUAGE=en_US
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
export LC_NUMERIC=en_US.UTF-8
|
||||
export LC_TIME=it_IT.UTF-8
|
||||
export LC_COLLATE=en_US.UTF-8
|
||||
export LC_MONETARY=it_IT.UTF-8
|
||||
export LC_MESSAGES=en_US.UTF-8
|
||||
export LC_PAPER=it_IT.UTF-8
|
||||
export LC_NAME=en_US.UTF-8
|
||||
export LC_ADDRESS=en_US.UTF-8
|
||||
export LC_TELEPHONE=en_US.UTF-8
|
||||
export LC_MEASUREMENT=it_IT.UTF-8
|
||||
export LC_IDENTIFICATION=en_US.UTF-8
|
||||
export LC_ALL=
|
||||
|
||||
## Flutter && Dart
|
||||
export ANDROID_SDK=${HOME}/Android/Sdk
|
||||
export PATH=${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:$PATH
|
||||
export PATH=/opt/flutter/bin/:"$HOME/.pub-cache/bin":$PATH
|
||||
export CHROME_EXECUTABLE=/usr/bin/chromium
|
||||
|
||||
## Go
|
||||
export GOPATH=${HOME}/.go
|
||||
export PATH=${GOPATH}/bin:$PATH
|
||||
|
||||
## Ruby
|
||||
#export PATH=${PATH}:/home/leo/.gem/ruby/2.7.0/bin
|
||||
|
||||
## Elixir
|
||||
export ERL_AFLAGS="-kernel shell_history enabled"
|
||||
|
||||
## Python
|
||||
PYTHON_VERSION=$(python -c 'import sys; print("{}.{}".format(*sys.version_info[0:2]))')
|
||||
|
||||
## Aliases
|
||||
alias t="tmux -2"
|
||||
alias sy="systemctl"
|
||||
alias ssy="sudo systemctl"
|
||||
alias syu="systemctl --user"
|
||||
alias sl="cmatrix -b -s"
|
||||
alias cd..="cmatrix -b -s -C yellow"
|
||||
alias lt="ls -lt"
|
||||
alias l="ls -1"
|
||||
alias lh="ls -lh"
|
||||
alias la="ls -la"
|
||||
alias ll="ls -l"
|
||||
alias lrt="ls -lrt"
|
||||
alias wgpg="gpg --homedir /home/leo/.gnupg-sysdig"
|
||||
alias agpg="gpg --homedir /home/leo/.gnupg-ai"
|
||||
alias ai_all="cat ${HOME}/code/ai/prod/hosts.yml|yq '[.hosts|to_entries[]|{"key": .key, "value": .value.groups}]|from_entries'"
|
||||
alias pacbrowse="pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'"
|
||||
alias pikbrowse="pikaur -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pikaur -Qil {} | less)'"
|
||||
alias vf="cd \$(git rev-parse --show-toplevel)"
|
||||
alias vvf="cd \$(${HOME}/.bin/vvf.sh)"
|
||||
alias vim="vim -T xterm"
|
||||
|
||||
## Drone CLI
|
||||
|
||||
export DRONE_SERVER=https://drone.troubles.io
|
||||
export DRONE_TOKEN=${drone_token}
|
||||
|
||||
# ensure Git completion
|
||||
fpath+=/usr/share/git/completion
|
||||
|
||||
## mailbundle
|
||||
export MAILDIR="${HOME}/Mail"
|
||||
alias mutt="neomutt"
|
||||
alias mailbundle="${MAILDIR}/mailbundle/config/bin/autorun"
|
||||
|
||||
## torbrowser
|
||||
export PATH=/opt/tor-browser_en-US:$PATH
|
||||
|
||||
## platform-tools
|
||||
export PATH=/opt/android-sdk/platform-tools:$PATH
|
||||
|
||||
## Custom functions
|
||||
function ,lookhosts {
|
||||
if which rg 2>&1 > /dev/null; then
|
||||
GREP=rg
|
||||
else
|
||||
GREP=grep
|
||||
fi
|
||||
${GREP} $@ /etc/hosts
|
||||
}
|
||||
|
||||
function ,sway-screens {
|
||||
local screens=$(swaymsg -t get_outputs -r)
|
||||
local show_active
|
||||
local show_inactive
|
||||
local var_style="plain"
|
||||
local active_screens=()
|
||||
local inactive_screens=()
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-a|--active)
|
||||
show_active=1
|
||||
;;
|
||||
-n|--inactive)
|
||||
show_inactive=1
|
||||
;;
|
||||
-s|--style)
|
||||
case $2 in
|
||||
json)
|
||||
var_style="json"
|
||||
;;
|
||||
plain)
|
||||
;;
|
||||
*)
|
||||
echo "unknown style ${2}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "z${show_active}" != "z" ]; then
|
||||
for s in $(echo $screens|jq -r '.[] | select(.active) | .name'); do
|
||||
active_screens+=($s)
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "z${show_inactive}" != "z" ]; then
|
||||
for s in $(echo $screens|jq -r '.[] | select(.active|not) | .name'); do
|
||||
inactive_screens+=($s)
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${var_style}" = "plain" ]; then
|
||||
if [ ${#active_screens[@]} -gt 0 ]; then
|
||||
echo "ACTIVE=${active_screens[@]}"
|
||||
fi
|
||||
if [ ${#inactive_screens[@]} -gt 0 ]; then
|
||||
echo "INACTIVE=${inactive_screens[@]}"
|
||||
fi
|
||||
else
|
||||
local active=""
|
||||
for s in $active_screens; do
|
||||
active+="\"$s\","
|
||||
done
|
||||
active=${active%,}
|
||||
|
||||
local inactive=""
|
||||
for s in $inactive_screens; do
|
||||
inactive+="\"$s\","
|
||||
done
|
||||
inactive=${inactive%,}
|
||||
|
||||
local content=""
|
||||
if [ "z${show_active}" != "z" ]; then
|
||||
content+="\"active\": [${active}],"
|
||||
fi
|
||||
if [ "z${show_inactive}" != "z" ]; then
|
||||
content+="\"inactive\": [${inactive}],"
|
||||
fi
|
||||
content=${content%,}
|
||||
|
||||
echo "{${content}}" | jq
|
||||
fi
|
||||
}
|
||||
|
||||
function ,urlencode() {
|
||||
# urlencode <string>
|
||||
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:$i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
urldecode() {
|
||||
# urldecode <string>
|
||||
|
||||
local url_encoded="${1//+/ }"
|
||||
printf '%b' "${url_encoded//%/\\x}"
|
||||
}
|
||||
|
||||
ce() {
|
||||
if [ "z$TMUX" != "z" ] && [ "z$TMUX_BASE" != "z" ] ; then
|
||||
cd $()
|
||||
cd $TMUX_BASE
|
||||
else
|
||||
cd
|
||||
fi
|
||||
}
|
||||
|
||||
## Custom completion
|
||||
# certo
|
||||
if which certo > /dev/null; then
|
||||
eval "$(_CERTO_COMPLETE=source_zsh certo)"
|
||||
fi
|
||||
|
||||
## powerline
|
||||
|
||||
if which powerline-daemon > /dev/null; then
|
||||
powerline-daemon -q
|
||||
. /usr/lib/python${PYTHON_VERSION}/site-packages/powerline/bindings/zsh/powerline.zsh
|
||||
fi
|
||||
|
||||
## Colored manual
|
||||
|
||||
function color_man() {
|
||||
man $@ | bat -p --language="man"
|
||||
}
|
||||
|
||||
alias man="color_man"
|
||||
|
||||
## Local only
|
||||
|
||||
if [ -f ${HOME}/.zshrc.local ]; then
|
||||
. ${HOME}/.zshrc.local
|
||||
fi
|
||||
|
||||
### atuin (shell history)
|
||||
export ATUIN_NOBIND="true"
|
||||
eval "$(atuin init zsh)"
|
||||
|
||||
bindkey '^r' _atuin_search_widget
|
||||
|
||||
### broot
|
||||
source /home/leo/.config/broot/launcher/bash/br
|
||||
|
||||
### A/I
|
||||
if [ -f ${HOME}/.zshrc.ai ]; then
|
||||
source ${HOME}/.zshrc.ai
|
||||
fi
|
||||
|
||||
### colored and fuzzy go doc
|
||||
if which bat > /dev/null; then
|
||||
function _godoc() {
|
||||
local PAGE_LANG=go
|
||||
local GO_LANG=go
|
||||
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
|
||||
go doc ${@} | bat -p -l ${PAGE_LANG}
|
||||
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
|
||||
go doc ${@} | bat -p -l ${GO_LANG}
|
||||
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
|
||||
go doc ${@} | bat -p -l ${GO_LANG}
|
||||
else
|
||||
go doc ${@} | bat -p -l ${PAGE_LANG}
|
||||
fi
|
||||
}
|
||||
else
|
||||
function _godoc() {
|
||||
go doc ${@}
|
||||
}
|
||||
fi
|
||||
|
||||
function gomodroot() {
|
||||
. <(go env|grep -E "^GOMOD")
|
||||
echo ${GOMOD%%go.mod}
|
||||
unset GOMOD
|
||||
}
|
||||
|
||||
function _godocbuildcache() {
|
||||
local VERSION="$(go version|awk '{print $3}')"
|
||||
local DOCCACHE="${GODOC_CACHE:-${HOME}/.cache/godoc}/${VERSION}"
|
||||
if [ -d ${DOCCACHE} ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "generating stdlib godoc cache, wait some time" 1>&2
|
||||
|
||||
mkdir -p ${DOCCACHE}
|
||||
for DEP in $(go list std|grep -v -E "internal/"); do
|
||||
go doc -short ${DEP}|sed -e 's/^\ *\(func\|type\|const\|var\)\ \([a-zA-Z0-9]\+\).*/\2/'|xargs -I {} echo ${DEP}.{} 2>/dev/null >> ${DOCCACHE}/stdlib.symbols
|
||||
done
|
||||
|
||||
echo "done generating stdlib godoc cache" 1>&2
|
||||
}
|
||||
|
||||
function _godocenum() {
|
||||
_godocbuildcache
|
||||
local VERSION="$(go version|awk '{print $3}')"
|
||||
local DOCCACHE="${GODOC_CACHE:-${HOME}/.cache/godoc}/${VERSION}"
|
||||
cat ${DOCCACHE}/stdlib.symbols
|
||||
|
||||
for DEP in $(go list -f '{{ join .Deps "\n" }}' $(gomodroot)/...); do
|
||||
for SYM in $(go doc -short ${DEP}|sed -e 's/^\ *\(func\|type\|const\|var\)\ \([a-zA-Z0-9]\+\).*/\2/'); do
|
||||
echo ${DEP}.${SYM}
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function ,godoc() {
|
||||
if [ $# -eq 0 ]; then
|
||||
if which bat > /dev/null; then
|
||||
OBJ=$(_godocenum|fzf --height=80% --info=inline --reverse --border --margin=1 --padding=1 --preview="go doc {1}|bat --color always -p -l go")
|
||||
else
|
||||
OBJ=$(_godocenum|fzf --height=80% --info=inline --reverse --border --margin=1 --padding=1 --preview="go doc {1}")
|
||||
fi
|
||||
_godoc ${OBJ}
|
||||
else
|
||||
_godoc ${@}
|
||||
fi
|
||||
}
|
||||
|
||||
### paste.sr.ht
|
||||
|
||||
function ,pasteit() {
|
||||
hut paste create ${@}
|
||||
}
|
||||
|
||||
### piknik
|
||||
|
||||
# pko <content> : copy <content> to the clipboard
|
||||
function ,pko() {
|
||||
echo "$*" | piknik -copy
|
||||
}
|
||||
|
||||
# pkf <file> : copy the content of <file> to the clipboard
|
||||
function ,pkf() {
|
||||
piknik -copy < $1
|
||||
}
|
||||
|
||||
# pkc : read the content to copy to the clipboard from STDIN
|
||||
alias ,pkc='piknik -copy'
|
||||
|
||||
# pkp : paste the clipboard content
|
||||
alias ,pkp='piknik -paste'
|
||||
|
||||
# pkm : move the clipboard content
|
||||
alias ,pkm='piknik -move'
|
||||
|
||||
# pkz : delete the clipboard content
|
||||
alias ,pkz='piknik -copy < /dev/null'
|
||||
|
||||
# pkfr [<dir>] : send a whole directory to the clipboard, as a tar archive
|
||||
function ,pkfr() {
|
||||
tar czpvf - ${1:-.} | piknik -copy
|
||||
}
|
||||
|
||||
# pkpr : extract clipboard content sent using the pkfr command
|
||||
alias ,pkpr='piknik -paste | tar xzpvf -'
|
||||
|
||||
### zoxide
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
3957
.zshrc.tty
Normal file
3957
.zshrc.tty
Normal file
File diff suppressed because it is too large
Load diff
10
antidote.installed.txt
Normal file
10
antidote.installed.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
https://github.com/ael-code/zsh-gpg-agent /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-gpg-agent
|
||||
https://github.com/ael-code/zsh-plugin-fasd-fzf /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-plugin-fasd-fzf
|
||||
https://github.com/bobthecow/git-flow-completion /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-bobthecow-SLASH-git-flow-completion
|
||||
https://github.com/gangleri/pipenv /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-gangleri-SLASH-pipenv
|
||||
https://github.com/junegunn/fzf /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-junegunn-SLASH-fzf
|
||||
https://github.com/leophys/zsh-plugin-fzf-finder /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-leophys-SLASH-zsh-plugin-fzf-finder
|
||||
https://github.com/ohmyzsh/ohmyzsh /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh
|
||||
https://github.com/wahtique/zsh-plugin-fzf-finder /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-wahtique-SLASH-zsh-plugin-fzf-finder
|
||||
https://github.com/wfxr/forgit /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-wfxr-SLASH-forgit
|
||||
https://github.com/zsh-users/zsh-autosuggestions /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions
|
|
@ -1,14 +1,13 @@
|
|||
ohmyzsh/ohmyzsh path:lib
|
||||
ohmyzsh/ohmyzsh path:themes/agnoster.zsh-theme
|
||||
ohmyzsh/ohmyzsh path:plugins/docker
|
||||
ohmyzsh/ohmyzsh path:plugins/virtualenv
|
||||
ohmyzsh/ohmyzsh path:plugins/vagrant
|
||||
|
||||
junegunn/fzf path:shell
|
||||
zsh-users/zsh-autosuggestions
|
||||
ael-code/zsh-gpg-agent
|
||||
ael-code/zsh-plugin-fasd-fzf
|
||||
gangleri/pipenv
|
||||
leophys/zsh-plugin-fzf-finder
|
||||
bobthecow/git-flow-completion
|
||||
zsh-users/zsh-autosuggestions
|
||||
junegunn/fzf
|
||||
wfxr/forgit
|
||||
romkatv/powerlevel10k
|
47
antidote.plugins.zsh
Normal file
47
antidote.plugins.zsh
Normal file
|
@ -0,0 +1,47 @@
|
|||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/bzr.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/clipboard.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/cli.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/compfix.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/completion.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/correction.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/diagnostics.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/directories.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/functions.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/git.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/grep.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/history.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/key-bindings.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/misc.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/nvm.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/prompt_info_functions.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/spectrum.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/termsupport.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/theme-and-appearance.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/lib/vcs_info.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/docker )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/docker/docker.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/virtualenv )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/virtualenv/virtualenv.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/vagrant )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/vagrant/vagrant.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-junegunn-SLASH-fzf/shell )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-junegunn-SLASH-fzf/shell/completion.zsh
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-junegunn-SLASH-fzf/shell/key-bindings.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-gpg-agent )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-gpg-agent/gpg-agent.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-plugin-fasd-fzf )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ael-code-SLASH-zsh-plugin-fasd-fzf/fasd-fzf.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-gangleri-SLASH-pipenv )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-gangleri-SLASH-pipenv/pipenv.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-leophys-SLASH-zsh-plugin-fzf-finder )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-leophys-SLASH-zsh-plugin-fzf-finder/fzf-finder.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-bobthecow-SLASH-git-flow-completion )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-bobthecow-SLASH-git-flow-completion/git-flow-completion.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-wfxr-SLASH-forgit )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-wfxr-SLASH-forgit/forgit.plugin.zsh
|
||||
fpath+=( /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k )
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k/powerlevel10k.zsh-theme
|
||||
source /home/leo/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k/powerlevel9k.zsh-theme
|
12
install.sh
Executable file
12
install.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
|
||||
for SCRIPT in update_*; do
|
||||
./${SCRIPT}
|
||||
done
|
||||
|
||||
for CONFIG in .zshrc*; do
|
||||
! [ -f ${HOME}/${CONFIG} ] && ln -s $PWD/${CONFIG} ${HOME}/${CONFIG}
|
||||
done
|
||||
|
||||
# vim:set et ts=4 sts=0 sw=0 ft=zsh:
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
echo "Updating antibody cache"
|
||||
|
||||
currpath=$(realpath $PWD)
|
||||
|
||||
if [ ! -d ${currpath}/compiled ]; then
|
||||
mkdir compiled
|
||||
fi
|
||||
|
||||
antibody_bin=$(which antibody)
|
||||
if [ "z${antibody_bin}" = "z" ]; then
|
||||
echo "Error: you need to install antibody first!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${antibody_bin} bundle < ${currpath}/antibody.plugins.txt > ${currpath}/compiled/antibody.zsh
|
||||
if [ ! -d ~/.config/zsh ]; then
|
||||
mkdir -p ~/.config/zsh
|
||||
fi
|
||||
cp ${currpath}/compiled/antibody.zsh ~/.config/zsh/
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
19
update_antidote.sh
Executable file
19
update_antidote.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env zsh
|
||||
echo "=> Updating antidote"
|
||||
|
||||
! [[ -z $DEBUG ]] && set -x
|
||||
|
||||
# clone antidote if necessary
|
||||
if [[ -d ~/.antidote ]]; then
|
||||
git -C ~/.antidote pull
|
||||
else
|
||||
git clone https://github.com/mattmc3/antidote.git ~/.antidote
|
||||
fi
|
||||
|
||||
# source antidote
|
||||
. ~/.antidote/antidote.zsh
|
||||
|
||||
# generate static plugins
|
||||
antidote bundle < antidote.plugins.txt > antidote.plugins.zsh
|
||||
|
||||
[[ -f ~/.zsh_plugins.zsh ]] || ln -s $PWD/antidote.plugins.zsh ~/.zsh_plugins.zsh
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
echo "Updating fzf"
|
||||
echo "=> Updating fzf"
|
||||
|
||||
currpath=$(realpath $PWD)
|
||||
|
||||
|
@ -16,4 +16,4 @@ if [ ! -d ~/.config/zsh ]; then
|
|||
fi
|
||||
cp ${currpath}/fzf.zsh ${HOME}/.config/zsh/
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
|
10
update_grml_zsh.sh
Executable file
10
update_grml_zsh.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env zsh
|
||||
echo "=> Updating grml zsh config"
|
||||
|
||||
curl --fail \
|
||||
-L \
|
||||
--output /tmp/.zshrc.tty \
|
||||
https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc \
|
||||
&& mv /tmp/.zshrc.tty .zshrc.tty
|
||||
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
echo "Updating pipenv completion"
|
||||
echo "=> Updating pipenv completion"
|
||||
|
||||
currpath=$(realpath $PWD)
|
||||
|
||||
|
@ -13,10 +13,10 @@ if [ $? -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
pipenv --completion > ${currpath}/compiled/pipenv.zsh
|
||||
_PIPENV_COMPLETE=zsh_source pipenv > ${currpath}/compiled/pipenv.zsh
|
||||
if [ ! -d ~/.config/zsh ]; then
|
||||
mkdir -p ~/.config/zsh
|
||||
fi
|
||||
cp ${currpath}/compiled/pipenv.zsh ~/.config/zsh/pipenv.zsh
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
|
Loading…
Reference in a new issue