refactor(shell): split shell config
This commit is contained in:
parent
fe0d7069c1
commit
22bf1600b1
7 changed files with 102 additions and 85 deletions
home/shell
57
home/shell/zsh.nix
Normal file
57
home/shell/zsh.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let shellAliases = import ./aliases.nix;
|
||||
in {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
autocd = true;
|
||||
defaultKeymap = "viins";
|
||||
history.extended = true;
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
name = "first-tab-completion";
|
||||
src = lib.cleanSource ./.;
|
||||
file = "first-tab-completion.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-syntax-highlighting";
|
||||
src = zsh-syntax-highlighting;
|
||||
file = "share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-history-substring-search";
|
||||
src = zsh-history-substring-search;
|
||||
file =
|
||||
"share/zsh-history-substring-search/zsh-history-substring-search.zsh";
|
||||
}
|
||||
];
|
||||
initExtra = ''
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=1
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
|
||||
zmodload zsh/complist
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' insert-tab false
|
||||
bindkey '^I' first-tab-completion
|
||||
bindkey -M menuselect '\e' send-break
|
||||
bindkey -M menuselect "$terminfo[kcbt]" reverse-menu-complete
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
|
||||
setopt HIST_FIND_NO_DUPS
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
setopt extendedglob
|
||||
setopt kshglob
|
||||
'';
|
||||
inherit shellAliases;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue