Repository navigation
Expand file tree
/
Copy pathfish.nix
More file actions
266 lines (232 loc) · 8.41 KB
/
Copy pathfish.nix
File metadata and controls
266 lines (232 loc) · 8.41 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
{
config,
lib,
pkgs,
...
}:
{
config = {
programs.fish = {
enable = true;
shellAbbrs = {
"n" = "nix";
"ni" = "nix repl";
"nix-list" = "nix profile history --profile /nix/var/nix/profiles/system";
"nix-rm-boot-entries" =
"nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 30d";
"rebuild" = "sudo nixos-rebuild switch --flake .";
"nre" = "sudo nixos-rebuild switch --flake ~/mynix/";
"nure" = "nix flake update && sudo nixos-rebuild switch --flake ~/mynix/";
"nsh" = {
expansion = "nix shell n#% -c fish";
setCursor = true;
};
"nsu" = {
expansion = "NIXPKGS_ALLOW_UNFREE=1 nix shell n#% --impure -c fish";
setCursor = true;
};
"nf" = "nix flake";
"nfc" = "nix flake check";
"nft" = "nix flake init --template";
"nfn" = {
expansion = "nix flake new % --template";
setCursor = true;
};
"nfs" = "nix flake show";
"nfu" = "nix flake update";
"nr" = "nix run";
"nra" = "nix run . --";
"nrn" = {
expansion = "nix run n#%";
setCursor = true;
};
"nru" = {
expansion = "NIXPKGS_ALLOW_UNFREE=1 nix run n#% --impure";
setCursor = true;
};
"nl" = "nix run -L . --";
"nb" = "nix build";
"nd" = {
expansion = "nix develop % -c fish";
setCursor = true;
};
"nrd" = "npm run dev";
"nrp" = "npm run playground";
"c" = "code . &";
"v" = "nvim .";
"e" = "emacs . &";
"h" = "history";
"rg" = "rg --line-number --context=2";
"wh" = "which";
"wha" = "type --all";
"ae" = {
expansion = "cd ~/mynix/secrets/ && agenix --edit % && cd -";
setCursor = true;
};
"ad" = {
expansion = "cd ~/mynix/secrets/ && agenix --decrypt % && cd -";
setCursor = true;
};
"j" = "just";
"js" = "just setup";
"jd" = "just dev";
"jr" = "just run";
"jb" = "just build";
"ja" = "just all";
"jt" = "just test";
"joc" = "just open chromium";
"jod" = "just open chromium && just dev";
"k" = "kubectl";
"kg" = "kubectl get";
"kd" = "kubectl describe";
"ke" = "kubectl exec";
"wm" = "wt remote";
"ww" = "wt work";
"ws" = "wt scratch";
"g" = "git";
"gi" = "git init";
"gim" = "git init && git add . && git commit --message \"Initial commit\"";
"gclo" = "git clone";
"ga" = "git add";
"gs" = "git status --short --branch";
"gbr" = "git branch --all --verbose";
"gbu" = "git branch --set-upstream-to=origin/(git_branch_name) (git_branch_name)";
"gbm" = "git branch --move";
"gcm" = "git commit --message";
"gam" = "git add . && git commit --message";
"gab" = "git add . && git commit --message 'Add content' && git push";
"gp" = "git push";
"gpf" = "git push --force-with-lease";
"gpu" = "git push --set-upstream";
"gpo" = "git push --set-upstream origin";
"gpb" = "git push --set-upstream origin (git_branch_name)";
"gf" = "git pull";
"gfa" = "git fetch --all";
"gfap" = "git fetch --all --prune";
"gr" = "git remote";
"gra" = "git remote add";
"grr" = "git remote remove";
"gro" = "git remote add origin";
"grv" = "git remote --verbose";
"gca" = "git commit --amend";
"gcan" = "git commit --amend --no-edit";
"gacan" = "git add . && git commit --amend --no-edit";
"gd" = "git diff --word-diff";
"gst" = "git stash";
"gw" = "git worktree";
"gwa" = "git worktree add";
"gwr" = "git worktree remove";
"gwl" = "git worktree list";
"gre" = "git restore";
"gu" = "git restore --staged";
"gun" = "git rm --cached";
"gsw" = "git switch";
"gs-" = "git switch -";
"gsc" = "git switch --create";
"gco" = "git checkout";
"gme" = "git merge";
"gmb" = "git checkout HEAD^";
"gl" = "git log --oneline --decorate --graph";
"gls" = "git log --graph --stat";
"gld" =
"git -c color.ui=always log --graph --pretty=format:'%C(yellow)%h%C(auto) %d %s}%C(green)%cr%C(reset) | %C(blue)%an%C(reset)' --abbrev-commit --date=relative | column --separator '}' --table | less";
"gsh" = "git show";
"ghi" = {
expansion = "gh repo create % --private --source=. --remote=origin";
setCursor = true;
};
"gho" = {
expansion = "gh repo create % --private --source=. --remote=origin && git push --set-upstream origin main";
setCursor = true;
};
"ghp" = {
expansion = "gh repo create % --public --source=. --remote=origin && git push --set-upstream origin main";
setCursor = true;
};
"np" = "nix run github:haglobah/templater -Lv -- --to";
"uf" = "echo \"use flake . -Lv\" >> .envrc";
"ud" = "echo \"use flake . -Lv\" >> .envrc && direnv allow";
"uda" = "git add flake.nix && echo \"use flake . -Lv\" >> .envrc && direnv allow";
"da" = "direnv allow";
"dr" = "direnv reload";
"ds" = "doom sync";
"hm" = "home-manager";
"hsw" = "home-manager switch --flake .";
"hs" = "home-manager switch --flake ~/nix-home/";
"reload" = "source ~/.config/fish/config.fish";
};
shellAliases = {
".." = "cd ..";
"cp" = "cp -i";
"l" = "lla";
"lta" = "lt -la";
"mv" = "mv -i";
"rm" = "rm -i";
"du" = "du -ach | sort -h";
};
shellInit = ''
function md
mkdir -p $argv[1] && cd $argv[1]
end
function freq
history | cut -c8- | cut -d" " --fields=1"$argv[1]" | sort | uniq -c | sort -rn
end
function gap
git add . && git commit --message="$argv[1]" && git push
end
function gcl
git clone $argv[1] && cd (string split : (basename $argv[1] .git))[-1]
end
function gcw
set --function link $argv[1]
if test (count $argv) -eq 1
set --function folder_name (string split : (basename $argv[1] .git))[-1]
else if test (count $argv) -eq 2
set --function folder_name $argv[2]
else
echo "Wrong number of arguments"
return 1
end
git clone $link $folder_name/work
cd $folder_name/work
git worktree add ../remote
git worktree add ../scratch
end
function gc
gcw $argv
end
function wt --description "Switch to a git worktree"
# Get the list of worktrees
set worktree_info (git worktree list | grep "/$argv[1] ")
if test -z "$worktree_info"
echo "Worktree '$argv[1]' not found."
echo "Available worktrees:"
git worktree list | cut -d' ' -f1 | xargs -n1 basename
return 1
end
# Extract the path (first column)
set worktree_path (echo $worktree_info | cut -d' ' -f1)
cd $worktree_path
end
function gm
git add ''$argv[2..-1]
git commit --message="$argv[1]"
end
function gmf
git checkout (git rev-list --topo-order HEAD..''$argv[1] | string collect; or echo)
end
function git_branch_name
git rev-parse --abbrev-ref HEAD
end
function gb
git for-each-ref --color --sort=-committerdate --format='%(color:green)%(ahead-behind:HEAD)%(color:reset)*%(color:blue)%(refname:short)%(color:reset)*%(color:yellow)%(committerdate:relative)%(color:reset)*%(describe)' refs/ | column --separator='*' --table --table-columns='Ahead-Behind,Branch Name,Last Commit,Description'
end
# bind " " expand-abbr or self-insert
set -gx PATH $PATH "/home/beat/.config/emacs/bin"
set -gx EDITOR "nvim"
# for automatically adding completions from a Justfile (if supplied there as `_dev-complete`)
complete --command just --condition '__fish_seen_subcommand_from dev' --arguments '(just _dev-complete)'
'';
};
};
}