forked from ecly/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
91 lines (70 loc) · 2.36 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
# Utility function to determine whether command is executable or aliased.
_has() {
return $( whence $1 >/dev/null )
}
# Enable desired plugins with oh my zsh
plugins=(git)
PROMPT='[%F{1}%n%f@%F{5}%m%f%F{3}%f]%F{6}~%f '
bindkey -v
vim_ins_mode="%F{2}[INS]%f"
vim_cmd_mode="%F{1}[CMD]%f"
vim_mode=${vim_ins_mode}
function zle-keymap-select {
vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
RPROMPT=${vim_mode}
zle reset-prompt
}
zle -N zle-keymap-select
function zle-line-finish {
vim_mode=$vim_ins_mode
}
zle -N zle-line-finish
RPROMPT=${vim_mode}
# Fix a bug when you C-c in CMD mode and you'd be prompted with CMD mode indicator, while in fact you would be in INS mode
# Fixed by catching SIGINT (C-c), set vim_mode to INS and then repropagate the SIGINT, so if anything else depends on it, we will not break it
# Thanks Ron! (see comments)
function TRAPINT() {
vim_mode=$vim_ins_mode
return $(( 128 + $1 ))
}
# Source colors generated by wal.
source "${HOME}/.cache/wal/colors.sh"
# Source aliases
source "${HOME}/Scripts/aliases.sh"
# Source aliases
source "${HOME}/Scripts/functions.sh"
# Used as directory for binaries for vim go plugin
export GOPATH="${HOME}/Programming/go"
export GOBIN="${GOPATH}/bin"
export PATH=$GOBIN:$PATH
export PATH=~/.local/bin:$PATH
# Stop the lag in vi mode
export KEYTIMEOUT=1
# Set vim as editor, less as pager.
export EDITOR="nvim"
export VISUAL="nvim"
export PAGER="less"
# Don't log duplicate commands.
export HISTCONTROL=ignoredups
# installation directory
export OPAMROOT=~/opam-coq.8.6
export COQBIN=~/opam-coq.8.6/system/bin/
# Opam setup
. /home/ecly/opam-coq.8.6/opam-init/init.zsh > /dev/null 2> /dev/null || true
# Import colorscheme from 'wal'
(cat ~/.cache/wal/sequences &)
# If folder fzf is present with pacman, source binds and completion
if [ -e /usr/share/fzf/key-bindings.zsh ]; then
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
fi
# Use ag for fzf
# Uses same command for all binds - could make this for ALT_C
if _has fzf && _has rg; then
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --follow --glob "!.git/*"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="cd ~/; rg --sort-files --files --null 2> /dev/null | xargs -0 dirname | uniq"
fi
autoload -Uz promptinit
promptinit
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh