zsh: vanilla

This commit is contained in:
js0ny 2025-11-02 23:59:10 +00:00
parent dfcbd50294
commit 97be9c3dbf
2 changed files with 68 additions and 19 deletions

View file

@ -5,6 +5,4 @@
defaultTerminalRunner = "alacritty";
iconTheme = "Papirus";
};
currentHost = {
};
}

View file

@ -16,13 +16,20 @@ in {
historySubstringSearch.enable = true;
enableCompletion = true;
dotDir = "${config.xdg.configHome}/zsh";
shellAliases = aliases;
# shellAliases = aliases;
defaultKeymap = "emacs";
zsh-abbr = {
enable = true;
abbreviations = aliases;
};
syntaxHighlighting = {
enable = true;
patterns = {
"rm -rf *" = "fg=blue,bold,bg=red";
};
styles = {
path = "fg=cyan";
};
highlighters = [
"main"
"pattern"
@ -31,23 +38,67 @@ in {
];
};
initContent = ''
# # Emacs Hybrid
# bindkey '^A' beginning-of-line
# bindkey '^E' end-of-line
# bindkey '^F' forward-char
# bindkey '^B' backward-char
# bindkey '^P' up-line-or-history
# bindkey '^N' down-line-or-history
# # bindkey '^R' history-incremental-search-backward # Use fzf
# bindkey '^K' kill-line
#
# bindkey -M viins '^?' backward-delete-char
# bindkey -M viins '^H' backward-kill-word
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' 'r:|=*'
# Options
# ==========
# fzf-tab 模糊匹配
zstyle ':fzf-tab:*' use-fzf-default-bindings yes
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
# ! This breaks the nixos-rebuild --flake .#something
# setopt INTERACTIVE_COMMENTS # Allow comments in interactive mode
# Globbing
setopt EXTENDED_GLOB # Extended globbing
setopt GLOB_DOTS # Include dotfiles in globbing
# Error correction
setopt CORRECT # Suggest corrections for commands
setopt CORRECT_ALL # Suggest corrections for arguments
# edit command line
autoload -Uz edit-command-line
zle -N edit-command-line
### completion
### =================
# use tab to select
zstyle ':completion:*' menu select
# substring matching
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# use cache
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
# Colours in completion
zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
# Key bindings (Emacs with modern enhancement)
# ===============================================
bindkey '^H' backward-kill-word # Ctrl-Backspace
bindkey '^[^?' backward-kill-line # Alt-Backspace
bindkey '^[[1;5D' backward-word # Ctrl-Left
bindkey '^[[1;5C' forward-word # Ctrl-Right
bindkey '^[[1;3D' beginning-of-line # Alt-Left
bindkey '^[[1;3C' end-of-line # Alt-Right
bindkey '^[[H' beginning-of-line # Home
bindkey '^[[F' end-of-line # End
bindkey '^[[3~' delete-char # Delete
bindkey '^[[3;5~' kill-word # Ctrl-Delete
bindkey '^[[3;3~' kill-line # Alt-Delete
# Misc
# ========
# source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
'';
};
}