diff --git a/flake.nix b/flake.nix index ea1ad18..44c4fc8 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,13 @@ statix.url = "github:nerdypepper/statix"; + # Fish specific + dracula-fish = { + url = "github:dracula/fish"; + flake = false; + }; + + # Zsh specific forgit-git = { url = "github:wfxr/forgit"; flake = false; diff --git a/modules/cli/bin/default.nix b/modules/cli/bin/default.nix index 05dd993..38477fa 100644 --- a/modules/cli/bin/default.nix +++ b/modules/cli/bin/default.nix @@ -8,8 +8,14 @@ let randomWallpaper = import ./randomWallpaper.nix { inherit pkgs; }; share = import ./share.nix { inherit pkgs; }; sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; }; -in -{ - home-manager.users.moritz.home.packages = - [ cheat cycleSinks git-switch protonge randomWallpaper share sxhkdHelp ]; +in { + home-manager.users.moritz.home.packages = [ + # cheat + cycleSinks + git-switch + protonge + randomWallpaper + share + sxhkdHelp + ]; } diff --git a/modules/cli/default.nix b/modules/cli/default.nix index 394068d..2e0320b 100644 --- a/modules/cli/default.nix +++ b/modules/cli/default.nix @@ -1,8 +1,16 @@ { config, lib, pkgs, ... }: { - imports = - [ ./bin ./adb.nix ./direnv.nix ./git.nix ./nix.nix ./ssh.nix ./zsh.nix ]; + imports = [ + ./adb.nix + ./bin + ./direnv.nix + ./fish.nix + ./git.nix + ./nix.nix + ./ssh.nix + # ./zsh.nix + ]; home-manager.users.moritz = { home.packages = with pkgs; [ # archives @@ -12,6 +20,9 @@ ranger trash-cli + # monitoring + htop + # fetcher neofetch @@ -21,11 +32,17 @@ # ripping abcde handbrake + + # utility + cht-sh ]; programs = { - exa.enable = true; bat.enable = true; + command-not-found.enable = true; + exa.enable = true; + fzf.enable = true; gpg.enable = true; + starship.enable = true; }; }; } diff --git a/modules/cli/fish.nix b/modules/cli/fish.nix new file mode 100644 index 0000000..8bb1212 --- /dev/null +++ b/modules/cli/fish.nix @@ -0,0 +1,77 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + users.users.moritz.shell = pkgs.fish; + # needed for nix completions + programs.fish.enable = true; + home-manager.users.moritz = { + programs = { + fish = { + enable = true; + shellAbbrs = { + us = "systemctl --user"; + rs = "doas systemctl"; + + ga = "git add"; + gb = "git branch"; + gc = "git commit"; + gco = "git checkout"; + gd = "git diff"; + gds = "git diff --staged"; + gp = "git push"; + gs = "git status"; + }; + shellAliases = { + du = "dust"; + ls = "exa -lh --icons --git"; + cat = "bat"; + feh = "feh --auto-zoom --scale-down"; + grep = "rg"; + + ssh = "TERM=xterm-color command ssh"; + + nix-switch = "doas nixos-rebuild switch --flake ~/.dotfiles"; + nix-boot = "doas nixos-rebuild boot --flake ~/.dotfiles"; + nix-lock = + "doas nixos-rebuild dry-activate --flake ~/.dotfiles --recreate-lock-file"; + }; + shellInit = '' + fzf_configure_bindings --git_log=\cg + + # Vi Mode + fish_vi_key_bindings + + # Emulates vim's cursor shape behavior + # Set the normal and visual mode cursors to a block + set fish_cursor_default block + # Set the insert mode cursor to a line + set fish_cursor_insert line + # Set the replace mode cursor to an underscore + set fish_cursor_replace_one underscore + # The following variable can be used to configure cursor shape in + # visual mode, but due to fish_cursor_default, is redundant here + set fish_cursor_visual block + ''; + functions = { + gi = '' + set url https://www.gitignore.io/api + if test (count $argv) -ne 1 + set list (curl -sL $url/list | string split ",") + set choice (string split " " $list | fzf -m --preview "curl -sL $url/{}" | string join ",") + else + set choice $argv[1] + end + curl -sL $url/$choice > .gitignore + ''; + fish_greeting = ""; + cheat = "cht.sh $argv | bat -p"; + }; + plugins = [{ + name = "dracula"; + src = inputs.dracula-fish; + }]; + }; + }; + home.packages = with pkgs.fishPlugins; [ fzf-fish pisces ]; + }; +} diff --git a/modules/cli/zsh.nix b/modules/cli/zsh.nix index 15a994b..a3a5bf8 100644 --- a/modules/cli/zsh.nix +++ b/modules/cli/zsh.nix @@ -50,15 +50,8 @@ src = inputs.forgit-git; }]; }; - fzf = { - enable = true; - enableZshIntegration = true; - }; - starship = { - enable = true; - enableZshIntegration = true; - }; - command-not-found.enable = true; + fzfe.enableZshIntegration = true; + starship.enableZshIntegration = true; }; }; }