Initial zsh setup
This commit is contained in:
parent
368bf1f1f3
commit
37e8506352
|
@ -5,6 +5,7 @@
|
|||
./overlay-pkgs
|
||||
./user
|
||||
./emacs
|
||||
./zsh
|
||||
];
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
|
27
modules/zsh/completion.zsh
Executable file
27
modules/zsh/completion.zsh
Executable file
|
@ -0,0 +1,27 @@
|
|||
# completion types
|
||||
zstyle ':completion:*' completer _extensions _complete
|
||||
|
||||
# jump directly to first completion
|
||||
zstyle ':completion:::::default' menu yes select
|
||||
|
||||
# matching
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[.+-]=* r:|=*' 'l:|=* r:|=*'
|
||||
|
||||
# allow highlight/menu move in completions
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# styles
|
||||
zstyle ':completion:*:*:*:*:descriptions' format '%F{green}// %d%f'
|
||||
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}// %d%f'
|
||||
zstyle ':completion:*:messages' format '%F{purple}// %d%f'
|
||||
zstyle ':completion:*:warnings' format '%F{red}// no completions availible%f'
|
||||
|
||||
# group results under headers
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*:*:-command-:*:*' group-order alias builtins functions commands
|
||||
|
||||
# file colors
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
# use --help completions when availible
|
||||
compdef _gnu_generic -default- -P '*'
|
67
modules/zsh/default.nix
Normal file
67
modules/zsh/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{ pkgs, config, impurity, ... }: {
|
||||
# put it in /etc/shells
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users.${config.main-user}.shell = pkgs.zsh;
|
||||
|
||||
home-manager.users.${config.main-user} = { config, ... }: let
|
||||
zshDir = ".config/zsh";
|
||||
zshPath = "${config.home.homeDirectory}/${zshDir}";
|
||||
|
||||
history = 1000000;
|
||||
in {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
||||
# path to zsh configs
|
||||
dotDir = zshDir;
|
||||
enableCompletion = true;
|
||||
|
||||
history = {
|
||||
path = "${zshPath}/history";
|
||||
|
||||
# lines of history to save
|
||||
save = history;
|
||||
size = history;
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "zsh-syntax-highlighting";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "master";
|
||||
sha256 = "iKx7lsQCoSAbpANYFkNVCZlTFdwOEI34rx/h1rnraSg=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-completions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-completions";
|
||||
rev = "master";
|
||||
sha256 = "MRGIKZtXk1+Yb8AV4NOqpSiP4IkWxPTJoLftq7VDjoE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "master";
|
||||
sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w=";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
initExtra = ''
|
||||
# keybinds
|
||||
source ${impurity.link ./keybinds.zsh}
|
||||
|
||||
# completions
|
||||
source ${impurity.link ./completion.zsh}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
14
modules/zsh/keybinds.zsh
Executable file
14
modules/zsh/keybinds.zsh
Executable file
|
@ -0,0 +1,14 @@
|
|||
autoload -U up-line-or-beginning-search
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey "^[[A" up-line-or-beginning-search
|
||||
bindkey "^[[B" down-line-or-beginning-search
|
||||
bindkey "^[OA" up-line-or-beginning-search
|
||||
bindkey "^[OB" down-line-or-beginning-search
|
||||
bindkey "^K" up-line-or-beginning-search
|
||||
bindkey "^J" down-line-or-beginning-search
|
||||
bindkey "^[[1;5D" backward-word
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^H" backward-char
|
||||
bindkey "^L" forward-char
|
Loading…
Reference in a new issue