Last active
June 21, 2025 05:46
-
-
Save trungklam/f75b305698579e15742ed98d97108961 to your computer and use it in GitHub Desktop.
Setup zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnf install -y git zsh hstr unzip epel-release | |
dnf config-manager --set-enabled powertools | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions | |
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search | |
git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins $ZSH_CUSTOM/plugins/autoupdate | |
git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z | |
curl -s https://ohmyposh.dev/install.sh | bash -s | |
mkdir ~/.poshthemes | |
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip | |
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes | |
chmod u+rw ~/.poshthemes/*.omp.* | |
rm ~/.poshthemes/themes.zip | |
// Fix pyenv | |
sudo dnf install -y bzip2-devel ncurses-devel sqlite-devel libffi-devel | |
~/.zshrc | |
plugins=( | |
git | |
autoupdate | |
zsh-history-substring-search | |
zsh-z | |
zsh-autosuggestions | |
zsh-syntax-highlighting | |
zsh-completions | |
) | |
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src | |
eval "$(oh-my-posh init zsh --config /home/admin/.poshthemes/pure-custom.omp.json)" | |
alias ll='ls -lah --group-directories-first' | |
alias c=clear | |
source <(kubectl completion zsh) | |
alias k=kubectl | |
complete -F __start_kubectl k | |
# HSTR configuration | |
alias hh=hstr # hh to be alias for hstr | |
setopt histignorespace # skip cmds w/ leading space from history | |
export HSTR_CONFIG=hicolor # get more colors | |
bindkey -s "\C-r" "\C-a hstr -- \C-j" # bind hstr to Ctrl-r (for Vi mode check doc) | |
# color for linux | |
# LS_COLORS+=:ow= | |
# ZSH option | |
setopt RM_STAR_SILENT | |
export HOMEBREW_NO_AUTO_UPDATE=1 | |
export EDITOR="code --wait" | |
// Theme | |
// pure-custom.omp.json | |
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"blocks": [ | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"foreground": "#00B3BD", | |
"style": "plain", | |
"template": "{{ .UserName }} ", | |
"type": "session" | |
}, | |
{ | |
"foreground": "#78dce8", | |
"properties": { | |
"style": "full" | |
}, | |
"style": "plain", | |
"template": "{{ .Path }} ", | |
"type": "path" | |
} | |
], | |
"type": "prompt" | |
}, | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"foreground": "#fc9867", | |
"properties": { | |
"branch_ahead_icon": "<#a9dc76>\u21e1 </>", | |
"branch_behind_icon": "<#a9dc76>\u21e3 </>", | |
// "branch_icon": "", | |
"fetch_stash_count": false, | |
"fetch_status": false, | |
"fetch_upstream_icon": false, | |
"github_icon": "" | |
}, | |
"style": "plain", | |
"type": "git" | |
} | |
], | |
"type": "prompt" | |
}, | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"foreground": "#A3BE8C", | |
"properties": { | |
"style": "austin" | |
}, | |
"style": "plain", | |
"template": " {{ .FormattedMs }} ", | |
"type": "executiontime" | |
} | |
], | |
"type": "prompt" | |
}, | |
{ | |
"alignment": "left", | |
"newline": true, | |
"segments": [ | |
{ | |
"foreground": "#77e98b", | |
"foreground_templates": [ | |
"{{ if gt .Code 0 }}#77e98b{{ end }}" | |
], | |
"properties": { | |
"always_enabled": true | |
}, | |
"style": "plain", | |
"template": "\u276f ", | |
"type": "status" | |
} | |
], | |
"type": "prompt" | |
} | |
], | |
"console_title_template": "{{if .Root}}(Admin){{end}} {{.PWD}}", | |
"transient_prompt": { | |
"foreground": "#ff6188", | |
"foreground_templates": [ | |
"{{ if gt .Code 0 }}#ff6188{{ end }}" | |
], | |
"template": "\u276f " | |
}, | |
"version": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment