Skip to content

Commit

Permalink
feat(zsh): switch to vi mode by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ojroques committed Nov 29, 2024
1 parent 6b7bb88 commit fb75aae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion zsh/.config/zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# ZSH OPTIONS
bindkey -e
setopt glob_dots
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
Expand All @@ -12,6 +11,20 @@ HISTORY_IGNORE="(cd|dl|doc|ls|t|tmp|up|wk)"
HISTSIZE=10000
SAVEHIST=10000

# ZLE
bindkey -v
bindkey -M main jj vi-cmd-mode
bindkey -M main ^P up-history
bindkey -M main ^N down-history
function zle-line-init zle-keymap-select {
case $KEYMAP in
vicmd) printf "\e[2 q";; # steady block
main) printf "\e[6 q";; # steady bar
esac
}
zle -N zle-line-init
zle -N zle-keymap-select

# FPATH
typeset -U fpath
fpath=("$XDG_DATA_HOME/zsh/functions" "$XDG_DATA_HOME/zsh/prompt" $fpath)
Expand Down
6 changes: 3 additions & 3 deletions zsh/.local/share/zsh/prompt/prompt_personal_setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

function prompt_personal_precmd {
vcs_info
git=""
prompt_git=""
if [[ -n $vcs_info_msg_0_ ]]; then
git=" · %F{yellow}${vcs_info_msg_0_}%f"
prompt_git=" · %F{yellow}${vcs_info_msg_0_}%f"
fi
}

function prompt_personal_setup {
prompt_opts=(cr sp percent subst)
add-zsh-hook precmd prompt_personal_precmd
PS1='%F{green}%n@%M%f · %B%F{blue}%~%f%b${git}%(?.. · %B%F{red}%?%f%b)${prompt_newline}%F{magenta}%#%f '
PS1='%F{green}%n@%M%f · %B%F{blue}%~%f%b${prompt_git}%(?.. · %B%F{red}%?%f%b)${prompt_newline}%F{magenta}%#%f '
RPS1=' %F{cyan}%*%f'
PS2='%F{magenta}%_ %#%f '
}
Expand Down

0 comments on commit fb75aae

Please sign in to comment.