Differences between revisions 1 and 2
Revision 1 as of 2021-10-23 08:05:49
Size: 312
Editor: PieterSmit
Comment:
Revision 2 as of 2022-08-05 09:57:25
Size: 1152
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
source <(kubectl completion zsh) autoload -Uz compinit
compinit
echo "load kubectl auto completion for zsh $SHELL"
[[ $commands[kubectl] ]] && source <(kubectl completion zsh)
Line 12: Line 15:
Line 13: Line 17:


 * git prompt {{{
autoload -U colors && colors

## git prompt built into zsh
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
# %s=git %r=gitRoot %S=gitPath $b=branch %m=stash %u=unstagedChanges %c=stagedChanges
# zstyle ':vcs_info:git:*' formats 'on branch %b'
zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%s %{$reset_color%}%r%{$fg[grey]%} %{$fg[blue]%}[%b]%{$reset_color%}%m%u%c%{$reset_color%} "
#zstyle ':vcs_info:git*' actionformats "%s %r/%S %b %m%u%c "

# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
#PROMPT='%n in ${PWD/#$HOME/~} ${vcs_info_msg_0_} > '
PROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~} > '

}}}

Linux/zsh

  • Alternate to standard bash shell

  • If not prompted to configure zsh on first use, force with

    autoload -U zsh-newuser-install
    zsh-newuser-install -f
  • to add k8s auto complete, add to end of ~/.zshrc

    autoload -Uz compinit
    compinit
    echo "load kubectl auto completion for zsh $SHELL"
    [[ $commands[kubectl] ]] && source <(kubectl completion zsh)
    alias k=kubectl
  • git prompt

    autoload -U colors && colors 
    
    ## git prompt built into zsh
    # Load version control information
    autoload -Uz vcs_info
    precmd() { vcs_info }
    # Format the vcs_info_msg_0_ variable
    # %s=git %r=gitRoot %S=gitPath $b=branch %m=stash %u=unstagedChanges %c=stagedChanges
    # zstyle ':vcs_info:git:*' formats 'on branch %b'
    zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%s %{$reset_color%}%r%{$fg[grey]%} %{$fg[blue]%}[%b]%{$reset_color%}%m%u%c%{$reset_color%} "
    #zstyle ':vcs_info:git*' actionformats "%s  %r/%S %b %m%u%c "
    
    # Set up the prompt (with git branch name)
    setopt PROMPT_SUBST
    #PROMPT='%n in ${PWD/#$HOME/~} ${vcs_info_msg_0_} > '
    PROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~} > '

Linux/zsh (last edited 2022-08-05 09:59:24 by PieterSmit)