-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
149 lines (118 loc) · 4.62 KB
/
zshrc
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Disable terminal freeze <C s>
stty -ixon
export EDITOR=nvim
export XMODIFIERS=@im=ibus
setopt COMBINING_CHARS # combine zero-length punctuation characters (accents) with the base character
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
setopt interactive_comments # Allow comments even in interactive shells (especially for Muness)
# ===== Changing Directories
setopt auto_cd # If you type foo, and it isn't a command, and it is a directory in your cdpath, go there
# ===== History
setopt append_history # Allow multiple terminal sessions to all append to one zsh command history
setopt extended_history # save timestamp of command and duration
setopt inc_append_history # Add comamnds as they are typed, don't wait until shell exit
setopt hist_expire_dups_first # when trimming history, lose oldest duplicates first
setopt hist_ignore_dups # Do not write events to history that are duplicates of previous events
setopt hist_ignore_space # remove command line from history list when first character on the line is a space
setopt hist_find_no_dups # When searching history don't display results already cycled through twice
setopt hist_reduce_blanks # Remove extra blanks from each command line being added to history
setopt hist_verify # don't execute, just expand history
setopt share_history # imports new commands and appends typed commands to history
# Enable ^, see https://github.com/robbyrussell/oh-my-zsh/issues/449#issuecomment-6973326
setopt NO_NOMATCH
bindkey -v
# End of lines configured by zsh-newuser-install
set -k
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
bindkey -v
export KEYTIMEOUT=1
bindkey '^P' up-history
bindkey '^N' down-history
# check for tmux plugin manager
if [[ ! -d ~/.tmux/plugins/tpm ]];
then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
if [[ ! -d ~/.asdf ]]
then
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.4
fi
. $HOME/.asdf/asdf.sh
# 'ls' pretty colors
alias ls='ls --color=auto'
autoload colors && colors
[[ $- != *i* ]] && return
[[ -z "$TMUX" ]] && tmux new-session -A -s main
# fuzzy finder
[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
# should be place in .xinitrc
if type xcape &> /dev/null; then
# Remap CapsLock to Left-Control
setxkbmap -option ctrl:nocaps
# make short-pressed Ctrl behave like Escape:
if [ "$(ps aux | grep 'xcape -e Control_L Escape' | wc -l)" -eq "1" ];
then
xcape -e 'Control_L=Escape'
fi
fi
# --files: List files that would be searched but do not search
# --hidden: Search hidden files and folders
# --follow: Follow symlinks
# --glob: Additional conditions for search (in this case ignore everything in the .git/ folder)
export FZF_DEFAULT_COMMAND='rg --colors line:fg:yellow \
--colors line:style:bold \
--colors path:fg:green \
--colors path:style:bold \
--colors match:fg:black \
--colors match:bg:yellow \
--colors match:style:nobold \
--files --no-ignore --hidden --follow \
--glob "!{.git,node_modules,vendor}/*"'
[[ -f ~/.zsh_env ]] && source ~/.zsh_env
[[ -f ~/.aliases ]] && source ~/.aliases
zstyle :compinstall filename '/home/ricardo/.zshrc'
# ZSH extensions
# git-completion or ohmyzsh::gitfast
if [[ ! -d ~/.zsh/git-completion ]]
then
git clone https://github.com/felipec/git-completion.git "$HOME/.zsh/git-completion"
(cd $HOME/.zsh/git-completion && make install)
fi
fpath+=(~/.local/share/git-completion/zsh)
source ~/.local/share/git-completion/prompt.sh
# zsh-completions
if [[ ! -d ~/.zsh/zsh-completions ]]
then
git clone https://github.com/zsh-users/zsh-completions.git "$HOME/.zsh/zsh-completions"
rm -f ~/.zcompdump
fi
fpath+=($HOME/.zsh/zsh-completions/src)
# pure theme/prompt
if [[ ! -d ~/.zsh/pure ]]
then
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
fi
fpath+=($HOME/.zsh/pure)
# fish-like autosuggestions
if [[ ! -d ~/.zsh/zsh-autosuggestions ]]
then
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
fi
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
autoload -Uz compinit promptinit; promptinit
# Check zcompdump once a day: https://gist.github.com/ctechols/ca1035271ad134841284
if [ "$(find ~/.zcompdump -mtime 1)" ] ; then
compinit
else
compinit -C
fi
prompt pure
[ -d ~/.fzf/bin ] && export PATH="$HOME/.fzf/bin:$PATH"
[ -d ~/.cargo/bin ] && export PATH="$HOME/.cargo/bin:$PATH"