diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2022-11-20 20:33:13 +0000 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2022-11-20 20:33:13 +0000 |
| commit | 6b1b61f98813a58286e099d92767e01c2d40bc18 (patch) | |
| tree | a3613fba312e0f324bdbca28ec3d3d0b5e6f6e13 /zsh/config | |
| parent | 6a0e18aab79cefa8cd4917e9a6d121349f41eb3f (diff) | |
Redo deploy script
Diffstat (limited to 'zsh/config')
| -rw-r--r-- | zsh/config/aliases.zsh | 18 | ||||
| -rw-r--r-- | zsh/config/environment.zsh | 12 | ||||
| -rw-r--r-- | zsh/config/prompt.zsh | 42 |
3 files changed, 72 insertions, 0 deletions
diff --git a/zsh/config/aliases.zsh b/zsh/config/aliases.zsh new file mode 100644 index 0000000..261161f --- /dev/null +++ b/zsh/config/aliases.zsh @@ -0,0 +1,18 @@ +# Neovim +alias vim="nvim" +alias vi="nvim" +alias vimdiff="nvim -d" + +# Python version +alias python="python3" + +# Ls to exa +alias ls="exa --icons" +alias ll="exa -lbhF --icons --git" +alias llm="exa -lbhd --icons --git --sort=modified" +alias la="exa -lbahF --icons --git" +alias lA="exa -lbhHigUmuSa --icons --time-style=long-iso --git --color-scale" +alias lx="exa -lbhHigUmuSa@ --icons --time-style=long-iso --git --color-scale" +alias lS="exa -1" +alias lt="exa --tree --level=2" + diff --git a/zsh/config/environment.zsh b/zsh/config/environment.zsh new file mode 100644 index 0000000..fdea1da --- /dev/null +++ b/zsh/config/environment.zsh @@ -0,0 +1,12 @@ +DEFAULT_USER="leonardo" + +ZSH_CONFIG=$HOME/.config/zsh + +# Oh-my-zsh +export ZSH="$HOME/.oh-my-zsh" + +# User /bin +export PATH="$HOME/bin:$PATH" + +# Exa colours +export EXA_COLORS="uu=37:un=37:gu=37:gn=37:da=37" diff --git a/zsh/config/prompt.zsh b/zsh/config/prompt.zsh new file mode 100644 index 0000000..1a9776b --- /dev/null +++ b/zsh/config/prompt.zsh @@ -0,0 +1,42 @@ +autoload -Uz vcs_info + +directory() { + echo "%{$fg_bold[magenta]%}%~%{$reset_color%}" +} + +current_time() { + echo "%{$fg[white]%}[%*]" +} + +return_status() { + local LAST_EXIT_CODE=$? + if [[ $LAST_EXIT_CODE -ne 0 ]]; then + local EXIT_CODE_PROMPT=' ' + EXIT_CODE_PROMPT+="%{$fg_bold[red]%}$LAST_EXIT_CODE%{$reset_color%}" + echo "$EXIT_CODE_PROMPT " + fi +} + +precmd() { + vcs_info + VCS_STATUS="" + if [[ -n ${vcs_info_msg_0_} ]]; then + STATUS=$(command git status --porcelain 2> /dev/null | tail -n1) + if [[ -n $STATUS ]]; then + VCS_STATUS="(%F{yellow}${vcs_info_msg_0_}%f) " + else + VCS_STATUS="(%F{green}${vcs_info_msg_0_}%f) " + fi + fi + PROMPT='%B$(directory)%b %# %f' + RPROMPT='$(return_status)${VCS_STATUS}$(current_time)%f' +} + +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:git*' formats "%b%u%c" +zstyle ':vcs_info:git*' actionformats "%b|%a%u%c" +zstyle ':vcs_info:*' unstagedstr ' *' +zstyle ':vcs_info:*' stagedstr ' +' + +setopt prompt_subst + |
