nixos-config/users/simon/modules/zsh.nix
Simon Bruder d704dab620
zsh: Do not match #
Nix flakes use # extensively, so quoting '#' every time is not feasible.

This needs to be added to the end of initExtra so other commands do not
reset it.
2021-05-01 16:53:47 +02:00

93 lines
2.7 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, pkgs, ... }:
let
dircolors-solarized = pkgs.fetchFromGitHub {
owner = "seebi";
repo = "dircolors-solarized";
rev = "65d4d595ceca96166139862131a006fa3079e00a";
sha256 = "1nl5rs24gi7zqg7nqsbf9fa94yggwzqf3n3imxgfywl8jny3cj1q";
meta.license = lib.licenses.mit;
};
in
{
programs = {
fzf = {
enable = true;
changeDirWidgetCommand = "fd --color always --type d";
changeDirWidgetOptions = [ "--preview 'exa --tree --color=always -L 4 {}'" ];
defaultCommand = "fd --color always";
defaultOptions = [
"--ansi"
"--color=bg+:#073642,bg:#002b36,spinner:#2aa198,hl:#268bd2"
"--color=fg:#839496,header:#268bd2,info:#b58900,pointer:#2aa198"
"--color=marker:#2aa198,fg+:#eee8d5,prompt:#b58900,hl+:#268bd2"
];
fileWidgetCommand = "fd --color always --type f";
fileWidgetOptions = [ "--preview 'head -n 100 {}'" ];
};
direnv = {
enable = true;
enableNixDirenvIntegration = true;
};
starship = {
enable = true;
settings = {
add_newline = false;
};
};
zsh = {
enable = true;
history = {
save = 100000;
size = 100000;
};
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
];
shellAliases = {
cp = "cp --reflink=auto"; # TODO: remove with coreutils > 8.32
exa = "exa --git --binary";
ipy = "ipython3";
l = "exa -l";
la = "exa -la";
ll = "exa -l";
ls = "exa";
userctl = "systemctl --user";
vim = "nvim";
vimdiff = "nvim -d";
ip = "ip --color=auto";
};
envExtra = ''
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
'';
initExtra = lib.mkAfter ''
eval $(${pkgs.coreutils}/bin/dircolors -b ${dircolors-solarized}/dircolors.ansi-universal)
# no sad smiley (starship shows exit status)
zstyle ':prompt:grml:right:setup' items
# do not glob # (conflicts with nix flakes)
disable -p '#'
# grml config sets these but systemd --user import-environment doesnt
# like escape sequences in environment variables
# FIXME: remove with systemd 248 (https://github.com/systemd/systemd/commit/30927a24848c4d727f7619cc74b878f098cdd724)
unset \
LESS_TERMCAP_mb \
LESS_TERMCAP_md \
LESS_TERMCAP_me \
LESS_TERMCAP_se \
LESS_TERMCAP_so \
LESS_TERMCAP_ue \
LESS_TERMCAP_us
source ${../files/zsh/pass-wrappers.zsh}
'';
};
};
}