home-manager/shell/zsh.nix

45 lines
1 KiB
Nix

{
pkgs,
theme,
...
}: let
zsh_autosuggest_highlight_style =
if theme == "light"
then "fg=180"
else "fg=10";
in {
programs.zsh = {
enable = true;
enableCompletion = true;
history.size = 10000;
autosuggestion = {
enable = true;
highlight = zsh_autosuggest_highlight_style;
};
initContent = ''
# Auto-start tmux if conditions are met
if [[ -z "$TMUX" && -z "$SSH_TTY" && $- == *i* ]]; then
# Check if tmux is available and terminal supports it
if command -v tmux >/dev/null 2>&1; then
# Try to attach to existing session, or create new one
exec tmux new-session -A -s default
fi
fi
function set_win_title(){
local TITLE=$(git config --get remote.origin.url || echo "$PWD")
echo -ne "\033]0; $(basename "$TITLE") \007"
}
precmd_functions+=(set_win_title)
function zvm_config() {
ZVM_INIT_MODE=sourcing
}
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
'';
};
}