aboutsummaryrefslogtreecommitdiff
path: root/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to '.zshrc')
-rw-r--r--.zshrc48
1 files changed, 30 insertions, 18 deletions
diff --git a/.zshrc b/.zshrc
index 9b6df26..a89cc6d 100644
--- a/.zshrc
+++ b/.zshrc
@@ -2,7 +2,21 @@
# Enable colors and change prompt:
autoload -U colors && colors
+
+export GIT_PS1_SHOWUPSTREAM="verbose"
+
PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}$%{$reset_color%}%b "
+
+source /usr/lib/git-core/git-sh-prompt
+
+set_git_prompt() {
+ RPS1="%{$fg[yellow]%} $(__git_ps1 " %s") %{$reset_color%} "
+}
+
+# Add the function to the precmd hook list
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd set_git_prompt
+
#PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " # Luke Conf
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
@@ -36,26 +50,24 @@ bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
-# Change cursor shape for different vi modes.
-function zle-keymap-select {
- if [[ ${KEYMAP} == vicmd ]] ||
- [[ $1 = 'block' ]]; then
- echo -ne '\e[1 q'
- elif [[ ${KEYMAP} == main ]] ||
- [[ ${KEYMAP} == viins ]] ||
- [[ ${KEYMAP} = '' ]] ||
- [[ $1 = 'beam' ]]; then
- echo -ne '\e[5 q'
- fi
-}
-zle -N zle-keymap-select
-zle-line-init() {
- zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
- echo -ne "\e[5 q"
+# Change <> for vi mode
+function zle-line-init zle-keymap-select {
+ if [[ ${KEYMAP} == vicmd ]] ||
+ [[ $1 = 'block' ]]; then
+ PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}<%{$reset_color%}%b "
+ elif [[ ${KEYMAP} == main ]] ||
+ [[ ${KEYMAP} == viins ]] ||
+ [[ ${KEYMAP} = '' ]] ||
+ [[ $1 = 'beam' ]]; then
+ PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}>%{$reset_color%}%b "
+ else
+ PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}v%{$reset_color%}%b "
+ fi
+ zle reset-prompt
}
+
zle -N zle-line-init
-echo -ne '\e[5 q' # Use beam shape cursor on startup.
-preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
+zle -N zle-keymap-select
# Use lf to switch directories and bind it to ctrl-o
lfcd () {