Przeglądaj źródła

~/.zshrc: Why? Convenience.

Better completion out of the box, fancier & better prompt.
Lucas Stadler 13 lat temu
rodzic
commit
ad1b7b5435
1 zmienionych plików z 43 dodań i 0 usunięć
  1. 43 0
      .zshrc

+ 43 - 0
.zshrc

@ -0,0 +1,43 @@
1
# The following lines were added by compinstall
2
3
zstyle ':completion:*' completer _complete _ignored
4
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-/]=** r:|=**'
5
zstyle :compinstall filename '/home/lu/.zshrc'
6
7
autoload -Uz compinit
8
compinit
9
# End of lines added by compinstall
10
# Lines configured by zsh-newuser-install
11
HISTFILE=~/.zsh_history
12
HISTSIZE=10000
13
SAVEHIST=1000
14
setopt autocd extendedglob
15
# End of lines configured by zsh-newuser-install
16
17
function repo_char {
18
	#hg root >/dev/null 2> /dev/null && echo '☿' && return
19
	git branch > /dev/null 2> /dev/null && echo "±" && return
20
	echo "∅"
21
}
22
23
function repo_branch {
24
	if git branch > /dev/null 2> /dev/null; then
25
		echo "%{$fg[green]%}$(git branch --no-color | sed -En 's/^\* (.*)/\1/p')%{$reset_color%}"
26
	fi
27
}
28
29
autoload colors && colors
30
function precmd {
31
	user="%{$fg[red]%}%n%{$reset_color%}"
32
	dir="%{$fg[cyan]%}%~%{$reset_color%}"
33
	lastcmd="$history[$(($HISTCMD-1))]"
34
	lastcmd_witherror="%(?.$lastcmd.%S$lastcmd%s)"
35
	PROMPT="$user in $dir@$(repo_branch) $lastcmd_witherror
36
$(repo_char) $ "
37
	RPROMPT="%D{%Y-%m-%d} %{$fg[red]%}%t%{$reset_color%}"
38
}
39
40
bindkey $terminfo[kend]  end-of-line
41
bindkey $terminfo[khome] beginning-of-line
42
bindkey $terminfo[kdch1] delete-char
43
bindkey  history-incremental-search-backward