2023-07-29 12:36:44 +02:00
|
|
|
{ pkgs, lib, config, ... }:
|
2024-06-30 17:29:26 +02:00
|
|
|
let
|
|
|
|
cfg = config.programs.zsh;
|
|
|
|
in
|
2022-03-07 16:01:52 +01:00
|
|
|
{
|
2024-06-30 17:29:26 +02:00
|
|
|
home.file."${cfg.dotDir}/.zshrc".onChange = ''
|
|
|
|
${lib.getExe (pkgs.writeTextFile {
|
|
|
|
name = "zsh-compinit-oneshot.zsh";
|
|
|
|
executable = true;
|
|
|
|
destination = "/bin/zsh-compinit-oneshot.zsh";
|
|
|
|
text = ''
|
|
|
|
#!${lib.getExe cfg.package}
|
|
|
|
|
|
|
|
autoload -Uz compinit && compinit -C -d "${config.xdg.cacheHome}/zsh/zcompdump-$ZSH_VERSION"
|
|
|
|
'';
|
|
|
|
})}
|
|
|
|
'';
|
|
|
|
|
2022-10-13 23:43:58 +02:00
|
|
|
programs.zsh = {
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
enable = true;
|
|
|
|
dotDir = ".config/zsh";
|
|
|
|
# enableSyntaxHighlighting = true;
|
|
|
|
defaultKeymap = "viins";
|
2022-10-13 23:43:58 +02:00
|
|
|
enableCompletion = true;
|
|
|
|
|
|
|
|
initExtraBeforeCompInit = ''
|
|
|
|
fpath+=(${pkgs.zsh-completions}/share/zsh/site-functions)
|
|
|
|
'';
|
2022-03-07 16:01:52 +01:00
|
|
|
|
2024-06-30 17:29:26 +02:00
|
|
|
completionInit = "";
|
2023-05-08 01:55:43 +02:00
|
|
|
|
2022-08-19 12:55:47 +02:00
|
|
|
history = {
|
|
|
|
extended = true;
|
|
|
|
ignoreDups = false;
|
|
|
|
size = 100000;
|
|
|
|
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
|
|
|
};
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
plugins = [
|
|
|
|
# {
|
|
|
|
# name = "nix-zsh-shell-integration";
|
2022-06-11 19:59:28 +02:00
|
|
|
# src = pkgs.nix-zsh-shell;
|
2022-03-07 16:01:52 +01:00
|
|
|
# }
|
2022-10-13 23:43:58 +02:00
|
|
|
{
|
|
|
|
name = "fzf-tab";
|
|
|
|
src = pkgs.zsh-fzf-tab;
|
|
|
|
file = "share/fzf-tab/fzf-tab.plugin.zsh";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "powerlevel10k";
|
|
|
|
src = pkgs.zsh-powerlevel10k;
|
|
|
|
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
|
|
|
}
|
2022-03-07 16:01:52 +01:00
|
|
|
{
|
|
|
|
name = "zsh-fast-syntax-highlighting";
|
|
|
|
src = pkgs.zsh-fast-syntax-highlighting;
|
2022-10-13 23:43:58 +02:00
|
|
|
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
2022-03-07 16:01:52 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zsh-completions";
|
|
|
|
src = pkgs.zsh-completions;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zsh-you-should-use";
|
|
|
|
src = pkgs.zsh-you-should-use;
|
2022-10-13 23:43:58 +02:00
|
|
|
file = "share/zsh/plugins/you-should-use/you-should-use.plugin.zsh";
|
2022-03-07 16:01:52 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zsh-autosuggestions";
|
|
|
|
src = pkgs.zsh-autosuggestions;
|
2022-10-13 23:43:58 +02:00
|
|
|
file = "share/zsh-autosuggestions/zsh-autosuggestions.zsh";
|
2022-06-11 19:59:28 +02:00
|
|
|
}
|
2022-03-07 16:01:52 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
initExtra = ''
|
|
|
|
source ${./p10k.zsh}
|
2023-07-29 12:36:44 +02:00
|
|
|
|
2022-10-13 23:43:58 +02:00
|
|
|
enable-fzf-tab
|
|
|
|
|
2023-12-18 20:59:48 +01:00
|
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview '${lib.getExe pkgs.eza} -1 --color=always $realpath'
|
2022-10-13 23:43:58 +02:00
|
|
|
|
|
|
|
# Use tmux buffer if we are inside tmux
|
|
|
|
if ! { [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; } then
|
|
|
|
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
|
|
|
|
fi
|
2022-03-07 16:01:52 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|