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:
parent
65f6a14f69
commit
bdf7c14c6c
4 changed files with 75 additions and 5 deletions
|
|
@ -7,6 +7,7 @@
|
|||
./git.nix
|
||||
./mpd.nix
|
||||
./ssh.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs;
|
||||
|
|
|
|||
70
home-manager/sajenim/features/cli/starship.nix
Normal file
70
home-manager/sajenim/features/cli/starship.nix
Normal 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
|
||||
};
|
||||
};
|
||||
}
|
||||
56
home-manager/sajenim/features/cli/zsh.nix
Normal file
56
home-manager/sajenim/features/cli/zsh.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./starship.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
fzf # command-line fuzzy finder
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
||||
# Enable extra features
|
||||
autosuggestion = {
|
||||
enable = true;
|
||||
};
|
||||
syntaxHighlighting = {
|
||||
enable = true;
|
||||
};
|
||||
enableCompletion = true;
|
||||
|
||||
# Configuration directory
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = {
|
||||
# Single letter aliases
|
||||
c = "clear";
|
||||
v = "nvim";
|
||||
|
||||
# Double letter aliases
|
||||
la = "ls -a";
|
||||
ll = "ls -l";
|
||||
};
|
||||
|
||||
# Install plugins
|
||||
plugins = [
|
||||
{ # vi(vim) mode for ZSH
|
||||
name = "zsh-vi-mode";
|
||||
src = "${pkgs.zsh-vi-mode}/share/zsh-vi-mode";
|
||||
}
|
||||
|
||||
{ # replace zsh's completion with fzf
|
||||
name = "fzf-tab";
|
||||
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
|
||||
}
|
||||
];
|
||||
|
||||
# Extra commands that should be added to '.zshrc'
|
||||
initContent = ''
|
||||
eval "$(direnv hook zsh)"
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
export PATH
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue