.zshrc
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 26 Jan 2017 14:55:51 +0200
changeset 819 6d313c0c6247
parent 749 89208f64214c
child 826 54d42c57cc4d
permissions -rw-r--r--
Do not duplicate completion if we in the middle of the word.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
215
7b1b6872e92e Include system wide /etc/zshrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 214
diff changeset
     1
7b1b6872e92e Include system wide /etc/zshrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 214
diff changeset
     2
if [[ -e /etc/zshrc ]]; then
7b1b6872e92e Include system wide /etc/zshrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 214
diff changeset
     3
. /etc/zshrc
7b1b6872e92e Include system wide /etc/zshrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 214
diff changeset
     4
fi
179
ed15e30ff41a Set editor to VIM. Bind edit command for shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 177
diff changeset
     5
653
a5566b182446 Use .env file as common env var settings for Bash and Zsh.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 651
diff changeset
     6
if [[ -f ~/.env ]]; then
a5566b182446 Use .env file as common env var settings for Bash and Zsh.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 651
diff changeset
     7
  . ~/.env
a5566b182446 Use .env file as common env var settings for Bash and Zsh.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 651
diff changeset
     8
fi
172
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
180
176106ed8e46 Set prompt for shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 179
diff changeset
    10
PS1='zsh# '
176106ed8e46 Set prompt for shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 179
diff changeset
    11
651
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    12
HISTFILE=~/.zsh_history
214
7d52ae0eda9b Increase HIST size.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 181
diff changeset
    13
HISTSIZE=10000
7d52ae0eda9b Increase HIST size.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 181
diff changeset
    14
SAVEHIST=10000
172
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
651
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    16
setopt AUTO_CD
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    17
setopt BEEP
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    18
setopt NOMATCH
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    19
setopt NOTIFY
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    20
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    21
setopt APPEND_HISTORY
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    22
setopt EXTENDED_HISTORY
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    23
setopt HIST_EXPIRE_DUPS_FIRST
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    24
setopt HIST_IGNORE_ALL_DUPS
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    25
setopt HIST_IGNORE_SPACE
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    26
setopt HIST_NO_FUNCTIONS
177
95c784cc8cbb History settings for zsh.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 172
diff changeset
    27
651
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    28
setopt MENUCOMPLETE
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    29
# Use completion cache
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    30
zstyle ':completion:*' use-cache on
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    31
zstyle ':completion:*' cache-path ~/.zsh/cache
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    32
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    33
# Ignore SCM revision files
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    34
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)(CVS|.svn|.git)'
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    35
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#(CVS|.svn|.git)'
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    36
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    37
# Fuzzy completion
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    38
zstyle ':completion:*' completer _expand _complete _match _approximate
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    39
zstyle ':completion:*:match:*' original only
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    40
zstyle ':completion:*:approximate:*' max-errors 1 numeric
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    41
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    42
# Do not attempt to complete missing commands
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    43
#zstyle ':completion:*:functions' ignored-patterns '_*'
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    44
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    45
# Complete PIDS with menu
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    46
zstyle ':completion:*:*:kill:*' menu yes select
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    47
zstyle ':completion:*:kill:*' force-list always
172
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
179
ed15e30ff41a Set editor to VIM. Bind edit command for shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 177
diff changeset
    49
autoload -U edit-command-line
ed15e30ff41a Set editor to VIM. Bind edit command for shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 177
diff changeset
    50
zle -N edit-command-line
ed15e30ff41a Set editor to VIM. Bind edit command for shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 177
diff changeset
    51
bindkey '\ee' edit-command-line
ed15e30ff41a Set editor to VIM. Bind edit command for shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 177
diff changeset
    52
172
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
# Emacs like editing.
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
bindkey -e
755ff9f067d0 zsh basic settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
749
89208f64214c history-beginning-search-backward
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
    56
bindkey '^[[A' history-beginning-search-backward
89208f64214c history-beginning-search-backward
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
    57
bindkey '^[[B' history-beginning-search-forward
89208f64214c history-beginning-search-backward
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
    58
89208f64214c history-beginning-search-backward
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
    59
# bindkey "^[[A" history-search-backward
89208f64214c history-beginning-search-backward
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
    60
# bindkey "^[[B" history-search-forward
243
843cc9d49dc2 Enable history search.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 215
diff changeset
    61
651
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    62
autoload -U zutil
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    63
245
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    64
autoload -U compinit
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    65
compinit
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    66
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    67
# autoload -U promptinit
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    68
# promptinit
aefd2167af31 Enable completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 243
diff changeset
    69
# prompt walters
651
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    70
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    71
# Renaming with globbing
649cbbab7ded Add new and update old entries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
    72
# autoload zmv