Compare commits
18 commits
Author | SHA1 | Date | |
---|---|---|---|
d333116d7d | |||
965308c321 | |||
9b965fac00 | |||
cd774a8e59 | |||
99d7306c08 | |||
5a125aeecd | |||
026c7f42fb | |||
c80e99245a | |||
03b7e4a6a9 | |||
771b32ef53 | |||
e62e1687a3 | |||
c1ff140bbe | |||
34a70cac5c | |||
7985c5af47 | |||
7bb2ace464 | |||
ea4ab5403a | |||
8dbf08de1e | |||
eb0c7e6162 |
5 changed files with 198 additions and 28 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
/compiled
|
||||
antidote.plugins.zsh
|
||||
|
|
190
.zshrc
190
.zshrc
|
@ -1,3 +1,14 @@
|
|||
# Enable profiling
|
||||
if ! [ -z $ZSHDEBUG ]; then
|
||||
zmodload zsh/zprof
|
||||
fi
|
||||
# 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
|
||||
|
||||
|
@ -7,20 +18,20 @@ if [ -d "${HOME}/.config/zsh/completions" ]; then
|
|||
fi
|
||||
|
||||
### edit cmds
|
||||
export VISUAL=vim
|
||||
export VISUAL=nvim
|
||||
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
|
||||
#. ${HOME}/.config/zsh/antibody.zsh
|
||||
|
||||
### KiTTY completion
|
||||
### antidote
|
||||
. ~/.antidote/antidote.zsh
|
||||
antidote load
|
||||
|
||||
if which kitty > /dev/null; then
|
||||
kitty + complete setup zsh | source /dev/stdin
|
||||
fi
|
||||
#. ~/.zsh_plugins.zsh
|
||||
|
||||
### fasd
|
||||
|
||||
|
@ -68,10 +79,11 @@ fi
|
|||
|
||||
if [[ ! -z $TMUX ]]; then
|
||||
export TERM=tmux-256color
|
||||
export TMUX_BASE=$(tmux display -p '#{pane_current_path}')
|
||||
fi
|
||||
|
||||
## Editor
|
||||
export EDITOR=vim
|
||||
export EDITOR=nvim
|
||||
|
||||
## Locale
|
||||
export LANG=.UTF-8
|
||||
|
@ -122,9 +134,9 @@ 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 wgpg="gpg --homedir /home/leo/.gnupg-sysdig"
|
||||
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 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)"
|
||||
|
@ -140,8 +152,9 @@ export DRONE_TOKEN=${drone_token}
|
|||
fpath+=/usr/share/git/completion
|
||||
|
||||
## mailbundle
|
||||
export MAILDIR="${HOME}/Mail"
|
||||
alias mutt="neomutt"
|
||||
alias mailbundle="/opt/mailbundle/config/bin/autorun"
|
||||
alias mailbundle="${MAILDIR}/mailbundle/config/bin/autorun"
|
||||
|
||||
## torbrowser
|
||||
export PATH=/opt/tor-browser_en-US:$PATH
|
||||
|
@ -150,7 +163,7 @@ export PATH=/opt/tor-browser_en-US:$PATH
|
|||
export PATH=/opt/android-sdk/platform-tools:$PATH
|
||||
|
||||
## Custom functions
|
||||
function lookhosts {
|
||||
function ,lookhosts {
|
||||
if which rg 2>&1 > /dev/null; then
|
||||
GREP=rg
|
||||
else
|
||||
|
@ -159,11 +172,7 @@ function lookhosts {
|
|||
${GREP} $@ /etc/hosts
|
||||
}
|
||||
|
||||
function reload_work_gpg {
|
||||
kill -9 $(ps aux|egrep "gpg-agent.*work"|grep -v grep|awk '{print $2}')
|
||||
}
|
||||
|
||||
function sway-screens {
|
||||
function ,sway-screens {
|
||||
local screens=$(swaymsg -t get_outputs -r)
|
||||
local show_active
|
||||
local show_inactive
|
||||
|
@ -242,7 +251,7 @@ function sway-screens {
|
|||
fi
|
||||
}
|
||||
|
||||
urlencode() {
|
||||
function ,urlencode() {
|
||||
# urlencode <string>
|
||||
|
||||
old_lc_collate=$LC_COLLATE
|
||||
|
@ -267,9 +276,20 @@ urldecode() {
|
|||
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
|
||||
eval "$(_CERTO_COMPLETE=source_zsh certo)"
|
||||
if which certo > /dev/null; then
|
||||
eval "$(_CERTO_COMPLETE=source_zsh certo)"
|
||||
fi
|
||||
|
||||
## powerline
|
||||
|
||||
|
@ -280,11 +300,7 @@ fi
|
|||
|
||||
## Colored manual
|
||||
|
||||
function _man() {
|
||||
man $@ | bat -p --language="man"
|
||||
}
|
||||
|
||||
alias man="_man"
|
||||
alias man="env PAGER=\"bat -l man -p\" man"
|
||||
|
||||
## Local only
|
||||
|
||||
|
@ -292,6 +308,132 @@ if [ -f ${HOME}/.zshrc.local ]; then
|
|||
. ${HOME}/.zshrc.local
|
||||
fi
|
||||
|
||||
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
### 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() {
|
||||
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
|
||||
go doc ${@} | bat -p -l md
|
||||
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
|
||||
go doc ${@} | bat -p -l go
|
||||
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
|
||||
go doc ${@} | bat -p -l go
|
||||
else
|
||||
go doc ${@} | bat -p -l md
|
||||
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 -'
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
||||
# Run profiling
|
||||
if ! [ -z $ZSHDEBUG ]; then
|
||||
zprof
|
||||
fi
|
||||
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
|
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
|
18
update_antidote.sh
Executable file
18
update_antidote.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
! [[ -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
|
Loading…
Reference in a new issue