nix-config/home/zsh/default.nix

49 lines
1.3 KiB
Nix

{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
programs.starship = {
settings = {
gcloud = { disabled = true; };
python = { disabled = true; };
};
};
programs.zsh = {
enable = true;
initExtra = ''
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
# setopt PROMPT_CR
# setopt PROMPT_SP
# export PROMPT_EOL_MARK=""
unsetopt PROMPT_SP
precmd() {
precmd() {
echo
}
}
VENV_DIR="${config.home.homeDirectory}/virtualenvs"
export WORKON_HOME="''${VENV_DIR}"
function activate-venv() {
local selected_env
selected_env=$(
${pkgs.findutils}/bin/find \
"''${VENV_DIR}" \
-maxdepth 1 \
-mindepth 1 \
-type d \
-exec basename {} \; | \
${pkgs.fzf}/bin/fzf
)
[ -n "$selected_env" ] && \
source "''${VENV_DIR}/''${selected_env}/bin/activate"
}
'';
};
}