-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathzshrc
122 lines (106 loc) · 3.17 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
# zmodload zsh/zprof
# https://bixense.com/clicolors/
export CLICOLOR=1
# What characters are considered to be a part of a word
export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
# Pagers and editors
export VISUAL=vim
export EDITOR=vim
export METAMAIL_PAGER=less
export PAGER=less
(( ${+commands[lesspipe]} )) && export LESSOPEN='|lesspipe %s'
export LESS='-Ri '
# Set a virtualenvwrapper path, if not already set (resolves tmux nesting issue)
export VIRTUALENVWRAPPER_PYTHON=${VIRTUALENVWRAPPER_PYTHON:-$(which python3)}
export VIRTUALENV_PYTHON=${VIRTUALENVWRAPPER_PYTHON}
# Node Version Manager (NVM) direcory
export NVM_DIR=${HOME}/.nvm
# ZSH history
export HISTFILE=${HISTFILE:-${HOME}/.zsh_history}
export HISTSIZE=10000000
export SAVEHIST=10000000
# Zoxide
export _ZO_MAXAGE=10000000
# Try to source:
for file (
# NVM script and its completions
"${NVM_DIR}/nvm.sh"
"${NVM_DIR}/bash_completion"
# zsh settings
"${HOME}/.config/zsh/man.zsh"
"${HOME}/.config/zsh/opts.zsh"
"${HOME}/.config/zsh/keys.zsh"
# "${HOME}/.config/zsh/zplugin.zsh"
"${HOME}/.config/zsh/zpm.zsh"
"${HOME}/.config/zsh/aliases.zsh"
"${HOME}/.config/zsh/completions.zsh"
"${HOME}/.config/zsh/nnn.zsh"
# command-not-found functionality
"${HOME}/.config/zsh/other/command-not-found.zsh"
# python's virtualenvwrapper
# "${HOME}/.local/bin/virtualenvwrapper_lazy.sh"
# nix package manager
)
[[ -s "${file}" ]] && source "${file}"
# Automatically list directory contents on `cd`.
auto-ls () { ls; }
[[ ${chpwd_functions[(r)auto-ls]} == auto-ls ]] || chpwd_functions=( auto-ls $chpwd_functions )
# Choose binary in $PATH with fzf
insert_binary_from_path() {
cmd=$(print -rl -- ${(ko)commands} | fzf --height 40% --layout=reverse)
LBUFFER="${LBUFFER}${cmd}"
zle redisplay
}
zle -N insert_binary_from_path
bindkey '^[d' insert_binary_from_path # Alt+d
# opam configuration
if [[ -r ~/.opam/opam-init/init.zsh ]]; then
source ~/.opam/opam-init/init.zsh
eval "$(opam env)"
fi
# # Set terminal title
# preexec_hook_set_title() {
# print -Pn "\e]0;${1}\a"
# }
# autoload -Uz add-zsh-hook
# add-zsh-hook preexec preexec_hook_set_title
# export COMPOSE_DOCKER_CLI_BUILD=1
# export DOCKER_BUILDKIT=1
autoload -U zargs
# Deduplicate these arrays
typeset -U path cdpath fpath manpath
# zprof
# k-fwd() {
# trap 'sudo kill %2 %3' SIGINT
# sudo -s 'exit'
# while true; do
# sudo chown -R lain:lain ~/.tsh
# # tsh login
# sleep 60
# done &
# sudo -E =kubefwd services -n quantor &
# wait
# }
# # Run tmux on start
# if (( ${+commands[tmux]} )) &&
# [[ ! "${TERM}" =~ screen ]] &&
# [[ ! "${TERM}" =~ tmux ]] &&
# [[ -z "${TMUX}" ]]; then
# tmux attach || tmux
# fi
if (( ${+commands[sgpt]} )); then
:
# Shell-GPT integration ZSH v0.1
_sgpt_zsh() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+="⌛"
zle -I && zle redisplay
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd")
zle end-of-line
fi
}
zle -N _sgpt_zsh # Define _sgpt_zsh as a Zsh widget
bindkey '^f' _sgpt_zsh # Bind Ctrl+F to the _sgpt_zsh widget
# Shell-GPT integration ZSH v0.1
fi