fix(modules/default.nix): Migrate from initExtra and initExtraFirst to initContent

This commit is contained in:
Jiří Štefka 2025-06-19 17:23:37 +02:00
parent cc2e260254
commit 8c163b6814
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -83,82 +83,84 @@ in {
];
};
initExtraFirst = ''
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
initContent = let
initExtraFirst = lib.mkBefore ''
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
fi
'';
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
fi
'';
initExtra = ''
# From antidote (for p10k):
# prompts:
# with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k
initExtra = ''
# From antidote (for p10k):
# prompts:
# with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k
# Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//')
fi
# Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//')
fi
if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable
fi
if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable
fi
bindkey '^ ' autosuggest-accept # Bind CTRL + Space
bindkey '^Y' autosuggest-accept # Bind CTRL + Y
bindkey '^ ' autosuggest-accept # Bind CTRL + Space
bindkey '^Y' autosuggest-accept # Bind CTRL + Y
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Extracting
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xJf $1 ;;
*.bz2) bunzip3 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Extracting
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xJf $1 ;;
*.bz2) bunzip3 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Kitty binds
if [ "$TERM" = "xterm-kitty" ]; then
alias kssh="kitty +kitten ssh"
alias icat="kitty +kitten icat"
alias d="kitty +kitten diff"
alias get="kitty +kitten transfer"
alias put="kitty +kitten transfer --direction=upload"
alias kclip="kitty +kitten clipboard"
fi
# Kitty binds
if [ "$TERM" = "xterm-kitty" ]; then
alias kssh="kitty +kitten ssh"
alias icat="kitty +kitten icat"
alias d="kitty +kitten diff"
alias get="kitty +kitten transfer"
alias put="kitty +kitten transfer --direction=upload"
alias kclip="kitty +kitten clipboard"
fi
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof
fi
'';
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof
fi
'';
in lib.mkMerge [ initExtraFirst initExtra ];
localVariables = {
YSU_MESSAGE_POSITION = "after";