minor refactor of zsh prompt, uses starship but still has a backup.
This commit is contained in:
parent
acb21f084f
commit
ba95f9ccfc
28
zsh/.zshrc
28
zsh/.zshrc
|
@ -36,6 +36,7 @@
|
||||||
export PATH="$PATH:/opt"
|
export PATH="$PATH:/opt"
|
||||||
|
|
||||||
#prompt
|
#prompt
|
||||||
|
setprompt() {
|
||||||
autoload -U promptinit
|
autoload -U promptinit
|
||||||
promptinit
|
promptinit
|
||||||
autoload -U colors
|
autoload -U colors
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
#when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo.
|
#when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo.
|
||||||
zstyle ':vcs_info:*' nvcsformats '%~'
|
zstyle ':vcs_info:*' nvcsformats '%~'
|
||||||
zstyle ':vcs_info:*' formats '%r/%S %F{green}[%b]%f'
|
zstyle ':vcs_info:*' formats '%r/%S %F{green}[%b]%f'
|
||||||
|
zstyle ':vcs_info:*' actionformats '%r/%S %F{green}[%b] %F{red}<%a>%f'
|
||||||
|
|
||||||
#the precmd function, called just before printing the prompt.
|
#the precmd function, called just before printing the prompt.
|
||||||
function precmd() {
|
function precmd() {
|
||||||
|
@ -58,10 +60,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#Make the right prompt blank, just to be sure.
|
#Make the right prompt blank, just to be sure.
|
||||||
RPROMPT=
|
RPROMPT=''
|
||||||
|
|
||||||
#on the top line, show a whole bunch of info. botton line should be as minimal as possilbe (just a single char to input next to...)
|
#on the top line, show a whole bunch of info. botton line should be as minimal as possilbe (just a single char to input next to...)
|
||||||
PROMPT=$'%F{cyan}[%n@%m]%f%F{red}├────┤%f${vcs_info_msg_0_}\n»'
|
PROMPT=$'%F{cyan}[%n@%m]%f%F{red}├────┤%f${vcs_info_msg_0_} %F{white}[%D %T]%f\n»'
|
||||||
|
}
|
||||||
|
#starship if its installed, otherwise the prompt we just defined.
|
||||||
|
command -v starship &> /dev/null && eval "$(starship init zsh)" || setprompt
|
||||||
|
|
||||||
#show dots while waiting for tab-completion
|
#show dots while waiting for tab-completion
|
||||||
expand-or-complete-with-dots() {
|
expand-or-complete-with-dots() {
|
||||||
|
@ -76,14 +81,16 @@
|
||||||
zle -N expand-or-complete-with-dots
|
zle -N expand-or-complete-with-dots
|
||||||
bindkey "^I" expand-or-complete-with-dots
|
bindkey "^I" expand-or-complete-with-dots
|
||||||
|
|
||||||
#misc
|
# editing stuff
|
||||||
# Enable the ZLE line editor, which is default behavior, but to be sure
|
# Enable the ZLE line editor, which is default behavior, but to be sure
|
||||||
setopt ZLE
|
setopt ZLE
|
||||||
#Enable vi mode for the ZLE. it should be set by default due to our EDITOR and VISUAL, but this is just to be safe.
|
#Enable vi mode for the ZLE. it should be set by default due to our EDITOR and VISUAL, but this is just to be safe.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
#allow backspacing beyond the point you entered insert mode:
|
#allow backspacing beyond the point you entered insert mode:
|
||||||
bindkey -v '^?' backward-delete-char
|
bindkey -v '^?' backward-delete-char
|
||||||
bindkey "^W" backward-kill-word
|
bindkey "^W" backward-kill-word
|
||||||
|
|
||||||
|
#misc
|
||||||
# Sends cd commands without the need for 'cd'
|
# Sends cd commands without the need for 'cd'
|
||||||
setopt AUTO_CD
|
setopt AUTO_CD
|
||||||
# Kill all child processes when we exit, dont leave them running
|
# Kill all child processes when we exit, dont leave them running
|
||||||
|
@ -161,16 +168,12 @@
|
||||||
|
|
||||||
#setup grep to be a bit more nice
|
#setup grep to be a bit more nice
|
||||||
local GREP_OPTIONS=""
|
local GREP_OPTIONS=""
|
||||||
|
|
||||||
# color grep results
|
# color grep results
|
||||||
GREP_OPTIONS+=" --color=auto"
|
GREP_OPTIONS+=" --color=auto"
|
||||||
|
|
||||||
# ignore VCS folders (if the necessary grep flags are available)
|
# ignore VCS folders (if the necessary grep flags are available)
|
||||||
local VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
|
local VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
|
||||||
|
|
||||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
|
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
|
||||||
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
|
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
|
||||||
|
|
||||||
# export grep settings
|
# export grep settings
|
||||||
alias grep="grep $GREP_OPTIONS"
|
alias grep="grep $GREP_OPTIONS"
|
||||||
|
|
||||||
|
@ -185,11 +188,8 @@
|
||||||
testPath="$HOME/.fzf.zsh"
|
testPath="$HOME/.fzf.zsh"
|
||||||
[ -f "$testPath" ] && source $testPath
|
[ -f "$testPath" ] && source $testPath
|
||||||
|
|
||||||
#starship
|
|
||||||
eval "$(starship init zsh)"
|
|
||||||
|
|
||||||
#zoxide stuff
|
#zoxide stuff
|
||||||
command -v zoxide && eval "$(zoxide init zsh)"
|
command -v zoxide &> /dev/null && eval "$(zoxide init zsh)"
|
||||||
|
|
||||||
#check for existence of pyenv before setting it up.
|
#check for existence of pyenv before setting it up.
|
||||||
if command -v pyenv &> /dev/null; then
|
if command -v pyenv &> /dev/null; then
|
||||||
|
|
Loading…
Reference in a new issue