/
.zshrc
102 lines (82 loc) · 3.55 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
for filename in $ZDOTDIR/{options,completion,keybindings,commands,prompt}.zsh; do
source $filename
done
unset filename
#--- Modules -----------------------------------------------------------------
autoload -U zcalc
#--- Misc --------------------------------------------------------------------
export CTAGS="--exclude=@$XDG_CONFIG_HOME/git/ignore"
export BUNDLE_CONFIG=$XDG_CONFIG_HOME/bundler/config
export GIT_TEMPLATE_DIR=$XDG_CONFIG_HOME/git/template
export HTTPIE_CONFIG_DIR=$XDG_CONFIG_HOME/httpie
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npmrc
export INPUTRC=$XDG_CONFIG_HOME/inputrc
export NOTMUCH_CONFIG=$XDG_CONFIG_HOME/notmuch/config
export PERL_CPANM_HOME=$XDG_CACHE_HOME/cpanm
export PIP_CONFIG_FILE=$XDG_CONFIG_HOME/pip/config
export TASKRC=$XDG_CONFIG_HOME/taskrc
export PYTHONSTARTUP=$XDG_CONFIG_HOME/python/rc.py
export PYTHONBREAKPOINT=pudb.set_trace
export PYTHONDONTWRITEBYTECODE=true
export PYTHON_TEST_RUNNER=virtue
pywarnings=(
default
'ignore:Not importing directory:ImportWarning'
'ignore:can''t resolve package from __spec__ or __package__:ImportWarning'
'ignore:DEPRECATION::pip._internal.cli.base_command'
'ignore:attrs''s zope-interface support:DeprecationWarning'
'ignore:pkg_resources is deprecated as an API:DeprecationWarning'
'ignore:Creating a LegacyVersion:DeprecationWarning'
'ignore:Providing the line is now done:DeprecationWarning'
'ignore:Providing the column is now done'
'ignore:Deprecated since version 0.16.0. Use Script(...)'
)
export GPG_TTY=$(tty)
if [[ "$(grep --version)" =~ "BSD" ]]; then
else
GREP_OPTIONS='-IR --exclude-dir=.[a-zA-Z0-9]* --exclude=.* --color=auto'
fi
#--- Named Directories -------------------------------------------------------
typeset -A _memoized_venv_paths
function zsh_directory_name() {
# Evade zsh-syntax-highlighting, which seems to call us twice when
# typing the closing ], and another 2 times when hitting enter, and
# worse, 2 times for each character typed on the line :(
[[ "$functrace" = _zsh_highlight* ]] && return 1
local binary=$_memoized_venv_paths[$@]
case "$1" in
n) # Run a venv binary in a corresponding venv
if [[ -z "$binary" ]]; then
if [[ $2 =~ '([^:]+):([^:]+)' ]]; then # foo:bar is venv foo, bin bar
local binary=$(venvs find --existing-only name "$match[1]" "$match[2]")
else
local binary=$(venvs find --existing-only directory $PWD "$2")
fi
_memoized_venv_paths[$@]=$binary
fi
typeset -ga reply
reply=($binary)
return
;;
c) # Completion
# FIXME: Probably refactor, but here we allow foo:<nothing>, and
# also this doesn't pre-filter whatever is there already
if [[ $2 =~ '([^:]+):([^:]*)' ]]; then
local venv=$(venvs find --existing-only name "$match[1]")
else
local venv=$(venvs find --existing-only directory $PWD)
fi
# FIXME: if you have ~[pip]<TAB>, zsh seems to do the wrong
# thing with this (it doesn't expand to the directory)
local expl
_wanted dynamic-venv-bins expl 'dynamic venv binaries' _files -g '*(*)' -W "$venv/bin" -S\]
return
;;
*)
return 1
esac
}
#--- Local -------------------------------------------------------------------
[ -d $ZDOTDIR/zshrc.d/ ] && for file in $ZDOTDIR/zshrc.d/*.zsh(N); do
source $file
done