feat(home-manager): add starship prompt and reorganize CLI features

- Move zsh configuration from global/ to features/cli/
- Add starship.nix with custom prompt configuration
  - Left prompt: username@hostname, directory, git status, vi-mode indicator
  - Right prompt: language/environment indicators (C, direnv, Haskell, Bun, Python, Rust)
  - Git status with semantic colors (green=staged, yellow=modified/untracked, red=conflicted/deleted, cyan=stashed/renamed)
  - Vi-mode aware prompt character (red heart in insert, blue in normal)
- Update features/cli to import starship via zsh.nix
- Remove empty imports section from global/default.nix
This commit is contained in:
♥ Minnie ♥ 2025-10-25 23:13:22 +08:00
parent 65f6a14f69
commit bdf7c14c6c
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
4 changed files with 75 additions and 5 deletions

View file

@ -7,6 +7,7 @@
./git.nix ./git.nix
./mpd.nix ./mpd.nix
./ssh.nix ./ssh.nix
./zsh.nix
]; ];
home.packages = with pkgs; home.packages = with pkgs;

View file

@ -0,0 +1,70 @@
{...}: {
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
# Left prompt: username@hostname directory git ♥
format = "$username$hostname$directory$git_branch$git_status$character";
# Right prompt: language indicators
right_format = "$c$direnv$haskell$bun$python$rust";
# Blue username
username = {
style_user = "blue";
style_root = "red";
format = "[$user]($style)";
show_always = true;
};
# Blue @hostname
hostname = {
ssh_only = false;
format = "[@$hostname]($style) ";
style = "blue";
};
# Cyan directory
directory = {
style = "cyan";
format = "[$path]($style) ";
truncation_length = 0;
truncate_to_repo = false;
};
# Git branch (purple, no bold)
git_branch = {
style = "purple";
};
# Git status with semantic colors (no bold, no brackets)
git_status = {
format = "$conflicted$stashed$deleted$renamed$modified$staged$untracked$ahead_behind";
conflicted = "[=$count](red) ";
ahead = "[$count](cyan) ";
behind = "[$count](cyan) ";
diverged = "[$ahead_count](cyan)[$behind_count](cyan) ";
untracked = "[?$count](yellow) ";
stashed = "[\\$$count](cyan) ";
modified = "[!$count](yellow) ";
staged = "[+$count](green) ";
renamed = "[»$count](cyan) ";
deleted = "[$count](red) ";
};
# Heart prompt character (red in insert mode, blue in normal mode)
character = {
success_symbol = "[](red)";
error_symbol = "[](red)";
vicmd_symbol = "[](blue)";
};
# Language modules for right prompt (only configure non-defaults)
# Enable direnv (disabled by default)
direnv.disabled = false;
# C, Python, Haskell, Bun, Rust: use defaults
};
};
}

View file

@ -1,4 +1,8 @@
{pkgs, ...}: { {pkgs, ...}: {
imports = [
./starship.nix
];
home.packages = with pkgs; [ home.packages = with pkgs; [
fzf # command-line fuzzy finder fzf # command-line fuzzy finder
]; ];
@ -47,7 +51,6 @@
bindkey "^[[1;5C" forward-word bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word bindkey "^[[1;5D" backward-word
export PATH export PATH
PROMPT='%F{blue}%n@%m %F{cyan}%~ %F{red} %f';
''; '';
}; };
} }

View file

@ -2,10 +2,6 @@
# This module provides base user settings, nixpkgs configuration, and core imports # This module provides base user settings, nixpkgs configuration, and core imports
# that are inherited across all hosts where this user is configured. # that are inherited across all hosts where this user is configured.
{outputs, lib, ...}: { {outputs, lib, ...}: {
imports = [
./zsh.nix # Shell configuration and plugins
];
# Nixpkgs configuration - applies overlays and sets package acceptance policy # Nixpkgs configuration - applies overlays and sets package acceptance policy
nixpkgs = { nixpkgs = {
# Apply custom overlays to extend/modify the package set # Apply custom overlays to extend/modify the package set