From 0ffda6f90d2fef33059d4170144d97fded8490bd Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Fri, 10 Feb 2023 00:11:54 +0100
Subject: [PATCH] Disabled fish greeting

---
 home/adrielus/features/cli/default.nix      |  4 +-
 home/adrielus/features/cli/fish.nix         | 56 ---------------------
 home/adrielus/features/cli/fish/config.fish | 27 ++++++++++
 home/adrielus/features/cli/fish/default.nix | 26 ++++++++++
 4 files changed, 56 insertions(+), 57 deletions(-)
 delete mode 100644 home/adrielus/features/cli/fish.nix
 create mode 100644 home/adrielus/features/cli/fish/config.fish
 create mode 100644 home/adrielus/features/cli/fish/default.nix

diff --git a/home/adrielus/features/cli/default.nix b/home/adrielus/features/cli/default.nix
index a7baece..0b969d2 100644
--- a/home/adrielus/features/cli/default.nix
+++ b/home/adrielus/features/cli/default.nix
@@ -1,5 +1,7 @@
 { pkgs, ... }: {
-  imports = [ ./exa.nix ./bat.nix ./ssh.nix ./fish.nix ./tmux ./git.nix ./starship.nix ./direnv.nix ];
+  imports = [ ./exa.nix ./bat.nix ./ssh.nix
+./git.nix ./starship.nix ./direnv.nix
+  ./fish ./tmux  ];
 
   # Enable bash
   programs.bash.enable = true;
diff --git a/home/adrielus/features/cli/fish.nix b/home/adrielus/features/cli/fish.nix
deleted file mode 100644
index 053d137..0000000
--- a/home/adrielus/features/cli/fish.nix
+++ /dev/null
@@ -1,56 +0,0 @@
-{ pkgs, ... }:
-{
-  programs.fish = {
-    enable = true;
-
-    shellAbbrs = {
-      cat = "bat";
-    };
-
-    shellAliases = {
-      # Print available battery
-      battery = "acpi";
-    };
-
-    plugins = with pkgs.fishPlugins; [
-      # Jump to directories by typing "z <directory-name>"
-      {
-        name = "z";
-        src = pkgs.fetchFromGitHub {
-          owner = "jethrokuan";
-          repo = "z";
-          rev = "85f863f20f24faf675827fb00f3a4e15c7838d76";
-          sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq";
-        };
-      }
-    ];
-
-    interactiveShellInit =
-      # Start tmux if not already inside tmux
-      ''
-        if status is-interactive
-        and not set -q TMUX
-            exec tmux attach -t Welcome || tmux || echo "Something went wrong trying to start tmux"
-        end
-      '' +
-      # Sets cursor based on vim mode
-      ''
-        set fish_cursor_default block # Set the normal and visual mode cursors to a block
-        set fish_cursor_insert line # Set the insert mode cursor to a line
-        set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore
-
-        # Force fish to skip some checks (I think?)
-        set fish_vi_force_cursor 
-      '' +
-      # Use vim-style keybinds
-      ''
-        function fish_user_key_bindings
-          # Use the vim keybinds
-          fish_vi_key_bindings
-
-          bind -e -M insert -k f10 # unbinds f10
-          bind -M insert -m default -k f10 'commandline -f repaint' # Exit insert mode with <f10>
-        end
-      '';
-  };
-}
diff --git a/home/adrielus/features/cli/fish/config.fish b/home/adrielus/features/cli/fish/config.fish
new file mode 100644
index 0000000..d7e62e4
--- /dev/null
+++ b/home/adrielus/features/cli/fish/config.fish
@@ -0,0 +1,27 @@
+# {{{ Start tmux if not already inside tmux
+if status is-interactive
+and not set -q TMUX
+    exec tmux attach -t Welcome || tmux || echo "Something went wrong trying to start tmux"
+end
+# }}}
+# {{{ Sets cursor based on vim mode
+set fish_cursor_default block # Set the normal and visual mode cursors to a block
+set fish_cursor_insert line # Set the insert mode cursor to a line
+set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore
+
+# Force fish to skip some checks (I think?)
+# TODO: research why this is here
+set fish_vi_force_cursor
+# }}}
+# {{{ Disable greeting
+set fish_greeting
+# }}}
+# {{{ Use vim-style keybinds
+function fish_user_key_bindings
+  # Use the vim keybinds
+  fish_vi_key_bindings
+
+  bind -e -M insert -k f10 # unbinds f10
+  bind -M insert -m default -k f10 'commandline -f repaint' # Exit insert mode with <f10>
+end
+# }}}
diff --git a/home/adrielus/features/cli/fish/default.nix b/home/adrielus/features/cli/fish/default.nix
new file mode 100644
index 0000000..7698c5c
--- /dev/null
+++ b/home/adrielus/features/cli/fish/default.nix
@@ -0,0 +1,26 @@
+{ pkgs, ... }:
+{
+  programs.fish = {
+    enable = true;
+
+    shellAbbrs = {
+      battery = "acpi";
+      cat = "bat";
+    };
+
+    plugins = with pkgs.fishPlugins; [
+      # Jump to directories by typing "z <directory-name>"
+      {
+        name = "z";
+        src = pkgs.fetchFromGitHub {
+          owner = "jethrokuan";
+          repo = "z";
+          rev = "85f863f20f24faf675827fb00f3a4e15c7838d76";
+          sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq";
+        };
+      }
+    ];
+
+    interactiveShellInit = builtins.readFile ./config.fish;
+  };
+}