191 lines
5.5 KiB
Nix
191 lines
5.5 KiB
Nix
{
|
|
|
|
flake.modules.homeManager.shell =
|
|
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
home.sessionVariables = {
|
|
STARSHIP_CACHE = "${config.xdg.cacheHome}/starship";
|
|
};
|
|
|
|
home.activation = {
|
|
clearZshCompDump = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
rm -f "${config.programs.zsh.dotDir}"/.zcompdump*
|
|
'';
|
|
};
|
|
|
|
programs.zsh = {
|
|
enable = true;
|
|
dotDir = "${config.xdg.configHome}/zsh";
|
|
|
|
enableCompletion = true;
|
|
completionInit = ''
|
|
autoload -U compinit
|
|
compinit -C
|
|
|
|
ZCOMPDUMP="${config.programs.zsh.dotDir}/.zcompdump"
|
|
{
|
|
if [[ -s "$ZCOMPDUMP" && (! -s "''${ZCOMPDUMP}.zwc" || "$ZCOMPDUMP" -nt "''${ZCOMPDUMP}.zwc") ]]; then
|
|
zcompile "$ZCOMPDUMP"
|
|
fi
|
|
} &!
|
|
'';
|
|
autosuggestion.enable = true;
|
|
|
|
syntaxHighlighting = {
|
|
enable = true;
|
|
highlighters = [
|
|
"main"
|
|
"brackets"
|
|
"pattern"
|
|
"regexp"
|
|
"root"
|
|
"line"
|
|
];
|
|
};
|
|
|
|
historySubstringSearch.enable = true;
|
|
|
|
history = {
|
|
ignoreDups = true;
|
|
save = 10000;
|
|
size = 10000;
|
|
path = "${config.xdg.dataHome}/zsh_history";
|
|
};
|
|
|
|
profileExtra = lib.optionalString (config.home.sessionPath != [ ]) ''
|
|
export PATH="$PATH''${PATH:+:}${lib.concatStringsSep ":" config.home.sessionPath}"
|
|
'';
|
|
|
|
initContent = ''
|
|
bindkey -v
|
|
|
|
export KEYTIMEOUT=1
|
|
|
|
autoload -U history-search-end
|
|
zle -N history-beginning-search-backward-end history-search-end
|
|
zle -N history-beginning-search-forward-end history-search-end
|
|
bindkey "^[OA" history-beginning-search-backward-end
|
|
bindkey "^[OB" history-beginning-search-forward-end
|
|
|
|
zstyle ':completion:*' completer _extensions _complete _approximate
|
|
zstyle ':completion:*' use-cache on
|
|
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
|
zstyle ':completion:*' complete true
|
|
zstyle ':completion:*' complete-options true
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
zstyle ':completion:*' keep-prefix true
|
|
zstyle ':completion:*' menu select
|
|
zstyle ':completion:*' list-grouped false
|
|
zstyle ':completion:*' list-separator '''
|
|
zstyle ':completion:*' group-name '''
|
|
zstyle ':completion:*' verbose yes
|
|
zstyle ':completion:*:matches' group 'yes'
|
|
zstyle ':completion:*:warnings' format '%F{red}%B-- No match for: %d --%b%f'
|
|
zstyle ':completion:*:messages' format '%d'
|
|
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
|
|
zstyle ':completion:*:descriptions' format '[%d]'
|
|
zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
|
|
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
|
|
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
|
|
zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands
|
|
zstyle ':completion:*' special-dirs true
|
|
zstyle ':completion:*' squeeze-slashes true
|
|
zstyle ':completion:*' sort false
|
|
zstyle ":completion:*:git-checkout:*" sort false
|
|
zstyle ':completion:*' file-sort modification
|
|
zstyle ':completion:*:eza' sort false
|
|
zstyle ':completion:complete:*:options' sort false
|
|
zstyle ':completion:files' sort false
|
|
'';
|
|
};
|
|
|
|
programs.starship = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
settings = {
|
|
add_newline = true;
|
|
|
|
format = lib.concatStrings [
|
|
"$nix_shell"
|
|
"$hostname"
|
|
"$directory"
|
|
"$git_branch"
|
|
"$git_state"
|
|
"$git_status"
|
|
"$line_break"
|
|
"$character"
|
|
];
|
|
|
|
directory = {
|
|
truncation_length = 99;
|
|
truncate_to_repo = false;
|
|
};
|
|
|
|
nix_shell = {
|
|
format = "[$symbol]($style) ";
|
|
symbol = "🐚";
|
|
style = "";
|
|
};
|
|
|
|
git_status = {
|
|
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218)($ahead_behind$stashed)]($style)";
|
|
style = "cyan";
|
|
conflicted = "";
|
|
renamed = "";
|
|
deleted = "";
|
|
stashed = "≡";
|
|
};
|
|
|
|
git_state = {
|
|
format = "([$state( $progress_current/$progress_total)]($style)) ";
|
|
style = "bright-black";
|
|
};
|
|
|
|
line_break.disabled = false;
|
|
};
|
|
};
|
|
|
|
programs.eza = {
|
|
enable = true;
|
|
extraOptions = [ "--group-directories-first" ];
|
|
};
|
|
|
|
programs.zoxide = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
|
|
programs.fzf = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
|
|
programs.bottom.enable = true;
|
|
|
|
programs.yazi.enable = true;
|
|
|
|
home.packages = [
|
|
pkgs.fd
|
|
pkgs.bat
|
|
pkgs.comma
|
|
pkgs.tlrc
|
|
pkgs.sd
|
|
pkgs.procs
|
|
pkgs.dust
|
|
pkgs.duf
|
|
pkgs.systemctl-tui
|
|
];
|
|
|
|
services.tldr-update = {
|
|
enable = true;
|
|
package = pkgs.tlrc;
|
|
};
|
|
};
|
|
}
|