-
Notifications
You must be signed in to change notification settings - Fork 22
/
misc.zsh
81 lines (67 loc) · 2.16 KB
/
misc.zsh
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
#
# misc.zsh - Miscellaneous zsh-specific configuration
#
# Sets up oh-my-zsh, some completions, fixes ^H and backspace, and more.
#
# Author
# Jake Zimmerman <jake@zimmerman.io>
#
# Usage
# Source this file.
#
# Notes
# I copied most of this from the zshrc of Tom Shen <tom@shen.io>. I
# understand very little of it, but I understand enough to know what I
# changed, which is generally speaking the commented stuff.
#
# TODOs
# - This could be more modular.
# Load oh-my-zsh
DISABLE_AUTO_UPDATE="true"
export CASE_SENSITIVE="true"
export ZSH="$HOME/.oh-my-zsh/"
plugins=(brew brew-cask)
source $ZSH/oh-my-zsh.sh
# General zshzle options
setopt autocd # cd by just typing in a directory name
setopt completealiases
#setopt extendedglob # use #, ^, and ~ as glob characters
setopt nomatch
setopt no_case_glob
# Turn on vi keybindings <3 <3 <3 :D and other things
bindkey -v
bindkey "^?" backward-delete-char
bindkey "^W" backward-kill-word
bindkey "^U" backward-kill-line
# Make ^H and backspace behave correctly
bindkey "^H" backward-delete-char
# Tab complete options like Vim rather than sh
setopt -Y
export MENU_COMPLETE=1
# Initialize zsh history files
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# zsh completion (zsh installed through Homebrew)
if [ -e $(which brew &> /dev/null && brew --prefix)/etc/zsh_completion ]; then
source $(brew --prefix)/etc/zsh_completion
fi
zstyle :compinstall filename $HOME/.zshrc
## case-insensitive (all),partial-word and then substring completion
zstyle ':completion:*:*:*:*:*' menu ''
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={a-zA-Z}' #'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# The following line was moved to ~/.util/after.sh to resolve circular dependencies
#zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
zstyle ':completion:*' verbose false
autoload -Uz compinit && compinit
autoload -Uz promptinit && promptinit
# Fix ESC + /
vi-search-fix() {
zle vi-cmd-mode
zle .vi-history-search-backward
}
autoload vi-search-fix
zle -N vi-search-fix
bindkey -M viins '\e/' vi-search-fix
# Plugin for syntax highlighting the command line
source $HOME/.zfunctions/syntax-highlighting/zsh-syntax-highlighting.zsh