2021-06-17 16:13:12 +00:00
|
|
|
# Enable Powerlevel10k instant prompt.uld 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
|
|
|
|
|
2019-07-18 16:45:46 +00:00
|
|
|
# Source Prezto.
|
|
|
|
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|
|
|
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ZSH customs
|
|
|
|
|
|
|
|
export PATH=$PATH:~/bin
|
|
|
|
setopt clobber
|
|
|
|
zstyle ':completion:*' rehash true
|
2021-06-26 14:31:12 +00:00
|
|
|
zstyle ':completion:*' special-dirs true
|
2019-07-18 16:45:46 +00:00
|
|
|
|
2021-06-17 16:13:12 +00:00
|
|
|
export HISTFILE=~/.zsh_history
|
2020-10-24 18:11:49 +00:00
|
|
|
export HISTFILESIZE=100000
|
|
|
|
export HISTSIZE=100000
|
|
|
|
|
2020-01-23 11:48:30 +00:00
|
|
|
unsetopt correct
|
|
|
|
unsetopt correctall
|
|
|
|
DISABLE_CORRECTION="true"
|
2020-11-26 16:59:14 +00:00
|
|
|
PROMPT_EOL_MARK=''
|
2020-01-23 11:48:30 +00:00
|
|
|
|
2019-07-18 16:45:46 +00:00
|
|
|
##### aliases ######
|
|
|
|
|
|
|
|
alias ccat="pygmentize -O style=native -g "
|
|
|
|
alias chromium-socks='chromium --proxy-server=socks://localhost:3000'
|
2020-03-25 10:08:23 +00:00
|
|
|
alias curlmobile='curl -A "Mozilla/5.0 (Linux; Android 9; AR 4G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Mobile Safari/537.36"'
|
2019-07-18 16:45:46 +00:00
|
|
|
alias curlr='curl -o /dev/null -w "\n\nCode: \t%{http_code}\n\nDNS: \t%{time_namelookup}\nConnect:\t%{time_connect}\nStartTransfer:\t%{time_starttransfer} (PreTransfer:%{time_pretransfer})\nTotal: \t%{time_total}\n\n"'
|
2020-03-25 10:08:23 +00:00
|
|
|
alias curlh='curl -sD - -o /dev/null'
|
2019-07-18 16:45:46 +00:00
|
|
|
alias duh='du -sch .[!.]* *'
|
2020-03-14 15:05:56 +00:00
|
|
|
alias gb="git checkout \$(git branch -avv | fzf +m | awk '{print \$1}')"
|
2019-07-18 16:45:46 +00:00
|
|
|
alias open='xdg-open'
|
|
|
|
alias yayU='yay -Suy --noconfirm'
|
2020-01-19 17:44:16 +00:00
|
|
|
alias mknamedvenv='mkvirtualenv $(basename $PWD) -r requirements.txt'
|
2020-01-19 18:12:31 +00:00
|
|
|
alias dkillall='docker rm -f $(docker ps -qa)'
|
2020-08-20 15:42:10 +00:00
|
|
|
alias k=kubectl
|
|
|
|
alias kconfig='echo "$(kubectl config current-context) ($(kubectl config view --minify --output "jsonpath={..namespace}"))"'
|
2021-12-05 18:59:14 +00:00
|
|
|
alias icat="kitty +kitten icat --align=left"
|
|
|
|
alias idiff="kitty +kitten diff"
|
2021-12-24 12:52:28 +00:00
|
|
|
alias ls="ls --group-directories-first --color=auto --hyperlink=auto"
|
2019-07-18 16:45:46 +00:00
|
|
|
|
|
|
|
##### tilix #####
|
|
|
|
|
|
|
|
if [ $TILIX_ID ] || [ $VTE_VERSION ] ; then
|
2020-05-01 13:40:14 +00:00
|
|
|
source /etc/profile.d/vte.sh
|
2019-07-18 16:45:46 +00:00
|
|
|
fi
|
|
|
|
|
2020-05-01 13:40:14 +00:00
|
|
|
##### default apps #####
|
2019-07-18 16:45:46 +00:00
|
|
|
|
|
|
|
export EDITOR='vim'
|
|
|
|
export VISUAL='vim'
|
|
|
|
export PAGER='less'
|
2021-12-24 12:52:28 +00:00
|
|
|
export BROWSER='/usr/bin/vivaldi-stable'
|
2019-07-18 16:45:46 +00:00
|
|
|
|
|
|
|
##### venvs ######
|
|
|
|
|
|
|
|
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
|
|
|
|
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
|
|
|
|
export WORKON_HOME=~/.virtualenvs
|
|
|
|
source /usr/bin/virtualenvwrapper.sh
|
2020-06-17 12:19:06 +00:00
|
|
|
alias workondir='workon $(basename $(pwd))'
|
2019-07-18 16:45:46 +00:00
|
|
|
|
|
|
|
##### fzf #####
|
|
|
|
|
|
|
|
source /usr/share/fzf/key-bindings.zsh
|
|
|
|
source /usr/share/fzf/completion.zsh
|
|
|
|
|
|
|
|
fzf-file-widget-hidden () {
|
2020-01-19 17:44:16 +00:00
|
|
|
fd --type f --hidden -I --follow --exclude .git --exclude .cache | fzf
|
2019-07-18 16:45:46 +00:00
|
|
|
}
|
|
|
|
|
2020-01-19 18:12:31 +00:00
|
|
|
dexec () {
|
|
|
|
local cid
|
2020-05-01 14:12:36 +00:00
|
|
|
local cmd=("$@")
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
cmd=(bash)
|
|
|
|
fi
|
|
|
|
|
2020-02-04 09:46:16 +00:00
|
|
|
cid=$(docker ps -a | sed 1d | fzf -1 | awk '{print $1}')
|
2020-01-19 18:12:31 +00:00
|
|
|
|
2020-05-01 14:12:36 +00:00
|
|
|
[ -n "$cid" ] && docker exec -ti "$cid" "${cmd[@]}"
|
2020-01-19 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 17:37:23 +00:00
|
|
|
kexec () {
|
|
|
|
local cid
|
|
|
|
local cmd=("$@")
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
cmd=(bash)
|
|
|
|
fi
|
|
|
|
|
|
|
|
cid=$(kubectl get pods | sed 1d | fzf -1 | awk '{print $1}')
|
|
|
|
|
|
|
|
[ -n "$cid" ] && kubectl exec -ti "$cid" -- "${cmd[@]}"
|
|
|
|
}
|
2020-01-19 18:12:31 +00:00
|
|
|
|
2020-01-19 17:44:16 +00:00
|
|
|
export FZF_DEFAULT_COMMAND="fd --type f --follow -I"
|
2019-07-18 16:45:46 +00:00
|
|
|
export FZF_DEFAULT_OPTS="-m --reverse --bind 'ctrl-o:execute(xdg-open {})+abort,ctrl-e:execute({})+abort,ctrl-y:execute(echo {} | xclip -selection clipboard -in)+abort'"
|
|
|
|
export FZF_CTRL_T_OPTS="--no-height --preview '[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || pygmentize {} 2> /dev/null | head -500'"
|
|
|
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
|
|
|
|
|
|
|
bindkey '^P' fzf-file-widget
|
|
|
|
zle -N fzf-file-widget-hidden
|
|
|
|
bindkey '^H' fzf-file-widget-hidden
|
|
|
|
|
|
|
|
## SSH agent
|
|
|
|
|
|
|
|
if [ -z $SSH_AUTH_SOCK ] && [ -S "${XDG_RUNTIME_DIR}/ssh-agent.socket" ]; then
|
|
|
|
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
|
|
|
|
fi
|
2019-10-24 17:51:55 +00:00
|
|
|
|
|
|
|
# Autocompletion
|
2021-01-23 18:38:50 +00:00
|
|
|
|
|
|
|
autoload -U compinit && compinit
|
2020-05-30 16:12:51 +00:00
|
|
|
|
|
|
|
# custom device
|
|
|
|
|
2020-06-12 15:05:11 +00:00
|
|
|
source ~/.zshrc_custom
|
2021-06-17 16:13:12 +00:00
|
|
|
|
|
|
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|