From 6cb67335ee1b2e40cd7d118cc3dd117b68bbbdd1 Mon Sep 17 00:00:00 2001 From: Tom Almeida Date: Mon, 23 Nov 2020 14:40:51 +0800 Subject: [PATCH] ion: Remove initrc from source control I've pretty much entirely transisioned to using zsh, so there's no need for the ion initrc to stick around. --- .config/ion/initrc | 152 --------------------------------------------- .gitignore | 3 - 2 files changed, 155 deletions(-) delete mode 100644 .config/ion/initrc diff --git a/.config/ion/initrc b/.config/ion/initrc deleted file mode 100644 index 8dd607a..0000000 --- a/.config/ion/initrc +++ /dev/null @@ -1,152 +0,0 @@ -if not test -d $HOME/.config/ion/plugins - # We don't have plugins, so clone them in first. - git clone https://gitlab.redox-os.org/redox-os/ion-plugins $HOME/.config/ion/plugins -end - -source ~/.config/ion/plugins/init.ion -source ~/.config/ion/plugins/tools/gpg-agent.ion - -export SKIM_DEFAULT_OPTIONS="--multi --ansi --bind=ctrl-e:up --preview='bat --plain --color=always {}'" - -if not exists -s SSH_CLIENT - # Only launch TMUX if we're not in an SSH session - if not exists -s VIMRUNTIME - # We're not in a VIM session - if not exists -s TMUX - # We're not already in a TMUX session - let tmux = $(/usr/bin/env which tmux) - let sessions: int = $len(@lines($($tmux list-sessions))) - if test $sessions -gt 0 - exec $tmux attach - else - exec $tmux new-session - end - end - end -end - -fn PROMPT - fn ssh_prompt - if exists -s SSH_CLIENT - # We're in an SSH session. - printf "${c::red}\@${c::black}${HOST}" - end - end - fn kube_prompt - if exists -b kubectl - # We have kubectl. - let context = $(kubectl config current-context) - if not eq $len(context) 0 - # Icons: - # \u2388: ⎈ - # \u2638: ☸ - printf "${c::default,bold}{${c::light_red}☸${c::default}:${c::blue}${context}${c::default}}${c::reset} " - end - end - end - fn git_prompt - if exists -s GIT_PROMPT && test $GIT_PROMPT -eq 1 && git rev-parse --is-inside-work-tree -q &> /dev/null - let num_added: int = 0; - let num_removed: int = 0; - for line in @lines($(git diff-files --numstat -r)) - let new_added = $(echo $line | cut -f1) - let new_removed = $(echo $line | cut -f2) - let num_added = $((num_added+new_added)) - let num_removed = $((num_removed+new_removed)) - end - let totals = ""; - if test $num_added -gt 0 || test $num_removed -gt 0 - let totals = ":" - if test $num_added -gt 0 - let totals = "$totals${c::0x55}+$num_added" - end - if test $num_removed -gt 0 - let totals = "$totals${c::light_red}-$num_removed" - end - end - printf "[${c::red,bold}$(git symbolic-ref --short -q HEAD || git rev-parse --short HEAD)${c::default}$totals${c::default}] " - end - end - fn venv - if exists -s VIRTUAL_ENV - let env = $(echo $VIRTUAL_ENV | awk -F'/' '{printf $NF}') - printf "${c::bold}(${c::yellow}$env${c::default,bold})${c::default} " - end - end - printf "$(kube_prompt)${c::0x55,bold}${USER}$(ssh_prompt)${c::default}:${c::0x4B}${SWD}${c::default}# $(venv)$(git_prompt)${c::reset}" - drop kube_prompt - drop ssh_prompt -end - -fn kctx context:str -- Set the kubernetes context - kubectl config use-context $context -end - -fn show what:str -- Show the existing setting for a variable - match @split(what)[0] - case "kctx" - kubectl config get-contexts - case _ - echo "[${color::red}@split(what)[0]${color::reset}] does not seem to exist" - echo "options:${color::blue}" - echo -e "\tkctx" - printf "${color::reset}" - end -end - -fn no what:str -- Remove an existing setting for a variable - match @split(what)[0] - case "kctx" - kubectl config unset current-context - case _ - echo "[${color::red}@split(what)[0]${color::reset}] does not seem to exist" - echo "options:${color::blue}" - echo -e "\tkctx" - printf "${color::reset}" - end -end - -fn mux session:str -- Move or create a tmux session - let tmux = $(/usr/bin/env which tmux) - let fd = $(/usr/bin/env which fd || /usr/bin/env which fdfind) - let dir = $($fd --no-ignore -i -td "$session" ~/Documents | awk -F'/' 'NR==1{n=NF; m=$0} NF