programs/fish.nix (view raw)
1{ config
2, pkgs
3, ...
4}:
5
6{
7 programs.fish = {
8 enable = true;
9 interactiveShellInit = ''
10 nix-your-shell fish | source
11 set fish_greeting # Disable greeting
12 '';
13 functions = {
14 fish_prompt = ''
15 printf '\n\001\002▲\001\002 '
16 '';
17 ggp = ''
18 if test "$argv[1]" = "-f"
19 git push (git remote show) -f (git branch --show-current)
20 else
21 git push (git remote show) (git branch --show-current)
22 end
23 '';
24
25 gpl = ''
26 if test -n "$argv[1]"
27 set branch $argv[1]
28 else
29 set branch (git branch --show-current)
30 end
31 git pull -r (git remote show) $branch
32 '';
33
34 gco = ''
35 if test -z "$argv[1]"
36 return 1
37 end
38
39 git rev-parse --verify $argv[1] > /dev/null 2>&1
40 if test $status -eq 0
41 git checkout $argv[1]
42 else
43 git checkout -b $argv[1]
44 end
45 '';
46 };
47 shellAbbrs = {
48 gc = "git commit -v -S";
49 gst = "git status --short";
50 ga = "git add";
51 gd = "git diff --minimal";
52 gl = "git log --oneline --decorate --graph";
53 k = "kubectl";
54 };
55 shellAliases = {
56 n = "z";
57 "..." = "cd ../..";
58 };
59 };
60}