2020-08-06 15:35:49 +00:00
|
|
|
# The Zoomer shell is cool for them prompts.
|
|
|
|
{ config, options, lib, pkgs, ... }:
|
|
|
|
|
2020-10-25 15:49:14 +00:00
|
|
|
with lib; {
|
2020-08-06 15:35:49 +00:00
|
|
|
options.modules.shell.zsh = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Going to use the home-manager module for zsh since it is cool.
|
|
|
|
config = mkIf config.modules.shell.zsh.enable {
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
enableCompletion = true;
|
2020-08-16 08:33:44 +00:00
|
|
|
autosuggestions.enable = true;
|
2020-10-25 15:49:14 +00:00
|
|
|
histFile = "$XDG_DATA_HOME/zsh/history";
|
2020-08-16 08:33:44 +00:00
|
|
|
|
|
|
|
# Adding basic version control support to the zsh prompt.
|
|
|
|
# https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh
|
2020-10-25 15:49:14 +00:00
|
|
|
promptInit =
|
|
|
|
"\n autoload -Uz vcs_info\n precmd_vcs_info() { vcs_info }\n precmd_functions+=( precmd_vcs_info )\n setopt prompt_subst\n zstyle ':vcs_info:*' formats '[%s] (%b)'\n autoload -U colors && colors\n PROMPT=\"%F%{\${fg[white]}%}%(0?.√.%?) %B%{$fg[magenta]%}%1~%{$reset_color%} $vcs_info_msg_0_ $%f%b \"\n RPROMPT=\"[%D %*]\"\n ";
|
2020-08-16 08:33:44 +00:00
|
|
|
|
2020-09-05 20:50:16 +00:00
|
|
|
interactiveShellInit = ''
|
|
|
|
# Use lf to switch directories and bind it to ctrl-o
|
|
|
|
lfcd () {
|
|
|
|
tmp="$(mktemp)"
|
|
|
|
lf -last-dir-path="$tmp" "$@"
|
|
|
|
if [ -f "$tmp" ]; then
|
|
|
|
dir="$(cat "$tmp")"
|
|
|
|
rm -f "$tmp" >/dev/null
|
|
|
|
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
bindkey -s '^o' 'lfcd\n'
|
|
|
|
'';
|
|
|
|
|
|
|
|
ohMyZsh.plugins = [ "history-substring-search" ];
|
2020-08-16 08:33:44 +00:00
|
|
|
syntaxHighlighting.enable = true;
|
2020-08-06 15:35:49 +00:00
|
|
|
};
|
2020-08-18 16:48:02 +00:00
|
|
|
|
|
|
|
my.home.home.file = {
|
|
|
|
".zshenv".text = ''
|
|
|
|
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
|
|
|
'';
|
|
|
|
};
|
2020-08-06 15:35:49 +00:00
|
|
|
};
|
|
|
|
}
|