-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzsh.nix
More file actions
162 lines (143 loc) · 5.53 KB
/
zsh.nix
File metadata and controls
162 lines (143 loc) · 5.53 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{ pkgs, unstable-pkgs, lib, ... }:
{
programs.zsh = {
enable = true;
autocd = true;
dirHashes = { kawaka = "$HOME/code/kawaka"; };
syntaxHighlighting = { enable = true; };
shellAliases = {
l = "ls -ahG";
e = "nvim";
szsh = "source ~/.zshrc";
gmt = "git machete traverse";
gms = "git machete status";
gma = "git machete add";
gmc = "git machete delete-unmanaged";
gmd = "git machete discover";
buildT = "rush build -T .";
buildt = "rush build -t .";
buildo = "rush build -o";
fbuildT = "rush fast-build -T .";
fbuildt = "rush fast-build -t .";
fbuildo = "rush fast-build -o";
gcc = "gnome-control-center network";
tail-rimu-logs = "tail -f ~/.config/Koordinates/logs/*.log";
get-latest-rimu-log =
"echo ~/.config/Koordinates/logs/$(ls -Art ~/.config/Koordinates/logs | tail -n 1)";
search-latest-rimu-log = "cat $(get-latest-rimu-log) | grep";
hms =
"sudo nixos-rebuild switch --flake ~/dotfiles#ubermouse --cores 10 -j 10";
show-trace = "npx playwright@${unstable-pkgs.playwright-test.version} show-trace";
heft = "node_modules/.bin/heft";
xclip = "xclip -selection clipboard";
rf = "rm common/temp/rush*lock";
test-storybook = "rush test-storybook --include-phase-deps -o";
yolo-claude = "claude --allow-dangerously-skip-permissions";
};
oh-my-zsh = {
enable = true;
custom = "$HOME/dotfiles/zsh-customizations";
plugins = [
"git"
"command-not-found"
"git-flow"
"direnv"
];
};
plugins = [
{
name = "powerlevel10k-config";
src = ./p10k;
file = "p10k.zsh";
}
{
name = "zsh-powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/";
file = "powerlevel10k.zsh-theme";
}
];
initContent = lib.mkMerge [
(lib.mkBefore ''
# 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
export PLAYWRIGHT_BROWSERS_PATH="${unstable-pkgs.playwright-driver.browsers}"
export KAWAKA_SKIP_PLAYWRIGHT_FIREFOX="1"
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD="1"
export PATH="$PATH:/home/taylorl/.pnpm-packages/bin:/home/taylorl/.local/bin"
export CLAUDE_CODE_DISABLE_1M_CONTEXT=1
export CLAUDE_CODE_DISABLE_AUTO_MEMORY=0
export GRACKLE_URL=http://localhost:7434
function kill-all {
ps -ef | grep [$1] | awk '{print $2}' | xargs kill -9
}
'')
(lib.mkAfter ''
_rush_completion() {
compadd -- $(rush tab-complete --position ${"$"}{CURSOR} --word "${
"$"
}{BUFFER}" 2>>/dev/null)
}
compdef _rush_completion rush
_rush_logs_completion() {
local dir="$PWD" rush_root=""
while [[ "$dir" != "/" ]]; do
[[ -f "$dir/rush.json" ]] && { rush_root="$dir"; break; }
dir="$(dirname "$dir")"
done
[[ -z "$rush_root" ]] && return
case $CURRENT in
2)
local -a packages
packages=( $(perl -0777 -pe 's|/\*.*?\*/||gs; s|^\s*//[^\n]*||gm; s|\r||g' "$rush_root/rush.json" | jq -r '.projects[].packageName') )
compadd -- "${"$"}{packages[@]}"
;;
3)
local -a phases
phases=( $(perl -0777 -pe 's|/\*.*?\*/||gs; s|^\s*//[^\n]*||gm; s|\r||g' "$rush_root/common/config/rush/command-line.json" | jq -r '.phases[].name | sub("^_phase:";"")') )
compadd -- "${"$"}{phases[@]}"
;;
esac
}
compdef _rush_logs_completion rush-logs
navigate-to() {
if [[ $# -lt 1 ]]; then
echo "Usage: navigate-to <package-name>"
return 1
fi
local dir="$PWD" rush_root=""
while [[ "$dir" != "/" ]]; do
[[ -f "$dir/rush.json" ]] && { rush_root="$dir"; break; }
dir="$(dirname "$dir")"
done
if [[ -z "$rush_root" ]]; then
echo "Error: Could not find rush.json in any parent directory"
return 1
fi
local project_folder
project_folder=$(perl -0777 -pe 's|/\*.*?\*/||gs; s|^\s*//[^\n]*||gm; s|\r||g' "$rush_root/rush.json" | jq -r --arg pkg "$1" '.projects[] | select(.packageName == $pkg) | .projectFolder')
if [[ -z "$project_folder" ]]; then
echo "Error: Package '$1' not found in rush.json"
return 1
fi
cd "$rush_root/$project_folder"
}
_navigate_to_completion() {
local dir="$PWD" rush_root=""
while [[ "$dir" != "/" ]]; do
[[ -f "$dir/rush.json" ]] && { rush_root="$dir"; break; }
dir="$(dirname "$dir")"
done
[[ -z "$rush_root" ]] && return
local -a packages
packages=( $(perl -0777 -pe 's|/\*.*?\*/||gs; s|^\s*//[^\n]*||gm; s|\r||g' "$rush_root/rush.json" | jq -r '.projects[].packageName') )
compadd -- "${"$"}{packages[@]}"
}
compdef _navigate_to_completion navigate-to
'')
];
};
}