os/modules/terminal-life/zsh/default.nix

95 lines
2.7 KiB
Nix
Raw Normal View History

2021-05-30 19:10:28 +00:00
{ config, pkgs, ... }:
let
psCfg = config.pub-solar;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
in
{
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
dotDir = ".config/zsh";
history = {
ignoreDups = true;
expireDuplicatesFirst = true;
ignoreSpace = true;
path = "$HOME/.local/share/zsh/zsh_history";
save = 10000;
size = 10000;
};
shellAliases = {
nano = "nvim";
vi = "nvim";
vim = "nvim";
mutt = "neomutt";
ls = "exa";
la = "exa --group-directories-first -lag";
fm = "vifm .";
vifm = "vifm .";
wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts";
irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi";
drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone";
no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix";
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=/etc/nixos/lib/compat";
};
zplug = {
enable = true;
plugins = [
{
name = "plugins/z";
tags = [ "from:oh-my-zsh" ];
}
{
name = "romkatv/powerlevel10k";
tags = [ "as:theme" "depth:1" ];
}
{ name = "zdharma/fast-syntax-highlighting"; }
{ name = "chisui/zsh-nix-shell"; }
];
};
initExtra = ''
bindkey -v
bindkey -v 'jj' vi-cmd-mode
bindkey -a 'i' up-line
bindkey -a 'k' down-line
bindkey -a 'j' backward-char
bindkey -a 'h' vi-insert
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^ ' autosuggest-accept
bindkey '^q' push-line-or-edit
bindkey '^R' fzf-history-widget
# ArrowUp/Down start searching history with current input
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
# MAKE CTRL+S WORK IN VIM
stty -ixon
stty erase '^?'
# If a command is not found, show me where it is
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
''
+ builtins.readFile ./base16.zsh
+ builtins.readFile ./p10k.zsh
+
''
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
source ${pkgs.fzf}/share/fzf/completion.zsh
source ${pkgs.git-bug}/share/zsh/site-functions/git-bug
eval "$(direnv hook zsh)"
''
+ builtins.readFile ./fzf.zsh;
}