zsh: migrate config to home-manager module
All checks were successful
Check flake / build-amd64-linux (push) Successful in 4m0s
All checks were successful
Check flake / build-amd64-linux (push) Successful in 4m0s
This commit is contained in:
@ -19,42 +19,137 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableGlobalCompInit = false;
|
||||
promptInit = "";
|
||||
home.programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
autosuggestion = {
|
||||
enable = true;
|
||||
strategy = [ "completion" ];
|
||||
};
|
||||
dotDir = ".config/zsh";
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
|
||||
history = {
|
||||
append = true;
|
||||
extended = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
save = 1000000;
|
||||
size = 1000000;
|
||||
};
|
||||
|
||||
historySubstringSearch = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
## Directories
|
||||
setopt AUTO_PUSHD
|
||||
setopt CDABLE_VARS
|
||||
setopt PUSHD_IGNORE_DUPS
|
||||
setopt PUSHD_SILENT
|
||||
setopt PUSHD_TO_HOME
|
||||
|
||||
## Expansion and globbing
|
||||
setopt EXTENDED_GLOB
|
||||
unsetopt GLOB_DOTS
|
||||
unsetopt NOMATCH
|
||||
|
||||
## History
|
||||
setopt BANG_HIST
|
||||
setopt HIST_VERIFY
|
||||
setopt INC_APPEND_HISTORY_TIME
|
||||
|
||||
## I/O
|
||||
setopt INTERACTIVE_COMMENTS
|
||||
setopt MULTIOS
|
||||
unsetopt CLOBBER
|
||||
|
||||
## Jobs
|
||||
setopt LONG_LIST_JOBS
|
||||
setopt AUTO_RESUME
|
||||
unsetopt BG_NICE
|
||||
unsetopt NOTIFY
|
||||
unsetopt HUP
|
||||
unsetopt CHECK_JOBS
|
||||
|
||||
## Shell emulation
|
||||
setopt APPEND_CREATE
|
||||
|
||||
## Prompt
|
||||
PS1="%B%{$fg[magenta]%}%~%{$reset_color%} $%b "
|
||||
|
||||
## Vi mode
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
## Zsh line editor
|
||||
unsetopt BEEP
|
||||
'';
|
||||
|
||||
initExtraBeforeCompInit = ''
|
||||
setopt HASH_LIST_ALL
|
||||
'';
|
||||
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
name = "fast-syntax-highlighting";
|
||||
src = zsh-fast-syntax-highlighting;
|
||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-vi-mode";
|
||||
src = zsh-vi-mode;
|
||||
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
||||
}
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
MODE_INDICATOR = "";
|
||||
MODE_CURSOR_VIINS = "#b77ee0 blinking bar";
|
||||
MODE_CURSOR_REPLACE = "$MODE_CURSOR_VIINS #ff3334";
|
||||
MODE_CURSOR_VICMD = "#b77ee0 block";
|
||||
MODE_CURSOR_SEARCH = "#e7c547 steady underline";
|
||||
MODE_CURSOR_VISUAL = "$MODE_CURSOR_VICMD steady bar";
|
||||
MODE_CURSOR_VLINE = "$MODE_CURSOR_VISUAL #54ced6";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
# Verbose file operations
|
||||
cp = "cp -iv";
|
||||
mv = "mv -iv";
|
||||
rm = "rm -v";
|
||||
mkdir = "mkdir -v";
|
||||
|
||||
# Colorize commands
|
||||
ls = "ls -h --collor=auto --group-directories-first";
|
||||
|
||||
# Abbreviations
|
||||
e = "$EDITOR";
|
||||
f = "$FILE";
|
||||
g = "git";
|
||||
m = "neomutt";
|
||||
n = "$FILE";
|
||||
v = "$EDITOR";
|
||||
};
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = pkgs.unstable.fzf;
|
||||
};
|
||||
};
|
||||
|
||||
user.packages = with pkgs; [
|
||||
fd
|
||||
unstable.fzf
|
||||
jq
|
||||
nix-zsh-completions
|
||||
nnn
|
||||
ripgrep
|
||||
zsh
|
||||
];
|
||||
|
||||
env = {
|
||||
ZDOTDIR = "$XDG_CONFIG_HOME/zsh";
|
||||
ZSH_CACHE = "$XDG_CACHE_HOME/zsh";
|
||||
ZGEN_DIR = "$XDG_DATA_HOME/zgenom";
|
||||
};
|
||||
|
||||
home.configFile = {
|
||||
"zsh/.zshrc".source = ./.zshrc;
|
||||
"zsh/aliases.zsh".source = ./aliases.zsh;
|
||||
"zsh/completion.zsh".source = ./completion.zsh;
|
||||
"zsh/config.zsh".source = ./config.zsh;
|
||||
"zsh/keybinds.zsh".source = ./keybinds.zsh;
|
||||
};
|
||||
|
||||
system.userActivationScripts.cleanupZgen = ''
|
||||
rm -rf $ZDOTDIR/.*.zwc
|
||||
rm -f $ZDOTDIR/.zcompdump
|
||||
rm -rf $ZSH_CACHE
|
||||
rm -fv $ZGEN_DIR/init.zsh{,.zwc}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user