Add comprehensive zsh configuration with Powerlevel10k

- Create separate zsh.nix module for enhanced shell experience
- Add Powerlevel10k theme with custom configuration from wizard
- Include useful aliases for git, nix, and navigation commands
- Add modern CLI tools: fzf, fd, ripgrep, bat for better productivity
- Enable autosuggestions, syntax highlighting, and completion
- Add portable p10k.zsh configuration for consistent prompt across machines
- Update flake.nix to import zsh module and remove inline config
- Update tmux.nix with prefix indicator and datetime removal

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yan Lin 2025-07-26 10:36:08 +02:00
parent b30b393541
commit c0bba829c2
4 changed files with 1789 additions and 12 deletions

View file

@ -26,7 +26,7 @@
};
homeConfiguration = { pkgs, ... }: {
imports = [ ./nvim.nix ./tmux.nix ];
imports = [ ./nvim.nix ./tmux.nix ./zsh.nix ];
home.username = "yanlin";
home.homeDirectory = "/Users/yanlin";
@ -49,14 +49,7 @@
programs.home-manager.enable = true;
programs.zsh = {
enable = true;
defaultKeymap = "viins";
enableVteIntegration = true;
sessionVariables = {
COLORTERM = "truecolor";
};
};
};
in
{
@ -64,7 +57,7 @@
modules = [ configuration ];
};
darwinConfigurations."mba" = nix-darwin.lib.darwinSystem {
darwinConfigurations."Macbook-Air" = nix-darwin.lib.darwinSystem {
modules = [ configuration ];
};

1720
p10k.zsh Normal file

File diff suppressed because it is too large Load diff

View file

@ -35,9 +35,9 @@
# Status bar content
set -g status-left-length 40
set -g status-right-length 50
set -g status-right-length 20
set -g status-left ' #S '
set -g status-right ' %H:%M %d-%b-%y '
set -g status-right '#{?client_prefix,#[reverse]<Prefix>#[noreverse] ,}'
# Window status format
set -g window-status-format ' #I:#W '

64
zsh.nix Normal file
View file

@ -0,0 +1,64 @@
{ pkgs, ... }:
{
programs.zsh = {
enable = true;
defaultKeymap = "viins";
enableVteIntegration = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
sessionVariables = {
COLORTERM = "truecolor";
EDITOR = "nvim";
};
shellAliases = {
ll = "ls -alF";
la = "ls -A";
l = "ls -CF";
".." = "cd ..";
"..." = "cd ../..";
# Git aliases
gs = "git status";
ga = "git add";
gc = "git commit";
gp = "git push";
gl = "git pull";
gd = "git diff";
# Nix helpers
hm = "home-manager";
hms = "home-manager switch --flake ~/.config/nix#yanlin";
};
initExtra = ''
# Load Powerlevel10k theme
if [[ -f ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme ]]; then
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
fi
# Load Powerlevel10k configuration (managed by Nix)
source ~/.p10k.zsh
'';
};
# Essential packages for enhanced zsh experience
home.packages = with pkgs; [
zsh-powerlevel10k
fzf
fd
ripgrep
bat
];
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
# Manage Powerlevel10k configuration
home.file.".p10k.zsh".source = ./p10k.zsh;
}