From d214d4acf062417f3d071f427da4d8e96c051bfd Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Fri, 16 Jan 2026 00:50:23 +0530 Subject: Using starship for the prompt rather than raw zsh --- modules/tools/default.nix | 1 + modules/tools/starship/default.nix | 62 ++++++++++++++++++++++++++++++++++++++ modules/tools/zsh/default.nix | 7 ++++- modules/tools/zsh/zshrc | 23 -------------- 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 modules/tools/starship/default.nix delete mode 100644 modules/tools/zsh/zshrc (limited to 'modules') diff --git a/modules/tools/default.nix b/modules/tools/default.nix index a17e409..12ecbba 100644 --- a/modules/tools/default.nix +++ b/modules/tools/default.nix @@ -25,6 +25,7 @@ ./pamixer ./playerctl ./rofi + ./starship ./tmux ./unar ./vlc diff --git a/modules/tools/starship/default.nix b/modules/tools/starship/default.nix new file mode 100644 index 0000000..f59e762 --- /dev/null +++ b/modules/tools/starship/default.nix @@ -0,0 +1,62 @@ +{ config, lib, ... }: + +{ + options.tools.starship = { + enable = lib.mkEnableOption "Enables starship."; + }; + + config = lib.mkIf config.tools.starship.enable { + programs.starship = { + enable = true; + enableZshIntegration = config.tools.zsh.enable; + settings = + let + mkSegment = content: ''[┄\[](red)[${content}]($style)[\]](red)''; + in { + add_newline = true;# Single line layout + + format = '' +[╭─\[](red)[$username](bold green)[@](red)[$hostname](bold blue)[\]](red)$directory$git_branch$git_status +[╰─](red)$status$character +''; + + character.format = "[>](bold red)"; + + username = { + style_user = "green"; + style_root = "red bold"; + format = "[$user]($style)"; + show_always = true; + }; + + hostname = { + ssh_only = false; + style = "blue"; + format = "[$hostname]($style)"; + }; + + directory = { + style = "purple"; + truncate_to_repo = false; + format = mkSegment "$path"; + }; + + git_branch = { + style = "bold yellow"; + format = mkSegment "$symbol$branch(:$remote_branch)"; + }; + + git_status = { + format = mkSegment "$all_status$ahead_behind"; + style = "cyan"; + }; + + status = { + disabled = false; + format = ''${mkSegment "$symbol $status"}[┄─](red)''; + style = "cyan"; + }; + }; + }; + }; +} diff --git a/modules/tools/zsh/default.nix b/modules/tools/zsh/default.nix index 1b518a1..71e0be3 100644 --- a/modules/tools/zsh/default.nix +++ b/modules/tools/zsh/default.nix @@ -14,7 +14,12 @@ ${if config.tools.fzf.enable then "eval \"$(fzf --zsh)\"" else ""} -${builtins.readFile ./zshrc} +setopt PROMPT_SUBST + +autoload -U colors && colors + +bindkey "^[[3~" delete-char +bindkey "^?" backward-delete-char ''; }; diff --git a/modules/tools/zsh/zshrc b/modules/tools/zsh/zshrc deleted file mode 100644 index 3465071..0000000 --- a/modules/tools/zsh/zshrc +++ /dev/null @@ -1,23 +0,0 @@ -setopt PROMPT_SUBST - -autoload -U colors && colors - -autoload -Uz vcs_info -precmd() { vcs_info } - -zstyle ':vcs_info:git:*' formats '%F{red}┄[%F{cyan}%b%c%F{blue}%a%F{red}]' -zstyle ':vcs_info:git:*' actionformats '%F{red}┄[%F{cyan}%b%c%F{blue}%a%F{red}]' - -zstyle ':vcs_info:*+set-message:*' hooks git-untracked git-dirty - -zstyle ':vcs_info:git:*' check-for-changes true -zstyle ':vcs_info:git:*' stagedstr ' %F{green}✓%f' -zstyle ':vcs_info:git:*' unstagedstr ' %F{red}✗%f' -zstyle ':vcs_info:git:*' aheadstr ' %F{blue}⬆%f' -zstyle ':vcs_info:git:*' behindstr ' %F{yellow}⬇%f' - -PROMPT='%F{red}╭──[%F{green}%m%F{red}@%F{blue}%n%F{red}]┄[%F{magenta}%~%F{red}]${vcs_info_msg_0_}%(?..%F{red}┄[%F{white}Exit status: %F{yellow}%?%F{red}] ) -╰─>%f ' - -bindkey "^[[3~" delete-char -bindkey "^?" backward-delete-char -- cgit v1.2.3