2024-05-18 20:00:18 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.shell.zsh;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
shell.zsh.enable = lib.mkEnableOption "Zsh, an advanced shell";
|
2024-03-07 11:56:28 +01:00
|
|
|
};
|
|
|
|
|
2024-05-18 20:00:18 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
enableAutosuggestions = true;
|
|
|
|
enableCompletion = true;
|
|
|
|
defaultKeymap = "emacs";
|
|
|
|
dotDir = ".config/zsh";
|
|
|
|
history.expireDuplicatesFirst = true;
|
|
|
|
history.path = "$ZDOTDIR/.zsh_history";
|
|
|
|
historySubstringSearch.enable = true;
|
|
|
|
shellAliases = {
|
|
|
|
ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first";
|
|
|
|
diff = "${pkgs.diffutils}/bin/diff --color=auto";
|
|
|
|
grep = "${pkgs.gnugrep}/bin/grep --color=auto";
|
|
|
|
ip = "${pkgs.iproute2}/bin/ip --color=auto";
|
|
|
|
mkdir = "${pkgs.coreutils}/bin/mkdir -p";
|
|
|
|
gst = "${pkgs.git}/bin/git status";
|
|
|
|
gc = "${pkgs.git}/bin/git commit";
|
|
|
|
ga = "${pkgs.git}/bin/git add";
|
|
|
|
gpl = "${pkgs.git}/bin/git pull";
|
|
|
|
gpu = "${pkgs.git}/bin/git push";
|
|
|
|
gd = "${pkgs.git}/bin/git diff";
|
|
|
|
gch = "${pkgs.git}/bin/git checkout";
|
|
|
|
gs = "${pkgs.git}/bin/git switch";
|
|
|
|
gre = "${pkgs.git}/bin/git restore";
|
|
|
|
gr = "${pkgs.git}/bin/git remote";
|
|
|
|
gcl = "${pkgs.git}/bin/git clone";
|
|
|
|
glg = "${pkgs.git}/bin/git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
|
|
|
|
gb = "${pkgs.git}/bin/git branch";
|
|
|
|
gm = "${pkgs.git}/bin/git merge";
|
|
|
|
gf = "${pkgs.git}/bin/git fetch";
|
2024-03-07 11:56:28 +01:00
|
|
|
};
|
2024-05-18 20:00:18 +02:00
|
|
|
syntaxHighlighting.enable = true;
|
|
|
|
syntaxHighlighting.highlighters = ["main" "brackets"];
|
|
|
|
initExtra = ''
|
|
|
|
# auto completion
|
|
|
|
bindkey '^I' complete-word
|
|
|
|
bindkey '^[[Z' autosuggest-accept
|
|
|
|
# backspace
|
|
|
|
bindkey '^[[3' delete-char
|
|
|
|
# home / end go to beginning / end of line
|
|
|
|
bindkey '^[[H' beginning-of-line
|
|
|
|
bindkey '^[[F' end-of-line
|
|
|
|
# ctrl+arrow jump word
|
|
|
|
bindkey '^[[1;5D' backward-word
|
|
|
|
bindkey '^[[1;5C' forward-word
|
|
|
|
# ctrl+entf and ctrl+backspace delete word
|
|
|
|
bindkey '^[[3;5~' delete-word
|
|
|
|
bindkey '^H' backward-delete-word
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
programs.starship = {
|
|
|
|
enable = true;
|
|
|
|
enableZshIntegration = true;
|
|
|
|
settings = {
|
|
|
|
add_newline = false;
|
|
|
|
command_timeout = 5000;
|
|
|
|
character = {
|
|
|
|
success_symbol = "[](bold green)";
|
|
|
|
error_symbol = "[](bold red)";
|
|
|
|
};
|
|
|
|
cmd_duration = {
|
|
|
|
min_time = 500;
|
|
|
|
show_milliseconds = true;
|
|
|
|
};
|
2024-03-07 11:56:28 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-18 20:00:18 +02:00
|
|
|
programs.zoxide = {
|
|
|
|
enable = true;
|
|
|
|
enableZshIntegration = true;
|
|
|
|
options = ["--cmd cd"];
|
|
|
|
};
|
2024-03-07 11:56:28 +01:00
|
|
|
};
|
|
|
|
}
|