mirror of https://git.decapod.one/brethil/dotfiles
Compare commits
3 Commits
a9a45864d2
...
030903dcd7
Author | SHA1 | Date |
---|---|---|
bretello | 030903dcd7 | |
bretello | 81d8c56836 | |
bretello | edc1934e83 |
|
@ -1,24 +0,0 @@
|
||||||
# vim:ft=zsh
|
|
||||||
djui/alias-tips
|
|
||||||
robbyrussell/oh-my-zsh
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/ansible
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/bgnotify
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/colored-man-pages
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/common-aliases
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/docker
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/docker-compose
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/fzf
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/git
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/golang
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/grc
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/pip
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/pyenv
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/pylint
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/sudo
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/vagrant
|
|
||||||
robbyrussell/oh-my-zsh path:plugins/vi-mode
|
|
||||||
zsh-users/zsh-autosuggestions
|
|
||||||
zsh-users/zsh-completions
|
|
||||||
zsh-users/zsh-syntax-highlighting
|
|
||||||
joshskidmore/zsh-fzf-history-search
|
|
||||||
ryutok/rust-zsh-completions
|
|
|
@ -9,10 +9,51 @@ export VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||||
|
|
||||||
export PATH=$PATH:$HOME/bin
|
export PATH=$PATH:$HOME/bin
|
||||||
|
|
||||||
# Source all zsh plugins
|
if [[ -d "$HOME/.cache/antibody" ]]; then
|
||||||
source <(antibody init)
|
# antibody migration cleanup
|
||||||
export ANTIBODY="$(antibody home)"
|
rm -rf $HOME/.cache/antibody
|
||||||
antibody bundle < "$DOTFILES/antibody_plugins.txt"
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d $DOTFILES/antidote ]]; then
|
||||||
|
git clone https://github.com/mattmc3/antidote.git ${DOTFILES}/antidote
|
||||||
|
fi
|
||||||
|
|
||||||
|
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
|
||||||
|
[[ -d $ZSH_CACHE_DIR ]] || mkdir -p $ZSH_CACHE_DIR
|
||||||
|
|
||||||
|
# Lazy-load antidote from its functions directory.
|
||||||
|
fpath=($DOTFILES/antidote/functions/ $fpath)
|
||||||
|
autoload -Uz antidote
|
||||||
|
|
||||||
|
autoload -Uz compinit && compinit
|
||||||
|
autoload -Uz bashcompinit && bashcompinit
|
||||||
|
|
||||||
|
|
||||||
|
# Lazy-load antidote and generate the static load file only when needed # TODO: look into deferred loading with zsh-defer
|
||||||
|
zsh_plugins="$DOTFILES/zsh_plugins"
|
||||||
|
if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then
|
||||||
|
(
|
||||||
|
source $DOTFILES/antidote/antidote.zsh
|
||||||
|
|
||||||
|
echo "ZSH=$(antidote path ohmyzsh/ohmyzsh)" >${zsh_plugins}.zsh
|
||||||
|
|
||||||
|
antidote bundle <${zsh_plugins}.txt >>${zsh_plugins}.zsh
|
||||||
|
|
||||||
|
if [[ $+commands[systemctl] ]]; then
|
||||||
|
antidote bundle robbyrussell/oh-my-zsh path:plugins/systemd >>${zsh_plugins}.zsh
|
||||||
|
fi
|
||||||
|
if [[ $+commands[pacman] ]]; then
|
||||||
|
antidote bundle robbyrussell/oh-my-zsh path:plugins/archlinux >>${zsh_plugins}.zsh
|
||||||
|
elif [[ $+commands[apt-get] ]]; then
|
||||||
|
antidote bundle robbyrussell/oh-my-zsh path:plugins/debian >>${zsh_plugins}.zsh
|
||||||
|
fi
|
||||||
|
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ${zsh_plugins}.zsh
|
||||||
|
source "$DOTFILES/themes/brethil.zsh-theme"
|
||||||
|
|
||||||
|
|
||||||
# Setup completion style
|
# Setup completion style
|
||||||
source $DOTFILES/completion_style.zsh
|
source $DOTFILES/completion_style.zsh
|
||||||
|
@ -25,20 +66,8 @@ else
|
||||||
fi
|
fi
|
||||||
export FZF_CTRL_T_OPTS=" --preview-window=right,60% --preview \"bash -c 'if [[ -d \"{}\" ]]; then tree -C \"{}\"; else bat --style=plain --color=always \"{}\"; fi'\" --bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-horizontal|hidden|right)'"
|
export FZF_CTRL_T_OPTS=" --preview-window=right,60% --preview \"bash -c 'if [[ -d \"{}\" ]]; then tree -C \"{}\"; else bat --style=plain --color=always \"{}\"; fi'\" --bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-horizontal|hidden|right)'"
|
||||||
|
|
||||||
if [[ $+commands[systemctl] ]]; then
|
|
||||||
antibody bundle robbyrussell/oh-my-zsh path:plugins/systemd
|
|
||||||
fi
|
|
||||||
if [[ $+commands[pacman] ]]; then
|
|
||||||
antibody bundle robbyrussell/oh-my-zsh path:plugins/archlinux
|
|
||||||
elif [[ $+commands[apt-get] ]]; then
|
|
||||||
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
|
|
||||||
fi
|
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=white,bg=gray,bold'
|
ZSH_HIGHLIGHT_STYLES[comment]='fg=white,bg=gray,bold'
|
||||||
|
|
||||||
# Setup oh-my-zsh path
|
|
||||||
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
|
||||||
|
|
||||||
# Enable zsh autocorrection
|
# Enable zsh autocorrection
|
||||||
setopt CORRECT_ALL
|
setopt CORRECT_ALL
|
||||||
|
|
||||||
|
@ -60,7 +89,7 @@ unsetopt LIST_BEEP
|
||||||
## Misc environment variables
|
## Misc environment variables
|
||||||
|
|
||||||
# https://www.xkcd.com/378/
|
# https://www.xkcd.com/378/
|
||||||
export EDITOR="vim" # if antibody_plugins.txt includes robbyrussell/oh-my-zsh path:plugins/vi-mode, this also sets `bindkey -v`
|
export EDITOR="vim" # if antibody_plugins.txt includes robbyrussell/oh-my-zsh path:plugins/vi-mode, this also sets `bindkey -v` # FIXME
|
||||||
export VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true # refresh prompt on every mode change
|
export VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true # refresh prompt on every mode change
|
||||||
# Fix delete (delete! not backspace) key
|
# Fix delete (delete! not backspace) key
|
||||||
bindkey -a '^[[3~' delete-char
|
bindkey -a '^[[3~' delete-char
|
||||||
|
@ -147,8 +176,8 @@ test -f "${functions_file}" && source "${functions_file}"
|
||||||
test -f "${aliases_file}" && source "${aliases_file}"
|
test -f "${aliases_file}" && source "${aliases_file}"
|
||||||
test -f "${ssh_file}" && source "${ssh_file}"
|
test -f "${ssh_file}" && source "${ssh_file}"
|
||||||
|
|
||||||
autoload -U compinit && compinit
|
# autoload -U compinit && compinit
|
||||||
autoload -U bashcompinit && bashcompinit
|
# autoload -U bashcompinit && bashcompinit
|
||||||
|
|
||||||
# Set DISABLE_DOTFILES_AUTOUPDATE=true to disable updates
|
# Set DISABLE_DOTFILES_AUTOUPDATE=true to disable updates
|
||||||
source "${DOTFILES}/extras/check_for_update.zsh"
|
source "${DOTFILES}/extras/check_for_update.zsh"
|
||||||
|
|
|
@ -30,7 +30,7 @@ function _update_dotfiles_update() {
|
||||||
|
|
||||||
function update_dotfiles() {
|
function update_dotfiles() {
|
||||||
(cd $DOTFILES; git pull -q --rebase && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles.")
|
(cd $DOTFILES; git pull -q --rebase && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles.")
|
||||||
antibody update
|
(cd $DOTFILES/antidote && git pull -rebase || echo "Could not upgrade antidote")
|
||||||
vim -c 'PlugUpdate|PlugClean|qa!'
|
vim -c 'PlugUpdate|PlugClean|qa!'
|
||||||
# update the zsh file
|
# update the zsh file
|
||||||
_update_dotfiles_update
|
_update_dotfiles_update
|
||||||
|
|
|
@ -3,33 +3,31 @@
|
||||||
# See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc`
|
# See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc`
|
||||||
# Note: Most of the expansions/color sequences can be tested using `print -P`
|
# Note: Most of the expansions/color sequences can be tested using `print -P`
|
||||||
|
|
||||||
function user_prompt(){
|
|
||||||
# prints hostname on an orange background if on an ssh connection, adds username if root
|
# prints hostname on an orange background if on an ssh connection, adds username if root
|
||||||
|
|
||||||
local user='%(!.%K{160}%F{255}%B%n%b%k%f.)' # prints 'root' on a red background if user is root
|
local user='%(!.%K{160}%F{255}%B%n%b%k%f.)' # prints 'root' on a red background if user is root
|
||||||
local host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background
|
local host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background
|
||||||
local open_bracket='%(!.[.)'
|
local open_bracket='%(!.[.)'
|
||||||
local close_bracket='%(!.].)'
|
local close_bracket='%(!.].)'
|
||||||
local at='%(!.@.)'
|
local at='%(!.@.)'
|
||||||
if [[ -n $SSH_CONNECTION ]]; then
|
local user_prompt
|
||||||
echo "[${user}${at}${host}]"
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
else
|
user_prompt="[${user}${at}${host}]"
|
||||||
echo "${open_bracket}${user}${close_bracket}"
|
else
|
||||||
fi
|
user_prompt="${open_bracket}${user}${close_bracket}"
|
||||||
}
|
fi
|
||||||
|
|
||||||
local job_prompt="%(1j.%B%K{202}%F{220} %j %k%b.)"
|
local job_prompt="%(1j.%B%K{202}%F{220} %j %k%b.)"
|
||||||
|
|
||||||
function shlvl_prompt() {
|
|
||||||
# Shows SHLVL on a magenta background if SHLVL > 1 (2 if in a tmux session)
|
|
||||||
if [[ -z "$TMUX" ]]; then
|
|
||||||
echo "%(2L.%K{161}%F{255}%B %L %f%b%k.)"
|
|
||||||
else
|
|
||||||
echo "%(3L.%K{161}%F{255}%B $((SHLVL-1)) %f%b%k.)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO: add truncation using
|
local shlvl_prompt
|
||||||
|
# Shows SHLVL on a magenta background if SHLVL > 1 (2 if in a tmux session)
|
||||||
|
if [[ -z "$TMUX" ]]; then
|
||||||
|
shlvl_prompt="%(2L.%K{161}%F{255}%B %L %f%b%k.)"
|
||||||
|
else
|
||||||
|
shlvl_prompt="%(3L.%K{161}%F{255}%B $((SHLVL-1)) %f%b%k.)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Shows last 3 items in path if there are more than 4
|
# Shows last 3 items in path if there are more than 4
|
||||||
local path_prompt='[%F{green}%(4~:…/%3~:%~)%f]'
|
local path_prompt='[%F{green}%(4~:…/%3~:%~)%f]'
|
||||||
|
|
||||||
|
@ -57,12 +55,12 @@ ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
|
||||||
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
|
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
|
||||||
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
|
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
|
||||||
|
|
||||||
|
|
||||||
|
local BOLD_PURPLE='%B%F{5}'
|
||||||
|
local CLEAR='%f%b'
|
||||||
|
local venv
|
||||||
function virtualenv_info {
|
function virtualenv_info {
|
||||||
[ -z "$VIRTUAL_ENV" ] && return
|
[ -z "$VIRTUAL_ENV" ] && return
|
||||||
|
|
||||||
local BOLD_PURPLE='%B%F{5}'
|
|
||||||
local CLEAR='%f%b'
|
|
||||||
local venv
|
|
||||||
venv="$(basename "$VIRTUAL_ENV")"
|
venv="$(basename "$VIRTUAL_ENV")"
|
||||||
if [[ "$venv" == ".venv" ]]; then
|
if [[ "$venv" == ".venv" ]]; then
|
||||||
venv="$(basename $(dirname "$VIRTUAL_ENV") )"
|
venv="$(basename $(dirname "$VIRTUAL_ENV") )"
|
||||||
|
@ -88,7 +86,7 @@ export MODE_INDICATOR="[%B%K{red}nav%k%b]" # red background
|
||||||
export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background
|
export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background
|
||||||
|
|
||||||
# put it all together
|
# put it all together
|
||||||
PROMPT='$(virtualenv_info)$(user_prompt)'"${path_prompt}${git_prompt}${job_prompt}"'$(shlvl_prompt)'"${prompt_too_long}${prompt_with_previous_return_status}"
|
PROMPT='$(virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}${prompt_too_long}${prompt_with_previous_return_status}"
|
||||||
|
|
||||||
# Right prompt is just return code and time
|
# Right prompt is just return code and time
|
||||||
RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]'
|
RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]'
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# vim:ft=zsh
|
||||||
|
djui/alias-tips
|
||||||
|
ohmyzsh/ohmyzsh path:lib
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/ansible
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/bgnotify
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/colored-man-pages
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/common-aliases
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/docker
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/docker-compose
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/fzf
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/golang
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/grc
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/pip
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/pyenv
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/pylint
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/sudo
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/vagrant
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/vi-mode
|
||||||
|
zsh-users/zsh-autosuggestions
|
||||||
|
zsh-users/zsh-completions
|
||||||
|
zsh-users/zsh-syntax-highlighting
|
||||||
|
joshskidmore/zsh-fzf-history-search
|
||||||
|
ryutok/rust-zsh-completions
|
Loading…
Reference in New Issue