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