-
Notifications
You must be signed in to change notification settings - Fork 2
/
dot_zshrc.tmpl
113 lines (86 loc) · 2.7 KB
/
dot_zshrc.tmpl
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
#!/bin/zsh
# TODO consider
#if [ -f /etc/profile ]; then
# . /etc/profile
#fi
# History options
export HISTSIZE=99999999
export HISTFILE=$HOME/.zsh_history
export SAVEHIST=99999999
setopt append_history
setopt inc_append_history
setopt HIST_VERIFY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_REDUCE_BLANKS
# The AUTO_PUSHD option lets you use cd to get back to any directory you've ever cd'ed to. Without this option you are only able to get back to the previous directory you've cd'ed to but with this option you can use something like cd -5 to get back to the 5th directory you've visited.
setopt AUTO_PUSHD
# Pushd
DIRSTACKSIZE=20
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_TO_HOME
# Auto completion
setopt AUTO_LIST
setopt AUTO_MENU
setopt LIST_AMBIGUOUS
setopt LIST_PACKED
setopt LIST_TYPES
# Regexp
setopt BAD_PATTERN
# Internal
setopt HIST_FCNTL_LOCK
# Misc
setopt INTERACTIVE_COMMENTS
# Key bindings
bindkey -v
bindkey "^R" history-incremental-search-backward
# press M-CR to accept and keep the completion going
#bindkey '\e^M' accept-and-menu-complete
# Ctrl-E to launch line editor
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^E' edit-command-line
# Automatically quote meta-characters in URLs!
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# Tab completion changes
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle :compinstall filename "${HOME}/.zshrc"
# Prompts
export SPROMPT="Potential spelling error %R , could be %r"
ctx=""
if test -n "${TMUX}"; then
ctx="${ctx}:tmux"
if test "$SHLVL" -gt 2; then
ctx="${ctx}:${SHLVL}"
fi
else
if test "$SHLVL" -gt 1; then
ctx="${ctx}:${SHLVL}"
fi
fi
if test -n "${ctx}"; then
ctx="(${ctx})"
fi
export PROMPT="%("'!'".%S%n%s.%n)@%m:%d %h ${ctx}"$'\n'"%# "
unset ctx
# Helper stuff
#setopt autocd
setopt interactivecomments # Enable comments in interactive mode (useful)
#setopt extended_glob # More powerful glob features
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
autoload -Uz compinit
compinit
# Colours and aliases
autoload -U colors && colors
{{ template "shell-aliases.tmpl" $ }}
#{{ if eq .chezmoi.os "darwin" }} Darwin
#{{ else if eq .chezmoi.os "linux" }} Linux
#{{ else if eq .chezmoi.os "windows" }} Windows
#{{ end }} End OS Specific code
{{ template "shell-term-env.tmpl" $ }}
{{ template "shell-man-env.tmpl" $ }}
{{ template "dev-utils-env.tmpl" $ }}
{{ template "atuin.tmpl" deepCopy $ | merge (dict "shell" "zsh") }}
return # This prevents scripts which append their own installers from "working"
{{/* vim: set filetype=zsh: */}}