-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshell_ext
More file actions
131 lines (104 loc) · 3.52 KB
/
shell_ext
File metadata and controls
131 lines (104 loc) · 3.52 KB
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
# vim: set ft=zsh:
function evalcache-clear {
yes | _evalcache_clear
}
# to make it consumable for _evalcache
function _evalable {
echo "$@"
}
function _evalable_arch {
_evalable arch
}
function _evalable_yarnglobalpath {
_evalable yarn global bin
}
_arch="$(_evalcache _evalable_arch)"
# intel chip (at least not powerful ones) can't seem to handle this, so disabled for them for now
test "${_arch}" = "arm64" && {
export my_zsh_plugin_zsh_autocomplete=1;
export my_nvim_ghost=1;
export my_nvim_tabnine=1;
}
# theme for bat
export BAT_THEME="Solarized (light)"
# set LS_COLORS with vivid
if [ -n "${commands[vivid]}" ]; then
export LS_COLORS=$(vivid generate solarized-light)
fi
# fzf + fd # fd ignores .gitignore files/directories by default
# default
export FZF_DEFAULT_COMMAND='fd --type f'
# color is based on https://github.com/junegunn/fzf/wiki/Color-schemes#solarized-light
export FZF_DEFAULT_OPTS='
--height 40%
--layout=reverse
--color fg:240,hl:33,fg+:241,bg+:221,hl+:33
--color info:33,prompt:33,pointer:166,marker:166,spinner:33
'
# CTRL-T - Paste the selected files and directories onto the command-line
export FZF_CTRL_T_COMMAND='fd'
export FZF_CTRL_T_OPTS=''
# ALT-C - cd into the selected directory
export FZF_ALT_C_COMMAND='fd -t d'
export FZF_ALT_C_OPTS=''
# better history search with fzf via https://nixos.wiki/wiki/Fzf
if [ -n "${commands[fzf-share]}" ]; then
source "$(fzf-share)/key-bindings.zsh"
source "$(fzf-share)/completion.zsh"
else # falling back to brew
# in case of enabling with brew via https://github.com/junegunn/fzf#using-homebrew
if type brew &>/dev/null; then
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# configuring completions for brew installed packages
# this FPATH will be needed in ../zshrc and should be accessible this way too
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
fi
fi
## binaries by language global packages, for example, npm, rust, go, etc.
# making sure it supersedes like /bin /usr/bin /usr/local/bin
export PATH="$(path | grep nix-profile):${PATH}"
# rust
if [ -n "${commands[cargo]}" ]; then
export PATH="${HOME}/.cargo/bin:${PATH}"
fi
# golang
if [ -n "${commands[go]}" ]; then
export GOPATH=${HOME}/go
export PATH="${GOPATH}/bin:${PATH}"
fi
# yarn
if [ -n "${commands[yarn]}" ]; then
# because yarn global bin is slow
_YARN_GLOBAL_PATH=$(_evalcache _evalable_yarnglobalpath)
export PATH="${_YARN_GLOBAL_PATH}:${PATH}"
fi
# asdf
ASDF_DIR=${ASDF_DIR:-${HOME}/.asdf}
# https://github.com/asdf-vm/asdf - version manager
[ -f "${ASDF_DIR}/asdf.sh" ] && source "${ASDF_DIR}/asdf.sh"
# discover user specific binaries and scripts
export PATH="${HOME}/.local/bin:${PATH}"
# ../../bin/local/ will be symlinked to this
export PATH="${HOME}/.local/dotfiles-bin/local:${PATH}"
# actually this wouldn't work.
# so bootstrap script should be at its own repo
# and that should be sourced
# ---
# https://github.com/ryuheechul/bin will be clone to this
export PATH="${HOME}/.local/my-bin:${PATH}"
# starship
_evalcache starship init zsh
# use direnv
[ $commands[direnv] ] && _evalcache direnv hook zsh
# for https://github.com/aykamko/tag
if (( $+commands[tag] )); then
export TAG_SEARCH_PROG=ag
tag() { command tag "$@"; source ${TAG_ALIAS_FILE:-/tmp/tag_aliases} 2>/dev/null }
alias ag=tag
fi
BASE16_SHELL="${HOME}/.config/base16-shell"
[ -n "${PS1}" ] && \
[ -s "${BASE16_SHELL}/profile_helper.sh" ] && \
_evalcache ${BASE16_SHELL}/profile_helper.sh
# fallback any command to npx # disabled for now
# source <(npx --shell-auto-fallback zsh)