From 924c8aebe4c20b569ef202e3ea2bf60922f3b49b Mon Sep 17 00:00:00 2001 From: Arthur Date: Sun, 15 Oct 2023 21:39:50 +0300 Subject: [PATCH] Add git plugin to .zshrc --- .gitmodules | 3 +++ .local/share/zsh-plugins/git-prompt.zsh | 1 + .zshrc | 30 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 .gitmodules create mode 160000 .local/share/zsh-plugins/git-prompt.zsh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..580e8fd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".local/share/zsh-plugins/git-prompt.zsh"] + path = .local/share/zsh-plugins/git-prompt.zsh + url = https://github.com/woefe/git-prompt.zsh diff --git a/.local/share/zsh-plugins/git-prompt.zsh b/.local/share/zsh-plugins/git-prompt.zsh new file mode 160000 index 0000000..55f40bd --- /dev/null +++ b/.local/share/zsh-plugins/git-prompt.zsh @@ -0,0 +1 @@ +Subproject commit 55f40bdfb287122ea50c1c01ef056ca7dac175e5 diff --git a/.zshrc b/.zshrc index 58bce67..c102470 100644 --- a/.zshrc +++ b/.zshrc @@ -2,6 +2,13 @@ HISTSIZE=10000000 SAVEHIST=10000000 HISTFILE="$HOME/.cache/zsh_history" +setopt inc_append_history +setopt extended_history +setopt hist_find_no_dups + +# change word-style +autoload -U select-word-style +select-word-style b # misc setopt extendedglob @@ -15,6 +22,7 @@ compinit # prompt autoload -U colors && colors PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " +RPROMPT='$(gitprompt)' # ls aliases alias ls="ls --color=auto" @@ -25,3 +33,25 @@ alias ll="ls -lh" alias dt="git --git-dir=$HOME/.dotfiles/git --work-tree=$HOME" alias rz="exec zsh" alias bat="batcat" + +# theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[red]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[red]%}]" +ZSH_THEME_GIT_PROMPT_SEPARATOR=" " +ZSH_THEME_GIT_PROMPT_DETACHED="%{$fg_bold[cyan]%}:" +ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}" +ZSH_THEME_GIT_PROMPT_UPSTREAM_SYMBOL="%{$fg_bold[yellow]%}⟳ " +ZSH_THEME_GIT_PROMPT_UPSTREAM_NO_TRACKING="%{$fg_bold[red]%}!" +ZSH_THEME_GIT_PROMPT_UPSTREAM_PREFIX="%{$fg[red]%}(%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_UPSTREAM_SUFFIX="%{$fg[red]%})" +ZSH_THEME_GIT_PROMPT_BEHIND="↓" +ZSH_THEME_GIT_PROMPT_AHEAD="↑" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}x" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[green]%}*" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[red]%}+" +ZSH_THEME_GIT_PROMPT_UNTRACKED="…" +ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}s" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}v" + +# plugins +source "$HOME/.local/share/zsh-plugins/git-prompt.zsh/git-prompt.zsh"