-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
110 lines (97 loc) · 3 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
# Show the calander at the start of the terminal
when
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Add stuff to the path for different programming languages.
# the HOME bin should be _first_ such that it can be used to overwrite stuff
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Flatpak
export PATH=$PATH:/var/lib/flatpak/bin:/$HOME/.local/share/flatpak/exports/bin
# Rust
export PATH=$PATH:$HOME/.cargo/bin
# Scala
export PATH=$PATH:$HOME/.local/share/coursier/bin
# Go
export PATH=$PATH:/usr/local/go/bin
# Haskell
export GHCUP_USE_XDG_DIRS=1
source ~/.local/share/ghcup/env
# Pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init --path)"
fi
eval "$(pyenv virtualenv-init -)"
# Basic settings
HYPHEN_INSENSITIVE="true"
setopt appendhistory sharehistory histignorespace hist_ignore_all_dups hist_save_no_dups hist_ignore_dups hist_find_no_dups
HISTSIZE=5000
SAVEHIST=$HISTSIZE
HISTFILE=~/.zsh_history
HISTDUP=erase
bindkey '^p' history-search-backward
bindkey '^f' history-search-forward
zstyle ':completion:*' rehash true
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Setting up zinit
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
source "${ZINIT_HOME}/zinit.zsh"
# Add powerlevel10K for the pure prompt
zinit ice depth=1; zinit light romkatv/powerlevel10k
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Basic plugins
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
# Load the completions
autoload -U compinit && compinit
bindkey '^y' autosuggest-accept
# oh-my-zsh plugins
zinit snippet OMZP::git
zinit snippet OMZP::sudo
zinit snippet OMZP::debian
zinit snippet OMZP::pip
zinit snippet OMZP::docker-compose
zinit snippet OMZP::python
zinit snippet OMZP::sbt
zinit snippet OMZP::kubectl
zinit snippet OMZP::kubectx
zinit snippet OMZP::command-not-found
# Recommended in the docs
zinit cdreplay -q
# aliases
alias ls='ls --color'
alias ll='ls -lah --color'
alias grep='grep --color=auto'
# change curor
echo -e -n "\x1b[\x34 q"
# Set editor
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# add LF command to change dir when moving around
clf () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}