Compare commits

...

18 commits
master ... rita

Author SHA1 Message Date
d333116d7d
Fix vim options 2024-02-06 18:14:28 +01:00
965308c321
Fix man completion 2024-02-06 18:14:10 +01:00
9b965fac00
Do not use antibody 2024-02-06 18:13:54 +01:00
cd774a8e59
Add zprof 2024-02-06 18:13:18 +01:00
99d7306c08
gitignore 2023-05-08 23:59:33 +02:00
5a125aeecd
Switch to powerlevel10k 2023-05-08 23:57:04 +02:00
026c7f42fb
Reenable antidote 2023-05-08 23:56:29 +02:00
c80e99245a
Fix update_antidote 2023-05-08 23:55:41 +02:00
03b7e4a6a9
Update 2023-05-05 15:37:35 +02:00
771b32ef53
piknik 2022-12-16 16:46:23 +01:00
e62e1687a3
paste.sr.ht 2022-12-16 16:46:10 +01:00
c1ff140bbe
godoc 2022-12-16 16:45:52 +01:00
34a70cac5c
A/I only 2022-12-16 16:45:27 +01:00
7985c5af47
Cosmetic 2022-12-16 16:45:03 +01:00
7bb2ace464
Switch to antidote 2022-10-06 16:35:12 +02:00
ea4ab5403a
Update 2022-01-29 17:24:54 +01:00
8dbf08de1e
Fix certo completion 2021-06-09 11:19:29 +02:00
eb0c7e6162
Fix atuin keybindings 2021-06-09 11:19:15 +02:00
5 changed files with 198 additions and 28 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/compiled /compiled
antidote.plugins.zsh

190
.zshrc
View file

@ -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 ### Source local secrets
[ -f ${HOME}/.config/zsh/secrets ] && . ${HOME}/.config/zsh/secrets [ -f ${HOME}/.config/zsh/secrets ] && . ${HOME}/.config/zsh/secrets
@ -7,20 +18,20 @@ if [ -d "${HOME}/.config/zsh/completions" ]; then
fi fi
### edit cmds ### edit cmds
export VISUAL=vim export VISUAL=nvim
autoload edit-command-line autoload edit-command-line
zle -N edit-command-line zle -N edit-command-line
bindkey "^X^E" edit-command-line bindkey "^X^E" edit-command-line
### antibody ### antibody
autoload -Uz compinit autoload -Uz compinit
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 #. ~/.zsh_plugins.zsh
kitty + complete setup zsh | source /dev/stdin
fi
### fasd ### fasd
@ -68,10 +79,11 @@ fi
if [[ ! -z $TMUX ]]; then if [[ ! -z $TMUX ]]; then
export TERM=tmux-256color export TERM=tmux-256color
export TMUX_BASE=$(tmux display -p '#{pane_current_path}')
fi fi
## Editor ## Editor
export EDITOR=vim export EDITOR=nvim
## Locale ## Locale
export LANG=.UTF-8 export LANG=.UTF-8
@ -122,9 +134,9 @@ alias lh="ls -lh"
alias la="ls -la" alias la="ls -la"
alias ll="ls -l" alias ll="ls -l"
alias lrt="ls -lrt" 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 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 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 pikbrowse="pikaur -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pikaur -Qil {} | less)'"
alias vf="cd \$(git rev-parse --show-toplevel)" alias vf="cd \$(git rev-parse --show-toplevel)"
@ -140,8 +152,9 @@ export DRONE_TOKEN=${drone_token}
fpath+=/usr/share/git/completion fpath+=/usr/share/git/completion
## mailbundle ## mailbundle
export MAILDIR="${HOME}/Mail"
alias mutt="neomutt" alias mutt="neomutt"
alias mailbundle="/opt/mailbundle/config/bin/autorun" alias mailbundle="${MAILDIR}/mailbundle/config/bin/autorun"
## torbrowser ## torbrowser
export PATH=/opt/tor-browser_en-US:$PATH 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 export PATH=/opt/android-sdk/platform-tools:$PATH
## Custom functions ## Custom functions
function lookhosts { function ,lookhosts {
if which rg 2>&1 > /dev/null; then if which rg 2>&1 > /dev/null; then
GREP=rg GREP=rg
else else
@ -159,11 +172,7 @@ function lookhosts {
${GREP} $@ /etc/hosts ${GREP} $@ /etc/hosts
} }
function reload_work_gpg { function ,sway-screens {
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 screens=$(swaymsg -t get_outputs -r)
local show_active local show_active
local show_inactive local show_inactive
@ -242,7 +251,7 @@ function sway-screens {
fi fi
} }
urlencode() { function ,urlencode() {
# urlencode <string> # urlencode <string>
old_lc_collate=$LC_COLLATE old_lc_collate=$LC_COLLATE
@ -267,9 +276,20 @@ urldecode() {
printf '%b' "${url_encoded//%/\\x}" printf '%b' "${url_encoded//%/\\x}"
} }
ce() {
if [ "z$TMUX" != "z" ] && [ "z$TMUX_BASE" != "z" ] ; then
cd $()
cd $TMUX_BASE
else
cd
fi
}
## Custom completion ## Custom completion
# certo # certo
eval "$(_CERTO_COMPLETE=source_zsh certo)" if which certo > /dev/null; then
eval "$(_CERTO_COMPLETE=source_zsh certo)"
fi
## powerline ## powerline
@ -280,11 +300,7 @@ fi
## Colored manual ## Colored manual
function _man() { alias man="env PAGER=\"bat -l man -p\" man"
man $@ | bat -p --language="man"
}
alias man="_man"
## Local only ## Local only
@ -292,6 +308,132 @@ if [ -f ${HOME}/.zshrc.local ]; then
. ${HOME}/.zshrc.local . ${HOME}/.zshrc.local
fi 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: # vim: set ft=zsh et sw=0 ts=2 sts=0:

10
antidote.installed.txt Normal file
View 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

View file

@ -1,14 +1,13 @@
ohmyzsh/ohmyzsh path:lib ohmyzsh/ohmyzsh path:lib
ohmyzsh/ohmyzsh path:themes/agnoster.zsh-theme
ohmyzsh/ohmyzsh path:plugins/docker ohmyzsh/ohmyzsh path:plugins/docker
ohmyzsh/ohmyzsh path:plugins/virtualenv ohmyzsh/ohmyzsh path:plugins/virtualenv
ohmyzsh/ohmyzsh path:plugins/vagrant ohmyzsh/ohmyzsh path:plugins/vagrant
junegunn/fzf path:shell
zsh-users/zsh-autosuggestions
ael-code/zsh-gpg-agent ael-code/zsh-gpg-agent
ael-code/zsh-plugin-fasd-fzf ael-code/zsh-plugin-fasd-fzf
gangleri/pipenv gangleri/pipenv
leophys/zsh-plugin-fzf-finder leophys/zsh-plugin-fzf-finder
bobthecow/git-flow-completion bobthecow/git-flow-completion
zsh-users/zsh-autosuggestions
junegunn/fzf
wfxr/forgit wfxr/forgit
romkatv/powerlevel10k

18
update_antidote.sh Executable file
View 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