From b11c6a8fa842a78f17dee978ae09dc560d083b77 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Tue, 29 Jul 2025 17:25:32 +0200 Subject: switch to zsh for noglob --- .config/zsh/profile | 1 + .config/zsh/rc | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ .zprofile | 2 +- .zshrc | 1 + 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .config/zsh/profile create mode 100644 .config/zsh/rc mode change 100644 => 120000 .zprofile create mode 120000 .zshrc diff --git a/.config/zsh/profile b/.config/zsh/profile new file mode 100644 index 0000000..c7b8b63 --- /dev/null +++ b/.config/zsh/profile @@ -0,0 +1 @@ +. "${HOME}/.profile" diff --git a/.config/zsh/rc b/.config/zsh/rc new file mode 100644 index 0000000..8aa8744 --- /dev/null +++ b/.config/zsh/rc @@ -0,0 +1,74 @@ +autoload -Uz compinit && compinit +autoload bashcompinit && bashcompinit +if type brew &>/dev/null; then + brewprefix=$(brew --prefix) + FPATH=$brewprefix/share/zsh-completions:$brewprefix/share/zsh/site-functions:$FPATH +fi + +zmodload zsh/complist +zstyle ':completion:*' menu select +function insert-and-complete-again() { + zle expand-or-complete-prefix + zle list-choices +} +zle -N insert-and-complete-again +bindkey '^I' insert-and-complete-again + +_comp_options+=(globdots) # Include hidden files. +# Use vim keys in tab complete menu: +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history + +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/local.rc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/local.rc" + +autoload -U select-word-style && select-word-style bash + +# Enable prompt substitutions and colors +autoload -U colors && colors +setopt PROMPT_SUBST + +# History settings +HISTSIZE=100000 +HISTFILE=~/.zsh_history +SAVEHIST=100000 +setopt HIST_IGNORE_SPACE +setopt HIST_IGNORE_ALL_DUPS +setopt APPEND_HISTORY + +# Titlebar update before each prompt +precmd() { + print -Pn '\e]0;%~' + [[ -n "$IN_KAKOUNE_CONNECT" ]] && print -Pn " - $KAKOUNE_CLIENT@[$KAKOUNE_SESSION]" + [[ -n "$TERM" ]] && print -Pn " - $TERM" + print -Pn '\a' +} + +# Kakoune session info +kak_session='${IN_KAKOUNE_CONNECT:+¶$KAKOUNE_SESSION}' + +# Terraform info evaluated at prompt time +terraform_info='$(fd --exact-depth=1 --extension=tf --quiet && terraform workspace show 2>/dev/null | sed "s/.*/🥡 &/")' + +# Git branch evaluated at prompt time +git_branch='$(git branch --show-current 2>/dev/null | sed "s/.*/ &/" 2>/dev/null)' + +# Final prompt +PROMPT='%{$fg[green]%}%n@%m %{$fg[blue]%}'"$kak_session"' %{$fg[yellow]%}%(5~|%-2~/…/%3~|%4~)%f %F{5}'$terraform_info'%f %F{9}$(echo '"$git_branch"')%f +%{$fg[cyan]%}λ%f ' + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/opt/homebrew/share/google-cloud-sdk/path.zsh.inc' ]; then . '/opt/homebrew/share/google-cloud-sdk/path.zsh.inc'; fi + +# The next line enables shell command completion for gcloud. +if [ -f '/opt/homebrew/share/google-cloud-sdk/completion.zsh.inc' ]; then . '/opt/homebrew/share/google-cloud-sdk/completion.zsh.inc'; fi + +km() { +echo "map global ${1:?} ${2:?} %{:make-once $(history -1 | sed 's/[[:space:]]*[0-9]*[[:space:]]*\(.*\)/\1/')}" | kak -p $KAKOUNE_SESSION +} +alias kmp='km pistarchio ' diff --git a/.zprofile b/.zprofile deleted file mode 100644 index c7b8b63..0000000 --- a/.zprofile +++ /dev/null @@ -1 +0,0 @@ -. "${HOME}/.profile" diff --git a/.zprofile b/.zprofile new file mode 120000 index 0000000..5db19f9 --- /dev/null +++ b/.zprofile @@ -0,0 +1 @@ +.config/zsh/profile \ No newline at end of file diff --git a/.zshrc b/.zshrc new file mode 120000 index 0000000..bd94640 --- /dev/null +++ b/.zshrc @@ -0,0 +1 @@ +.config/zsh/rc \ No newline at end of file -- cgit v1.2.3