Reorganize configuration into modular directory structure
- Create modules/ directory for Nix configuration modules - Create config/ directory for configuration files - Move nvim.nix, tmux.nix, zsh.nix to modules/ - Move p10k.zsh to config/ - Update flake.nix import paths to reference new structure - Update zsh.nix p10k.zsh path reference - Update README.md architecture documentation - Keep tmux.sh at root for easy accessibility This provides better separation between Nix modules and config files while maintaining a clean, scalable structure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2295aa9131
commit
539ba9fef7
6 changed files with 11 additions and 9 deletions
98
modules/zsh.nix
Normal file
98
modules/zsh.nix
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
{ 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";
|
||||
};
|
||||
|
||||
initContent = ''
|
||||
# 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
|
||||
|
||||
# Vim mode configuration
|
||||
# Reduce delay when switching modes (10ms instead of 400ms)
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Cursor shape changes for vim modes
|
||||
function zle-keymap-select {
|
||||
case $KEYMAP in
|
||||
vicmd) echo -ne '\e[1 q';; # block cursor for normal mode
|
||||
viins|main) echo -ne '\e[5 q';; # line cursor for insert mode
|
||||
esac
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# Ensure we start with line cursor in insert mode
|
||||
function zle-line-init {
|
||||
echo -ne '\e[5 q'
|
||||
}
|
||||
zle -N zle-line-init
|
||||
|
||||
# Fix cursor after each command
|
||||
function preexec {
|
||||
echo -ne '\e[5 q'
|
||||
}
|
||||
|
||||
# Additional vim-like bindings
|
||||
bindkey -M vicmd 'k' history-search-backward
|
||||
bindkey -M vicmd 'j' history-search-forward
|
||||
bindkey -M vicmd '/' history-incremental-search-backward
|
||||
bindkey -M vicmd '?' history-incremental-search-forward
|
||||
|
||||
# Better word movement in insert mode
|
||||
bindkey '^[[1;5C' forward-word # Ctrl+Right
|
||||
bindkey '^[[1;5D' backward-word # Ctrl+Left
|
||||
'';
|
||||
};
|
||||
|
||||
# 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 = ../config/p10k.zsh;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue