mirror of
https://github.com/Smaug123/nix-dotfiles
synced 2025-10-11 17:38:41 +00:00
Split into modules (#50)
This commit is contained in:
31
home-manager/modules/zsh/zshrc
Normal file
31
home-manager/modules/zsh/zshrc
Normal file
@@ -0,0 +1,31 @@
|
||||
prompt_custom() {
|
||||
local cyan='%F{cyan}'
|
||||
local red='%F{red}'
|
||||
local blue='%F{blue}'
|
||||
local reset_color='%f'
|
||||
|
||||
local git_info=$(git symbolic-ref --short HEAD 2> /dev/null || git describe --tags --exact-match 2> /dev/null || git rev-parse --short HEAD 2> /dev/null)
|
||||
if [[ -n "$git_info" ]]; then
|
||||
# escape the percent character, which is the only zsh prompt metacharacter
|
||||
git_info=$git_info:s/%/%%/
|
||||
git_info=" ${blue}git:${reset_color}${red}(${git_info})${reset_color}"
|
||||
else
|
||||
git_info=""
|
||||
fi
|
||||
|
||||
# %1 is the name of cwd
|
||||
PROMPT="${cyan}%1~${reset_color}${git_info} > "
|
||||
}
|
||||
|
||||
# Full path to cwd, with `~` for any initial home component, in light green,
|
||||
RPROMPT='%F{155}%~%f'
|
||||
|
||||
precmd_functions+=(prompt_custom)
|
||||
|
||||
export WORDCHARS=''
|
||||
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^X^E' edit-command-line
|
||||
|
||||
PATH="$PATH:$HOME/.cargo/bin"
|
Reference in New Issue
Block a user