forked from mohammedpivotal/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.zsh-init
107 lines (89 loc) · 4.4 KB
/
.zsh-init
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
autoload -U colors zsh-mime-setup zsh-newuser-install
colors
zsh-mime-setup
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
##
# Completion
##
autoload -U compinit
compinit -u
zmodload -i zsh/complist
setopt hash_list_all # hash everything before completion
setopt completealiases # complete alisases
setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
setopt complete_in_word # allow completion from within a word/phrase
setopt correct # spelling correction for commands
setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
zstyle ':completion:*' auto-description 'specify: %d' # Automatic description
zstyle ':completion::complete:*' use-cache on # completion caching, use rehash to clear
zstyle ':completion:*' cache-path ~/.zsh/cache # cache path
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # colorz !
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate # list of completers to use
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' menu select=2 eval "$(dircolors -b)"
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' # ignore case
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
# sections completion !
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format $'\e[00;34m%d'
zstyle ':completion:*:messages' format $'\e[00;31m%d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=29=34"
zstyle ':completion:*:*:killall:*' menu yes select
zstyle ':completion:*:killall:*' force-list always
users=(yogendra admin root) # because I don't care about others
zstyle ':completion:*' users $users
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
#generic completion with --help
compdef _gnu_generic gcc
compdef _gnu_generic gdb
##
# Pushd
##
setopt auto_pushd # make cd push old dir in dir stack
setopt pushd_ignore_dups # no duplicates in dir stack
setopt pushd_silent # no dir stack after pushd or popd
setopt pushd_to_home # `pushd` = `pushd $HOME`
#
##
# History
##
HISTFILE=~/.zsh_history # where to store zsh config
HISTSIZE=5000 # big history
SAVEHIST=5000 # big history
setopt append_history # append
setopt hist_ignore_all_dups # no duplicate
unsetopt hist_ignore_space # ignore space prefixed commands
setopt hist_reduce_blanks # trim blanks
setopt hist_verify # show before executing history commands
setopt inc_append_history # add commands as they are typed, don't wait until shell exit
setopt share_history # share hist between sessions
setopt bang_hist # !keyword
setopt extended_history # keep extended history
setopt inc_append_history_time
##
# Various
##
setopt auto_cd # if command is a path, cd into it
setopt auto_remove_slash # self explicit
setopt chase_links # resolve symlinks
setopt correct # try to correct spelling of commands
setopt extended_glob # activate complex pattern globbing
# setopt glob_dots # include dotfiles in globbing
# setopt print_exit_value # print return value if non-zero
unsetopt beep # no bell on error
unsetopt bg_nice # no lower prio for background jobs
# unsetopt clobber # must use >| to truncate existing files
unsetopt hist_beep # no bell on error in history
unsetopt hup # no hup signal at shell exit
unsetopt ignore_eof # do not exit on end-of-file
unsetopt list_beep # no bell on ambiguous completion
unsetopt rm_star_silent # ask for confirmation for `rm *' or `rm path/*'
autoload -Uz $(ls -1 --color=never $DOTFILES_DIR/.zsh/zsh-functions | tr \\n ' ')