config/modules/shell-config/default.nix

82 lines
2.1 KiB
Nix
Raw Permalink Normal View History

2022-02-05 21:42:36 +02:00
{ pkgs, config, ... }:
let
component = name: builtins.readFile (builtins.toString ../../config/zsh/components + "/${name}.zsh");
snippets = map component [
"console-256color"
"fuzzy-tab"
"magic-space"
"navigation"
] ++ [
"source ${pkgs.fzf}/share/fzf/key-bindings.zsh"
"ZSH_HIGHLIGHT_DIRS_BLACKLIST=(/* /ipfs /ipns)"
];
in {
environment.shellAliases = {
cat = "bat";
df = "duf";
doas = "doas ";
du = "dua";
ip = "ip -c";
ls = "lsd";
sudo = "sudo ";
tree = "lsd --tree";
uctl = "systemctl --user";
vim = "nvim";
nvr = "nvr --servername /tmp/nvim-remote-$USER --remote-tab";
nix-repl = "nix repl '<repl>'";
# thanks gytis
manix-view = ''manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --ansi --preview="manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"'';
};
programs = {
zsh = {
enable = true;
histFile = "$HOME/.cache/zsh_history";
histSize = 15000;
setOptions = [
"autocd"
"autopushd"
"globcomplete"
"globstarshort"
"histexpiredupsfirst"
"histfcntllock"
"histignoredups"
"histnofunctions"
"histnostore"
"histreduceblanks"
"histverify"
"interactivecomments"
"monitor"
"nobadpattern"
"promptsubst"
"sharehistory"
"zle"
];
vteIntegration = true;
promptInit = builtins.readFile ../../config/zsh/prompt.zsh;
interactiveShellInit = builtins.concatStringsSep "\n" snippets;
enableCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "pattern" ];
styles = {
"precommand" = "fg=33";
"arg0" = "fg=39";
"single-hyphen-option" = "fg=229";
"double-hyphen-option" = "fg=228";
"path" = "none";
};
# these are aliases, highlight them properly regardless
patterns = {
"doas" = "fg=33";
"sudo" = "fg=33";
};
};
};
};
}