summaryrefslogtreecommitdiff
path: root/zsh/.zshrc
blob: 7c8e9473a5a747d1eb68439dc84e1841ebe23673 (plain)
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
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
# ░     ░░░░░   ░░░░   ░░░░░░░        ░   ░░░      ░░░   ░░░░   
# ▒  ▒▒   ▒▒▒   ▒▒▒▒   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒   ▒▒▒   ▒▒▒▒   ▒   ▒▒▒▒   
# ▒  ▒▒▒   ▒▒   ▒▒▒▒   ▒▒▒▒▒▒▒▒▒▒▒▒▒   ▒▒▒▒▒   ▒▒▒▒▒▒▒   ▒▒▒▒   
# ▓      ▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓   ▓▓▓▓▓          
# ▓  ▓▓▓▓   ▓   ▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓▓▓   ▓▓   ▓▓▓▓   
# ▓  ▓▓▓▓▓  ▓   ▓▓▓▓   ▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓   ▓▓▓▓   ▓   ▓▓▓▓   
# █    █   ██   ████   ███████            ███      ███   ████   
# ██████████████████████████████████████████████████████████████

# ╔══════════════════════════════════════════════════════════════╗
# ║                    ⚡ ZSH Configuration ⚡                  ║
# ╚══════════════════════════════════════════════════════════════╝

# ┌──────────────────────────────────────────────────────────────┐
# │ 🚀 Powerlevel10k Instant Prompt                              │
# │ Must stay near top. Console input goes ABOVE this block.     │
# └──────────────────────────────────────────────────────────────┘
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

# ┌──────────────────────────────────────────────────────────────┐
# │ 🎨 Oh My Zsh                                                 │
# └──────────────────────────────────────────────────────────────┘
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"

# ┌──────────────────────────────────────────────────────────────┐
# │ ⚙️  Settings                                                 │
# └──────────────────────────────────────────────────────────────┘
HYPHEN_INSENSITIVE="true"
COMPLETION_WAITING_DOTS="%F{yellow}...%f"

setopt beep notify
setopt CORRECT

# ┌──────────────────────────────────────────────────────────────┐
# │ 📜 History                                                   │
# └──────────────────────────────────────────────────────────────┘
HIST_STAMPS="%Y-%m-%d %H:%M:%S"
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=1000000000

# ┌──────────────────────────────────────────────────────────────┐
# │ 🧩 Plugins                                                   │
# └──────────────────────────────────────────────────────────────┘
plugins=(git)
source $ZSH/oh-my-zsh.sh
unset LS_COLORS #unset ls colors

# ┌──────────────────────────────────────────────────────────────┐
# │ 🔍 FZF                                                       │
# └──────────────────────────────────────────────────────────────┘
source <(fzf --zsh)
export FZF_DEFAULT_OPTS="--color=fg+:#8affff,bg+:#225859,header:#FFC600,info:#FFC600,pointer:#8affff,marker:#8affff,prompt:#ffC600,spinner:#FFC600,query:#8affff,hl:#FFC600,hl+:#FFC600"

# ┌──────────────────────────────────────────────────────────────┐
# │ 📂 Zoxide                                                    │
# └──────────────────────────────────────────────────────────────┘
eval "$(zoxide init zsh)"

# ┌──────────────────────────────────────────────────────────────┐
# │ 🔧 Completion                                                │
# └──────────────────────────────────────────────────────────────┘
zstyle :compinstall filename '/home/bh/.zshrc'
autoload -Uz compinit
compinit

# ┌──────────────────────────────────────────────────────────────┐
# │ ✏️  Editor                                                   │
# └──────────────────────────────────────────────────────────────┘
export EDITOR="nvim"
export VISUAL="nvim"

# ┌──────────────────────────────────────────────────────────────┐
# │ 🏷️  Aliases                                                  │
# └──────────────────────────────────────────────────────────────┘
# ls Commands
alias ls="eza --icons --group-directories-first"
alias l='eza -laahg --icons --group-directories-first --time-style="+%d %b %Y %H:%M:%S"'
alias ll='eza -laahg --icons --group-directories-first --time-style="+%d %b %Y %H:%M:%S"'
alias tree='eza --tree --icons --group-directories-first --time-style="+%d %b %Y %H:%M:%S"'
# Other Commands
alias vi="nvim"
alias sudo='sudo '
alias icat="kitty icat"
alias py="python"
alias rename="perl-rename"
alias vimv="~/Scripts/vimv"

# ┌──────────────────────────────────────────────────────────────┐
# │ ⚙️  Functions
# └──────────────────────────────────────────────────────────────┘
takedir() {
	if [[ $# -eq 1 ]]; then
		mkdir -p "$1" && cd "$1"
	elif [[ $# -ge 2 ]]; then
		local dest="${@:$#}"
		mkdir -p "$dest"
		local abs_dest srcs=() src
		abs_dest=$(realpath "$dest")
		for src in "${@:1:$#-1}"; do
			[[ "$(realpath "$src" 2>/dev/null)" != "$abs_dest" ]] && srcs+=("$src")
		done
		[[ ${#srcs[@]} -gt 0 ]] && mv "${srcs[@]}" "$dest"
		cd "$dest"
	else
		echo "usage: take <dir> OR take <sources...> <destdir>"
		return 1
	fi
}

tt() {
	kitty @ set-font-size +12
	~/Scripts/tt -notheme
	kitty @ set-font-size 10.5
}


# ┌──────────────────────────────────────────────────────────────┐
# │ 🎯 Prompt                                                    │
# └──────────────────────────────────────────────────────────────┘
# To customize, run `p10k configure` or edit ~/.p10k.zsh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# ┌──────────────────────────────────────────────────────────────┐
# │ 📦 PATH                                                      │
# └──────────────────────────────────────────────────────────────┘
export PATH="$PATH:/home/bh/.local/bin"