~idmyn/dotfiles

a50571459907848d13b87437039f4a8e1036304e — David Mynors a month ago f607441
Added elvish func for k8s prompt
4 files changed, 26 insertions(+), 1 deletions(-)

M install.conf.yaml
M kitty/kitty.conf
A shell/elvish/lib/k8s.elv
M shell/elvish/rc.elv
M install.conf.yaml => install.conf.yaml +1 -0
@@ 23,6 23,7 @@
    ~/.elvish/lib/nix.elv: shell/elvish/lib/nix.elv
    ~/.elvish/lib/direnv.elv: shell/elvish/lib/direnv.elv
    ~/.elvish/lib/secrets.elv: shell/elvish/lib/secrets.elv
    ~/.elvish/lib/k8s.elv: shell/elvish/lib/k8s.elv
    ~/.zshrc: shell/.zshrc
    ~/.zshenv: shell/.zshenv
    ~/.config/kitty/kitty.conf: kitty/kitty.conf

M kitty/kitty.conf => kitty/kitty.conf +1 -1
@@ 1,6 1,6 @@
# inspo: https://github.com/callum-oakley/macos-dots/blob/master/.config/kitty/kitty.conf

shell                           /usr/local/bin/tmux
shell                           /usr/local/bin/elvish
macos_option_as_alt             yes

# text

A shell/elvish/lib/k8s.elv => shell/elvish/lib/k8s.elv +16 -0
@@ 0,0 1,16 @@
SHOW_PROMPT = $false

fn toggle-prompt {
  if $SHOW_PROMPT {
    SHOW_PROMPT = $false
    edit:rprompt = { put "" }
  } else {
    SHOW_PROMPT = $true
    CONTEXT = ?(kubectl config current-context 2>/dev/null)
    if $CONTEXT {
      echo $CONTEXT
    } else {
      edit:rprompt = { put "no k8s context" }
    }
  }
}
\ No newline at end of file

M shell/elvish/rc.elv => shell/elvish/rc.elv +8 -0
@@ 7,6 7,8 @@ epm:install &silent-if-installed=$true ^

use github.com/zzamboni/elvish-modules/terminal-title

E:EMACS="/Applications/Emacs.app/Contents/MacOS/Emacs"

E:EDITOR="emacsclient -q -c -a ''"

E:ANDROID_HOME=$E:HOME"/Library/Android/sdk"


@@ 36,6 38,9 @@ edit:insert:binding[Alt+Backspace]=$edit:kill-small-word-left~

# aliases

fn emacs [@a]{ /Applications/Emacs.app/Contents/MacOS/Emacs }
fn emacsclient [@a]{ /Applications/Emacs.app/Contents/MacOS/bin/emacsclient }

fn e [@a]{
  if (> (ps -ax | rg -c emacs) 1) {
    if (> (emacsclient -e '(length (frame-list))') 1) {


@@ 69,6 74,9 @@ fn jjetq [@a]{ jet --from json --keywordize --to edn --pretty --query $@a }
use nix
use direnv
use secrets
use k8s

fn kprompt { k8s:toggle-prompt }

fn crm-vpn { secrets:crm-vpn }
fn dev { secrets:dev }