2018-04-25 17:13:25 +00:00
|
|
|
# If you come from bash you might have to change your $PATH.
|
2017-12-13 13:08:26 +00:00
|
|
|
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
2019-11-27 15:34:54 +00:00
|
|
|
|
2018-01-25 14:49:11 +00:00
|
|
|
[[ "$LANGUAGE" == "" ]] && export LANGUAGE=en_US.UTF-8
|
|
|
|
[[ "$LANG" == "" ]] && export LANG=en_US.UTF-8
|
|
|
|
[[ "$LC_ALL" == "" ]] && export LC_ALL=en_US.UTF-8
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2018-05-02 10:23:02 +00:00
|
|
|
[[ -d /etc/psoxizsh ]] && export PSOXIZSH=/etc/psoxizsh
|
|
|
|
[[ -d ~/.psoxizsh ]] && export PSOXIZSH=~/.psoxizsh
|
|
|
|
|
2020-04-10 10:02:46 +00:00
|
|
|
[[ "$TERM" == "linux" ]] && export TERM=vte-256color
|
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# remove duplicates
|
2018-05-14 10:45:17 +00:00
|
|
|
typeset -U PATH path fpath
|
2018-01-21 20:54:11 +00:00
|
|
|
path=( /bin /sbin /usr/bin /usr/sbin $path )
|
2018-05-24 11:24:10 +00:00
|
|
|
[[ -d ~/bin ]] && path=( ~/bin $path )
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2019-10-03 11:09:40 +00:00
|
|
|
# sdkman support
|
|
|
|
[[ -f ~/.sdkman/bin/sdkman-init.sh ]] && source ~/.sdkman/bin/sdkman-init.sh
|
|
|
|
|
2020-06-14 15:11:35 +00:00
|
|
|
# nvm
|
|
|
|
[[ -f /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh
|
|
|
|
|
2019-11-27 15:34:54 +00:00
|
|
|
# jaesve support
|
2020-07-11 14:59:08 +00:00
|
|
|
( which jaesve &>/dev/null ) && (
|
2019-11-27 15:34:54 +00:00
|
|
|
[[ -d ~/.local/share/zsh/functions ]] || mkdir -vp ~/.local/share/zsh/functions
|
|
|
|
[[ $(which jaesve) -nt ~/.local/share/zsh/functions/_jaesve ]] || (
|
|
|
|
jaesve completions -- zsh > ~/.local/share/zsh/functions/_jaesve
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-05-14 10:45:17 +00:00
|
|
|
# Set funtion paths
|
2018-05-17 13:48:05 +00:00
|
|
|
foreach local p in ~/.local/share/zsh/functions ~/.config/zsh/functions $extra_fpath
|
2018-05-14 10:54:28 +00:00
|
|
|
[[ -d "$p" ]] && fpath=( "$p" $fpath )
|
|
|
|
end
|
2018-05-14 10:45:17 +00:00
|
|
|
|
2018-03-08 12:13:45 +00:00
|
|
|
[[ "$OS" != "Windows_NT" ]] && [[ -f /etc/profile ]] && source /etc/profile
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
if [[ -z "$GOPATH" ]]
|
|
|
|
then
|
|
|
|
if [[ -d /cygdrive/s/develop/go ]]
|
|
|
|
then
|
|
|
|
export GOPATH=$(echo /cygdrive/s/develop/go)
|
2018-01-06 11:44:44 +00:00
|
|
|
elif [[ -d ~/Develop/go ]]
|
|
|
|
then
|
|
|
|
export GOPATH=$(echo ~/Develop/go)
|
|
|
|
elif [[ -d ~/develop/go ]]
|
|
|
|
then
|
|
|
|
export GOPATH=$(echo ~/develop/go)
|
2017-12-13 13:08:26 +00:00
|
|
|
else
|
|
|
|
export GOPATH=$(echo ~/go)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-06-09 20:41:11 +00:00
|
|
|
path+=( $GOPATH/bin ${GOROOT+${GOROOT}/bin} )
|
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# Path to your oh-my-zsh installation.
|
2018-05-02 10:23:02 +00:00
|
|
|
export ZSH=$PSOXIZSH/oh-my-zsh
|
2018-01-18 14:59:51 +00:00
|
|
|
export ZSH_CACHE_DIR=~/.cache/zsh
|
2018-02-14 15:47:57 +00:00
|
|
|
[[ ! -d $ZSH_CACHE_DIR ]] && mkdir -p $ZSH_CACHE_DIR
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
# Set name of the theme to load. Optionally, if you set this to "random"
|
|
|
|
# it'll load a random theme each time that oh-my-zsh is loaded.
|
|
|
|
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
|
|
|
|
#ZSH_THEME="rkj-repos"
|
2018-06-14 10:29:37 +00:00
|
|
|
[[ -z $ZSH_THEME ]] && export ZSH_THEME="stemmet"
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
# Uncomment the following line to use case-sensitive completion.
|
|
|
|
# CASE_SENSITIVE="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to use hyphen-insensitive completion. Case
|
|
|
|
# sensitive completion must be off. _ and - will be interchangeable.
|
|
|
|
# HYPHEN_INSENSITIVE="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to disable bi-weekly auto-update checks.
|
|
|
|
DISABLE_AUTO_UPDATE="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to change how often to auto-update (in days).
|
|
|
|
export UPDATE_ZSH_DAYS=3
|
|
|
|
|
|
|
|
# Uncomment the following line to disable colors in ls.
|
|
|
|
# DISABLE_LS_COLORS="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to disable auto-setting terminal title.
|
|
|
|
# DISABLE_AUTO_TITLE="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to enable command auto-correction.
|
|
|
|
# ENABLE_CORRECTION="true"
|
|
|
|
|
|
|
|
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
|
|
COMPLETION_WAITING_DOTS="true"
|
|
|
|
|
|
|
|
# Uncomment the following line if you want to disable marking untracked files
|
|
|
|
# under VCS as dirty. This makes repository status check for large repositories
|
|
|
|
# much, much faster.
|
|
|
|
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
|
|
|
|
|
|
# Uncomment the following line if you want to change the command execution time
|
|
|
|
# stamp shown in the history command output.
|
|
|
|
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
|
|
|
HIST_STAMPS="yyyy-mm-dd"
|
|
|
|
|
|
|
|
# Would you like to use another custom folder than $ZSH/custom?
|
2017-12-13 17:59:10 +00:00
|
|
|
ZSH_CUSTOM=$(dirname $ZSH)/zsh-custom
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
|
|
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
|
|
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
|
|
|
# Add wisely, as too many plugins slow down shell startup.
|
2018-02-14 10:56:32 +00:00
|
|
|
plugins=(
|
|
|
|
$pre_plugins
|
|
|
|
zsh_reload
|
|
|
|
gnu-utils
|
|
|
|
common-aliases
|
|
|
|
colored-man-pages
|
|
|
|
)
|
2020-10-29 11:46:05 +00:00
|
|
|
( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && [ -z "$STARSHIP_SHELL" ] && plugins+=( git-prompt )
|
2020-07-11 14:59:08 +00:00
|
|
|
( which perl &>/dev/null ) && plugins+=( perl )
|
|
|
|
( which go &>/dev/null ) && plugins+=( golang )
|
|
|
|
( which oc &>/dev/null ) && plugins+=( oc )
|
|
|
|
( which rsync &>/dev/null ) && plugins+=( rsync )
|
|
|
|
( which aws &>/dev/null ) && plugins+=( aws )
|
|
|
|
( which rust &>/dev/null ) && plugins+=( rust )
|
|
|
|
( which cargo &>/dev/null ) && plugins+=( cargo )
|
|
|
|
( which jq &>/dev/null ) && plugins+=( jsontools )
|
|
|
|
( which encode64 &>/dev/null ) && plugins+=( encode64 )
|
|
|
|
( which docker-compose &>/dev/null ) && plugins+=( docker-compose )
|
|
|
|
( which docker &>/dev/null ) && plugins+=( docker )
|
|
|
|
( which mosh &>/dev/null ) && plugins+=( mosh )
|
|
|
|
( which systemd &>/dev/null ) && plugins+=( systemd )
|
|
|
|
( which python &>/dev/null ) && plugins+=( python )
|
|
|
|
( which pip &>/dev/null ) && plugins+=( pip )
|
|
|
|
( which sudo &>/dev/null ) && plugins+=( sudo )
|
|
|
|
( which tmux &>/dev/null ) && plugins+=( tmux )
|
|
|
|
( which yum &>/dev/null ) && plugins+=( yum )
|
|
|
|
( which code &>/dev/null ) && plugins+=( vscode )
|
|
|
|
( which strfile &>/dev/null ) && plugins+=( chucknorris )
|
|
|
|
( which kubectl &>/dev/null ) && plugins+=( kubectl )
|
2018-02-12 17:44:56 +00:00
|
|
|
( [[ -e /etc/arch-release ]] ) && plugins+=( archlinux )
|
|
|
|
( [[ -e /etc/suse-release ]] ) && plugins+=( suse )
|
|
|
|
( [[ "$(uname)" == "Darwin" ]] ) && plugins+=( osx )
|
2020-07-11 14:59:08 +00:00
|
|
|
#( which vim &>/dev/null ) && plugins+=( vim-interaction )
|
|
|
|
( which ssh &>/dev/null ) && [[ -d ~/.ssh ]] && plugins+=( ssh-agent )
|
2018-02-14 10:56:32 +00:00
|
|
|
plugins+=(
|
|
|
|
zsh-completions
|
2020-07-11 14:59:08 +00:00
|
|
|
zsh-autosuggestions
|
|
|
|
zsh-navigation-tools
|
|
|
|
$( which fzf &>/dev/null && echo 'fzf' )
|
|
|
|
zsh-syntax-highlighting
|
2018-02-14 10:56:32 +00:00
|
|
|
$post_plugins
|
|
|
|
)
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2020-07-03 08:37:06 +00:00
|
|
|
if [[ "$OSTYPE" =~ "linux*" || "$OSTYPE" =~ "darwin*" || "$OSTYPE" == "cygwin" ]]
|
2017-12-13 13:08:26 +00:00
|
|
|
then
|
2020-11-02 16:35:23 +00:00
|
|
|
export VIMINIT='source $MYVIMRC'
|
|
|
|
export MYVIMRC=$PSOXIZSH/vimrc
|
|
|
|
export VIMHOME=~/.vim
|
|
|
|
cmp $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim 2>/dev/null || (
|
|
|
|
mkdir -vp $VIMHOME/autoload/
|
|
|
|
cp -av $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim
|
|
|
|
)
|
2017-12-13 13:08:26 +00:00
|
|
|
fi
|
|
|
|
|
2019-06-30 15:39:49 +00:00
|
|
|
if [[ -d ~/.ssh ]]
|
|
|
|
then
|
|
|
|
zstyle :omz:plugins:ssh-agent lifetime 36h
|
|
|
|
if [[ -e ~/.ssh/autoload ]]
|
|
|
|
then
|
|
|
|
zstyle :omz:plugins:ssh-agent identities $( cat ~/.ssh/autoload )
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-05-02 10:23:02 +00:00
|
|
|
[[ -d $ZSH ]] && source $ZSH/oh-my-zsh.sh
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2018-09-10 13:19:57 +00:00
|
|
|
zstyle :omz:plugins:ssh-agent agent-forwarding on
|
|
|
|
|
2018-02-14 11:55:08 +00:00
|
|
|
# Dynamic Completion
|
|
|
|
foreach cmd in kubectl kubeadm
|
2020-07-11 14:59:08 +00:00
|
|
|
( which $cmd &>/dev/null ) && source <($cmd completion zsh)
|
2018-02-14 15:42:25 +00:00
|
|
|
end
|
2018-02-14 11:55:08 +00:00
|
|
|
|
2019-02-19 11:14:46 +00:00
|
|
|
source $PSOXIZSH/zsh-custom/zshnip/zshnip.zsh
|
2020-07-11 14:59:08 +00:00
|
|
|
( which lxc &>/dev/null ) && source $PSOXIZSH/zsh-custom/lxd-completion-zsh/_lxc
|
2019-02-19 11:14:46 +00:00
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# User configuration
|
|
|
|
|
|
|
|
# export MANPATH="/usr/local/man:$MANPATH"
|
|
|
|
|
|
|
|
# You may need to manually set your language environment
|
2020-06-09 20:41:11 +00:00
|
|
|
# export LANG=en_US.UTF-8
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2020-07-11 14:59:08 +00:00
|
|
|
( which vi &>/dev/null ) && export EDITOR='vi'
|
|
|
|
( which vim &>/dev/null ) && export EDITOR='vim'
|
|
|
|
( which nvim &>/dev/null ) && export EDITOR='nvim'
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2020-06-09 20:41:11 +00:00
|
|
|
# Set zsh tmux config path
|
2020-07-11 14:59:08 +00:00
|
|
|
if which tmux &>/dev/null; then
|
2020-06-09 20:41:11 +00:00
|
|
|
for tmux_config in {~/.config/tmux,~/.tmux,/etc/tmux}; do
|
|
|
|
if [ -d "$tmux_config" ]; then
|
|
|
|
TMUX_PATH="$tmux_config"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "$TMUX_PATH" ] && TMUX_PATH=~/.config/tmux
|
|
|
|
export TMUX_PATH=$TMUX_PATH
|
|
|
|
|
|
|
|
[ -d "$TMUX_PATH" ] && [ -d "$TMUX_PATH/plugins" ] || { mkdir -vp $TMUX_PATH && cp -r $PSOXIZSH/tmux/. $TMUX_PATH }
|
|
|
|
# If a .conf is detected override the default zsh tmux path
|
|
|
|
[ -f "$TMUX_PATH/tmux.conf" ] && export ZSH_TMUX_CONFIG="$TMUX_PATH/tmux.conf"
|
|
|
|
|
|
|
|
export TMUX_PLUGINS="$TMUX_PATH/plugins"
|
|
|
|
fi
|
|
|
|
|
2020-07-11 14:59:08 +00:00
|
|
|
if which fzf &>/dev/null; then
|
|
|
|
# Press ? inside a C-r search to get a preview window, useful for long commands
|
|
|
|
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
|
|
|
|
which tmux &> /dev/null && export FZF_TMUX=1
|
|
|
|
fi
|
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# 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
|
2020-10-30 23:43:47 +00:00
|
|
|
alias zshconfig="$EDITOR $PSOXIZSH/zshrc"
|
|
|
|
alias ohmyzsh="$EDITOR $PSOXIZSH/oh-my-zsh"
|
2019-02-19 11:14:46 +00:00
|
|
|
alias curlj="curl -H 'Content-Type: application/json' "
|
2020-11-02 16:35:23 +00:00
|
|
|
which nvim &>/dev/null && alias vi="$(which nvim)"
|
|
|
|
which nvim &>/dev/null && alias vim="$(which nvim)"
|
2020-07-03 08:37:06 +00:00
|
|
|
alias v=vim
|
2020-06-09 20:41:11 +00:00
|
|
|
[[ -x /usr/bin/yay ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/yay'
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
typeset -A key
|
|
|
|
|
|
|
|
# setup key accordingly
|
|
|
|
bindkey -- "^[[1~" beginning-of-line
|
|
|
|
bindkey -- "^[[4~" end-of-line
|
|
|
|
bindkey -- "^[[2~" overwrite-mode
|
|
|
|
bindkey -- "^H" backward-delete-char
|
|
|
|
bindkey -- "^[[3~" delete-char
|
|
|
|
bindkey -- "^[OD" backward-char
|
|
|
|
bindkey -- "^[OC" forward-char
|
|
|
|
bindkey -- "^[OA" up-line-or-history
|
|
|
|
bindkey -- "^[OB" down-line-or-history
|
2018-03-28 10:12:53 +00:00
|
|
|
#bindkey -- "^[[1;5A" history-substring-search-up
|
|
|
|
#bindkey -- "^[[1;5B" history-substring-search-down
|
2017-12-13 13:08:26 +00:00
|
|
|
|
2019-02-19 11:14:46 +00:00
|
|
|
bindkey '\ej' zshnip-expand-or-edit # Alt-J
|
|
|
|
bindkey '\ee' zshnip-edit-and-expand # Alt-E
|
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# cutomize options
|
2020-06-09 20:41:11 +00:00
|
|
|
setopt no_bang_hist cdable_vars auto_name_dirs
|
2017-12-13 13:08:26 +00:00
|
|
|
|
|
|
|
# Finally, make sure the terminal is in application mode, when zle is
|
|
|
|
# active. Only then are the values from $terminfo valid.
|
|
|
|
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
|
|
|
function zle-line-init () {
|
|
|
|
echoti smkx
|
|
|
|
}
|
|
|
|
function zle-line-finish () {
|
|
|
|
echoti rmkx
|
|
|
|
}
|
|
|
|
zle -N zle-line-init
|
|
|
|
zle -N zle-line-finish
|
|
|
|
fi
|
|
|
|
|
|
|
|
[[ -d /cygdrive/c/qemu/ ]] && path+=( /cygdrive/c/qemu/ )
|
|
|
|
[[ ! -z "$DISPLAY" ]] && xhost +LOCAL:
|
|
|
|
|
2018-06-14 09:48:29 +00:00
|
|
|
# Set Time Variables
|
|
|
|
precmd() {
|
|
|
|
export _DATE_=$(date -u +%Y%m%d)
|
|
|
|
export _TIME_=$(date -u +%H%M%S)
|
|
|
|
export _DTTS_="${_DATE_}T${_TIME_}Z"
|
2018-06-14 10:16:47 +00:00
|
|
|
if [[ ! -z $KUBECONFIG ]]
|
|
|
|
then
|
2018-07-02 10:27:01 +00:00
|
|
|
export KUBE_VARS=$(basename $KUBECONFIG)/$(kubectl config current-context)
|
2018-06-14 12:38:32 +00:00
|
|
|
else
|
|
|
|
unset KUBE_VARS
|
2018-06-14 10:16:47 +00:00
|
|
|
fi
|
2018-06-14 09:48:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-29 11:46:05 +00:00
|
|
|
# Remove unwanted aliases
|
|
|
|
|
|
|
|
( where fd | grep -q -E '\/s?bin\/fd' ) && alias fd &>/dev/null && unalias fd
|
|
|
|
|
2019-09-23 16:37:27 +00:00
|
|
|
# Clean up global aliases
|
|
|
|
source <(alias -g | awk -F= '/^[A-Za-z]+/{print $1}' | xargs -I{} -n1 echo unalias "'{}'")
|
|
|
|
|
2017-12-13 13:08:26 +00:00
|
|
|
# vim: sw=2 ts=8 si relativenumber number
|