forked from mattfoster/zshkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc
128 lines (109 loc) · 4.31 KB
/
rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
setopt nobeep # No beeping
setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME
setopt AUTOCD # cd by typing dirname
setopt cdablevars # Follow variables which are dirnames
setopt interactivecomments # allow comments on cmd line.
# setopt SH_WORD_SPLIT # split up var in "for x in *"
setopt MULTIOS # Allow multiple redirection echo 'a'>b>c
setopt CORRECT CORRECT_ALL # Try to correct command line spelling
setopt BANG_HIST # Allow ! for accessing history
setopt NOHUP # Don't HUP running jobs on logout.
setopt NOBGNICE # Don't renice background jobs
setopt EXTENDED_GLOB # Enable extended globbing
# TERM specific options
case $TERM in
screen)
setopt ignore_eof
;;
xterm*|rxvt|ansi)
;;
esac
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' use-cache on
zstyle ':completion:*' users resolve
# use dircolours in completion listings
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# Enable menu completion
zstyle ':completion*:default' menu 'select=1'
# allow approximate matching
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*' auto-description 'Specify: %d'
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' verbose true
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \
'*?.(o|c~|zwc)' '*?~'
# only java files for javac
zstyle ':completion:*:javac:*' files '*.java'
# no binary files for vi or textmate
zstyle ':completion:*:vi:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)'
zstyle ':completion:*:mate:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)'
zstyle ':completion:*:vim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)'
zstyle ':completion:*:gvim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)'
# no binary files for less
zstyle ':completion:*:less:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps|pyc)'
zstyle ':completion:*:zless:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps|pyc)'
# pdf for xpdf
zstyle ':completion:*:xpdf:*' files '*.pdf'
# tar files
zstyle ':completion:*:tar:*' files '*.tar|*.tgz|*.tz|*.tar.Z|*.tar.bz2|*.tZ|*.tar.gz'
# latex to the fullest
# for printing
zstyle ':completion:*:xdvi:*' files '*.dvi'
zstyle ':completion:*:dvips:*' files '*.dvi'
# Group relatex matches:
zstyle ':completion:*' group-name ''
zstyle ':completion:*:-command-:*:(commands|builtins|reserved-words-aliases)' group-name commands
# Separate man page sections
zstyle ':completion:*:manuals' seperate-sections true
# Separate comand line options and descriptions with #
zstyle ':completion:*' list-separator '#'
# Generate descriptions for arguments
zstyle ':completion:*' auto-description 'specify: %d'
# Give long completion options in a list. tab to advance.
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
autoload -Uz compinit
compinit
bash_source() {
alias shopt=':'
alias _expand=_bash_expand
alias _complete=_bash_comp
emulate -L sh
setopt kshglob noshglob braceexpand
source "$@"
}
have() {
unset have
(( ${+commands[$1]} )) && have=yes
}
# Autoload some bash completion functions if they exist.
autoload -Uz bashcompinit
bashcompinit
if [[ -e /etc/bash_completion.d/ack-grep ]];then
bash_source /etc/bash_completion.d/ack-grep
fi
autoload -Uz colors
colors
autoload -Uz is-at-least
if is-at-least 4.3.6; then
autoload -Uz vcs_info
zstyle ':vcs_info:*' disable cdv darcs mtn p4 svk tla
zstyle ':vcs_info:*' enable git cvs svn hg bzr
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' formats '%b '
zstyle ':vcs_info:(svn|bzr|cvs):*' branchformat '%b:%r'
zstyle ':vcs_info:cvs:*' branchformat '%r '
zstyle ':vcs_info:bzr:*' use-simple true
# vcs_info also needs to be in precmd, see: 10_hooks
vcs_info
fi
# Needed for doc function in 03_help.
compdef _doc doc
# Set up completion for bundle function in 05_editor.
compdef _bundle bundle
_cheat() {
compadd print -l ${(s. .)$(cheat sheets | tr -d ' ' | tr '\n' ' ' | sed -e 's/AllCheatSheets://')}
}
compdef _cheat cheat