summaryrefslogtreecommitdiff
path: root/.zshrc
blob: e209eb6dd3f2d1c42eedbd61d44b1042a8082a2e (plain) (blame)
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
autoload -Uz zmv
autoload -U compinit colors zcalc
compinit -d
colors

## Autoload

# chcwd hook to open new shells in same CWD
[ -r /tmp/.cwd ] && cd "$(< /tmp/.cwd)"
set_cwd() {
	$(pwd > /tmp/.cwd)
}
autoload -Uz add-zsh-hook
add-zsh-hook chpwd set_cwd

## Options 
setopt correct                                                  # Auto correct mistakes
setopt extendedglob                                             # Extended globbing. Allows using regular expressions with *
setopt nocaseglob                                               # Case insensitive globbing
setopt rcexpandparam                                            # Array expansion with parameters
setopt nocheckjobs                                              # Don't warn about running processes when exiting
setopt numericglobsort                                          # Sort filenames numerically when it makes sense
setopt nobeep                                                   # No beep
setopt appendhistory                                            # Immediately append history instead of overwriting
setopt histignorealldups                                        # If a new command is a duplicate, remove the older one
setopt autocd                                                   # if only directory path is entered, cd there
unsetopt beep nomatch notify
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'       # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"         # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true                              # automatically find new executables in path
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path $HOME/.zsh/cache
HISTFILE=$HOME/.zhistory
HISTSIZE=1000
SAVEHIST=100000
WORDCHARS=${WORDCHARS//[&.;]}                                 # Don't consider certain characters part of the word

## Keybindings 
bindkey -v

## Aliases 
[ -f "$HOME/.config/aliasrc" ] && . "$HOME/.config/aliasrc"

## Plugins
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # syntax highlighting
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh # autosuggestions
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'

## Git Branch
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
zstyle ':vcs_info:git:*' formats '├ %b'$'\n'

## Prompt
RPROMPT=$'%(?.%t.%? %t)'
PROMPT=$'\n╭ %B$fg[cyan]%(4~|%-1~/.../%2~|%~)%b\n\$vcs_info_msg_0_╰ %# '