Compare commits
2 commits
d285129e15
...
b7511f6efa
Author | SHA1 | Date | |
---|---|---|---|
b7511f6efa | |||
f50ee35f4c |
10 changed files with 247 additions and 160 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/compiled
|
275
.zshrc
275
.zshrc
|
@ -1,146 +1,100 @@
|
|||
source /usr/share/zsh/share/antigen.zsh
|
||||
### antibody
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
. ${HOME}/.config/zsh/antibody.zsh
|
||||
|
||||
antigen use oh-my-zsh
|
||||
antigen theme agnoster
|
||||
### KiTTY completion
|
||||
|
||||
antigen bundle colored-man-pages
|
||||
antigen bundle docker
|
||||
antigen bundle git
|
||||
#antigen bundle tmux
|
||||
antigen bundle virtualenv
|
||||
#antigen bundle virtualenvwrapper
|
||||
|
||||
antigen bundle ael-code/zsh-gpg-agent
|
||||
antigen bundle ael-code/zsh-plugin-fasd-fzf
|
||||
antigen bundle gangleri/pipenv
|
||||
antigen bundle leophys/zsh-plugin-fzf-finder
|
||||
#antigen bundle junegunn/fzf
|
||||
|
||||
|
||||
|
||||
antigen apply
|
||||
|
||||
# User configuration
|
||||
|
||||
# LS_COLORS
|
||||
|
||||
# eval `dircolors /home/leo/Documents/coding/dircolors-solarized/dircolors.ansi-dark`
|
||||
|
||||
# FASD
|
||||
|
||||
eval "$(fasd --init auto)"
|
||||
|
||||
# eval "$(pipenv --completion)"
|
||||
#compdef pipenv
|
||||
_pipenv() {
|
||||
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
|
||||
}
|
||||
if [[ "$(basename ${(%):-%x})" != "_pipenv" ]]; then
|
||||
autoload -U compinit && compinit
|
||||
compdef _pipenv pipenv
|
||||
if which kitty > /dev/null; then
|
||||
kitty + complete setup zsh | source /dev/stdin
|
||||
fi
|
||||
|
||||
### fasd
|
||||
|
||||
## Set SSH to use gpg-agent
|
||||
unset SSH_AGENT_PID
|
||||
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
|
||||
if which fasd > /dev/null; then
|
||||
eval "$(fasd --init auto)"
|
||||
unalias sd
|
||||
fi
|
||||
|
||||
## Node and NVM
|
||||
export NVM_DIR=/home/leo/.nvm
|
||||
function nvm {
|
||||
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||
. "$NVM_DIR/nvm.sh"
|
||||
nvm use system
|
||||
nvm $@
|
||||
fi
|
||||
}
|
||||
### Pipenv
|
||||
|
||||
## Ruby and RVM
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
||||
export PATH=/home/leo/.gem/ruby/2.5.0/bin:$PATH
|
||||
source /home/leo/.rvm/scripts/rvm
|
||||
export rvmsudo_secure_path=1
|
||||
|
||||
# ## Taken from old .zshrc
|
||||
#
|
||||
# dl () {
|
||||
# emulate -L zsh
|
||||
# autoload -U colors
|
||||
# local color=$fg_bold[blue]
|
||||
# integer i=0
|
||||
# dirs -p | while read dir
|
||||
# do
|
||||
# local num="${$(printf "%-4d " $i)/ /.}"
|
||||
# printf " %s $color%s$reset_color\n" $num $dir
|
||||
# (( i++ ))
|
||||
# done
|
||||
# integer dir=-1
|
||||
# read -r 'dir?Jump to directory: ' || return
|
||||
# (( dir == -1 )) && return
|
||||
# if (( dir < 0 || dir >= i ))
|
||||
# then
|
||||
# echo d: no such directory stack entry: $dir
|
||||
# return 1
|
||||
# fi
|
||||
# cd ~$dir
|
||||
# }
|
||||
#
|
||||
# pcat
|
||||
alias pcat='pygmentize -f terminal256 -O style=native -g'
|
||||
|
||||
# Fuckin' TERM env for ssh
|
||||
function ssh {
|
||||
if [[ "${TERM}" = tmux* ]]; then
|
||||
env TERM=xterm /bin/ssh "$@"
|
||||
if which pipenv > /dev/null; then
|
||||
if [ -f ${HOME}/.config/zsh/pipenv.zsh ]; then
|
||||
eval "$(cat ${HOME}/.config/zsh/pipenv.zsh)"
|
||||
else
|
||||
/bin/ssh "$@"
|
||||
eval "$(pipenv --completion)"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
### virtualenvwrapper
|
||||
|
||||
if [ -f /usr/bin/virtualenvwrapper_lazy.sh ]; then
|
||||
source /usr/bin/virtualenvwrapper_lazy.sh
|
||||
fi
|
||||
|
||||
|
||||
## Misc
|
||||
export MANPATH="/usr/local/man:$MANPATH"
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
### FZF
|
||||
|
||||
[ -f ${HOME}/.config/zsh/fzf.zsh ] && . ${HOME}/.config/zsh/fzf.zsh
|
||||
|
||||
### ASDF
|
||||
|
||||
if [ -d /opt/asdf-vm ]; then
|
||||
. /opt/asdf-vm/asdf.sh
|
||||
. /opt/asdf-vm/completions/asdf.bash
|
||||
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
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
## 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=
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# ssh
|
||||
# export SSH_KEY_PATH="~/.ssh/rsa_id"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
## Flutter
|
||||
export PATH=$PATH:/opt/flutter/bin/
|
||||
## Flutter && Dart
|
||||
export ANDROID_SDK=${HOME}/Android/Sdk
|
||||
export PATH=${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:${PATH}
|
||||
export PATH=$PATH:/opt/flutter/bin/:"$HOME/.pub-cache/bin"
|
||||
|
||||
## Go
|
||||
export GOPATH=~/.go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
export GOPATH=${HOME}/.go
|
||||
export PATH=$PATH:${GOPATH}/bin
|
||||
|
||||
## Elixir
|
||||
export ERL_AFLAGS="-kernel shell_history enabled"
|
||||
|
||||
## 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"
|
||||
|
@ -148,50 +102,51 @@ 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)"
|
||||
|
||||
#ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh
|
||||
#if [[ ! -d $ZSH_CACHE_DIR ]]; then
|
||||
# mkdir $ZSH_CACHE_DIR
|
||||
#fi
|
||||
## local bin
|
||||
export PATH=${PATH}:${HOME}/.local/bin:${HOME}/.bin
|
||||
|
||||
# source $ZSH/oh-my-zsh.sh
|
||||
# Setup fzf
|
||||
# ---------
|
||||
if [[ ! "$PATH" == */home/leo/Documents/coding/fzf/bin* ]]; then
|
||||
export PATH="$PATH:/home/leo/Documents/coding/fzf/bin"
|
||||
fi
|
||||
## Drone CLI
|
||||
|
||||
# Auto-completion
|
||||
# ---------------
|
||||
[[ $- == *i* ]] && source "/home/leo/Documents/coding/fzf/shell/completion.zsh" 2> /dev/null
|
||||
export DRONE_SERVER=https://drone.troubles.io
|
||||
export DRONE_TOKEN=MAA6CxziewJZYkHLf5eV5UyEx3Qd26tb
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
source "/home/leo/Documents/coding/fzf/shell/key-bindings.zsh"
|
||||
|
||||
# Tig
|
||||
# ---
|
||||
|
||||
if [ -f /usr/share/bash-completion/completions/tig ]; then
|
||||
source /usr/share/bash-completion/completions/tig
|
||||
fi
|
||||
|
||||
# virtualenvwrapper
|
||||
# -----------------
|
||||
|
||||
if [ -f /usr/bin/virtualenvwrapper_lazy.sh ]; then
|
||||
source /usr/bin/virtualenvwrapper_lazy.sh
|
||||
fi
|
||||
|
||||
# geoiplookup
|
||||
# -----------
|
||||
|
||||
alias geocityiplookup="geoiplookup -f /usr/share/GeoIP/GeoLiteCity.dat"
|
||||
|
||||
# mailbundle
|
||||
# ----------
|
||||
# ensure Git completion
|
||||
fpath+=/usr/share/git/completion
|
||||
|
||||
## mailbundle
|
||||
alias mutt="neomutt"
|
||||
alias mailbundle="/opt/mailbundle/config/bin/autorun"
|
||||
|
||||
## torbrowser
|
||||
export PATH=$PATH:/opt/tor-browser_en-US
|
||||
|
||||
# vim: et sw=2 ts=2
|
||||
## platform-tools
|
||||
export PATH=$PATH:/opt/android-sdk/platform-tools
|
||||
|
||||
## 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}')
|
||||
}
|
||||
|
||||
## Custom completion
|
||||
# certo
|
||||
eval "$(_CERTO_COMPLETE=source_zsh certo)"
|
||||
|
||||
# vim: set ft=zsh et sw=0 ts=2 sts=0:
|
||||
|
|
20
README.md
Normal file
20
README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## My zsh config
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- `antibody`
|
||||
- `fasd`
|
||||
- `fzf`
|
||||
- `pipenv`
|
||||
- `virtualenvwrapper`
|
||||
|
||||
### Git hooks
|
||||
|
||||
Link the githooks to update at each commit and pull action.
|
||||
|
||||
```sh
|
||||
for hook in githooks/*
|
||||
do
|
||||
ln -s ../../${hook} .git/hooks/$(basename ${hook})
|
||||
done
|
||||
```
|
16
antibody.plugins.txt
Normal file
16
antibody.plugins.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
ohmyzsh/ohmyzsh path:lib
|
||||
ohmyzsh/ohmyzsh path:themes/agnoster.zsh-theme
|
||||
ohmyzsh/ohmyzsh path:plugins/colored-man-pages
|
||||
ohmyzsh/ohmyzsh path:plugins/docker
|
||||
ohmyzsh/ohmyzsh path:plugins/tmux
|
||||
ohmyzsh/ohmyzsh path:plugins/virtualenv
|
||||
|
||||
ael-code/zsh-gpg-agent
|
||||
ael-code/zsh-plugin-fasd-fzf
|
||||
ael-code/zsh-colored-man-pages
|
||||
gangleri/pipenv
|
||||
leophys/zsh-plugin-fzf-finder
|
||||
bobthecow/git-flow-completion
|
||||
zsh-users/zsh-autosuggestions
|
||||
junegunn/fzf
|
||||
wfxr/forgit
|
13
fzf.zsh
Normal file
13
fzf.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Setup fzf
|
||||
# ---------
|
||||
if [[ ! "$PATH" == */home/leo/.fzf/bin* ]]; then
|
||||
export PATH="${PATH:+${PATH}:}/home/leo/.fzf/bin"
|
||||
fi
|
||||
|
||||
# Auto-completion
|
||||
# ---------------
|
||||
[[ $- == *i* ]] && source "/home/leo/.fzf/shell/completion.zsh" 2> /dev/null
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
source "/home/leo/.fzf/shell/key-bindings.zsh"
|
11
githooks/post-merge
Executable file
11
githooks/post-merge
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ "$(basename $(realpath $PWD))" = ".git" ]; then
|
||||
cd ..
|
||||
fi
|
||||
|
||||
for updater in ./update_*.sh; do
|
||||
${updater}
|
||||
done
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
11
githooks/pre-commit
Executable file
11
githooks/pre-commit
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ "$(basename $(realpath $PWD))" = ".git" ]; then
|
||||
cd ..
|
||||
fi
|
||||
|
||||
for updater in ./update_*.sh; do
|
||||
${updater}
|
||||
done
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
21
update_antibody.sh
Executable file
21
update_antibody.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
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:
|
18
update_fzf.sh
Executable file
18
update_fzf.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
currpath=$(realpath $PWD)
|
||||
|
||||
if [ -d ${HOME}/.fzf ]; then
|
||||
cd ${HOME}/.fzf
|
||||
git pull
|
||||
cd ${currpath}
|
||||
else
|
||||
git clone https://github.com/junegunn/fzf.git ${HOME}/.fzf
|
||||
fi
|
||||
|
||||
if [ ! -d ~/.config/zsh ]; then
|
||||
mkdir -p ~/.config/zsh
|
||||
fi
|
||||
cp ${currpath}/fzf.zsh ${HOME}/.config/zsh/
|
||||
|
||||
# vim: set ft=sh et sw=0 ts=2 sts=0:
|
21
update_pipenv.sh
Executable file
21
update_pipenv.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
currpath=$(realpath $PWD)
|
||||
|
||||
if [ ! -d ${currpath}/compiled ]; then
|
||||
mkdir compiled
|
||||
fi
|
||||
|
||||
which pipenv > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: you need to install pipenv first!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pipenv --completion > ${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:
|
Loading…
Reference in a new issue