summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <ivi@vinkies.net>2025-02-14 16:10:23 +0000
committerMike Vink <ivi@vinkies.net>2025-02-14 16:10:23 +0000
commit0d77dea3a214a70bdec9e05f53b3b97a67ff77a2 (patch)
treedc87bbe037207b0d5952be17ca746db1156344a5
parent5db3d02ce3b9b569c49478eee9ec81a23d692dde (diff)
add some scripts
-rw-r--r--.config/aerospace/aerospace.toml2
-rw-r--r--.config/ghostty/config1
-rw-r--r--.config/ksh/ksh.kshrc2
-rw-r--r--.config/shell/profile5
-rwxr-xr-x.local/bin/c3
-rwxr-xr-x.local/bin/gb3
-rwxr-xr-x.local/bin/gcpp10
-rwxr-xr-x.local/bin/prompt-git4
-rwxr-xr-x.local/bin/prompt-tf1
-rwxr-xr-x.local/bin/tw1
10 files changed, 28 insertions, 4 deletions
diff --git a/.config/aerospace/aerospace.toml b/.config/aerospace/aerospace.toml
index c5ac71c..216faeb 100644
--- a/.config/aerospace/aerospace.toml
+++ b/.config/aerospace/aerospace.toml
@@ -91,7 +91,7 @@ automatically-unhide-macos-hidden-apps = false
# (like in i3)
cmd-shift-d = 'exec-and-forget source /etc/profile; PATH="$HOME/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" passmenu'
cmd-f = 'fullscreen'
- cmd-d = 'exec-and-forget source /etc/profile; PATH="$HOME/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" dmenu'
+ cmd-d = 'exec-and-forget source /etc/profile; PATH="$HOME/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" /Applications/dmenu-mac.app/Contents/MacOS/dmenu-mac'
cmd-enter = '''exec-and-forget osascript -e '
tell application "System Events"
if exists application process "Ghostty" then
diff --git a/.config/ghostty/config b/.config/ghostty/config
index 2aff8d0..7db87d5 100644
--- a/.config/ghostty/config
+++ b/.config/ghostty/config
@@ -9,6 +9,7 @@ keybind = alt+shift+j=decrease_font_size:1
keybind = ctrl+zero=unbind
keybind = ctrl+enter=unbind
+keybind = super+q=unbind
theme=GruvboxLuke
window-decoration=false
confirm-close-surface=false
diff --git a/.config/ksh/ksh.kshrc b/.config/ksh/ksh.kshrc
index 000ed44..4f8026a 100644
--- a/.config/ksh/ksh.kshrc
+++ b/.config/ksh/ksh.kshrc
@@ -17,7 +17,7 @@ root=\$(pwd | cut -d'/' -f2- --output-delimiter '
)\$(
pwd | cut -d'/' -f2- --output-delimiter '
' | tail -n3 | paste -sd '/'
-)\$(prompt-git)\n jobs(\j) # "
+)\$(prompt-git)\$(prompt-tf)\n jobs(\j) # "
bind -m ^L="^A^K clear^J"
eval "$(zoxide init posix --cmd cd --hook prompt)"
diff --git a/.config/shell/profile b/.config/shell/profile
index 43b0ee2..6532ef8 100644
--- a/.config/shell/profile
+++ b/.config/shell/profile
@@ -2,3 +2,8 @@ export EDITOR=vis
export PATH="$PATH:$HOME/go/bin:/usr/local/go/bin"
export PATH="$HOME/.local/bin:$PATH"
+
+alias g="git "
+alias d="docker "
+alias k="kubectl "
+alias t="terraform "
diff --git a/.local/bin/c b/.local/bin/c
new file mode 100755
index 0000000..4aed5f6
--- /dev/null
+++ b/.local/bin/c
@@ -0,0 +1,3 @@
+#!/bin/sh
+ctx="$(nu --commands "open ${KUBECONFIG:-$HOME/.kube/config} | from yaml | get contexts.name | to text" | vis-menu)"
+[ -z "$ctx" ] || kubectl config use-context "$ctx"
diff --git a/.local/bin/gb b/.local/bin/gb
new file mode 100755
index 0000000..f59fb84
--- /dev/null
+++ b/.local/bin/gb
@@ -0,0 +1,3 @@
+#!/bin/sh
+branch="$(git branch -a | grep -v '*' | xargs -n1 | vis-menu)"
+[ -z "$branch" ] || git checkout "$branch"
diff --git a/.local/bin/gcpp b/.local/bin/gcpp
new file mode 100755
index 0000000..ca26514
--- /dev/null
+++ b/.local/bin/gcpp
@@ -0,0 +1,10 @@
+gcloud projects list --format text </dev/null >/dev/null 2>&1 || {
+ gcloud auth login
+ gcloud auth application-default login
+}
+
+project="$(gcloud projects list --format text </dev/null | grep projectId: | cut -d: -f2 | sed -e 's/^[[:space:]]\+//' -e 's/[[:space:]]\+$//' | vis-menu)"
+[ -z "$project" ] || {
+ gcloud config set project "$project"
+ gcloud auth application-default set-quota-project "$project"
+}
diff --git a/.local/bin/prompt-git b/.local/bin/prompt-git
index edfaf66..54e60f6 100755
--- a/.local/bin/prompt-git
+++ b/.local/bin/prompt-git
@@ -1,4 +1,4 @@
-[ -d .git ] && git status --porcelain=v1 | {
+git rev-parse --show-toplevel >/dev/null 2>&1 && git status --porcelain=v1 | {
while read tag file; do
case $tag in
M) modified=$(( modified + 1));;
@@ -8,5 +8,5 @@
printf '%s' " git($(git branch --show-current)"
[ 0 -lt "${modified:-0}" ] && printf '%s' ":M$modified"
[ 0 -lt "${untracked:-0}" ] && printf '%s' "|?$untracked"
- echo ")"
+ printf '%s' ")"
}
diff --git a/.local/bin/prompt-tf b/.local/bin/prompt-tf
new file mode 100755
index 0000000..71dba16
--- /dev/null
+++ b/.local/bin/prompt-tf
@@ -0,0 +1 @@
+find . -mindepth 1 -maxdepth 1 -iname '*.tf' -o -iname '*.tfplan' -o -iname '.terraform' -o -iname '*.tfstate' | grep . >/dev/null 2>&1 && printf ' tf(%s)' "$(terraform workspace show)"
diff --git a/.local/bin/tw b/.local/bin/tw
new file mode 100755
index 0000000..4959897
--- /dev/null
+++ b/.local/bin/tw
@@ -0,0 +1 @@
+terraform workspace list | grep -v '*' | sed -e 's/^[[:space:]]\+//' -e 's/[[:space:]]\+$//' | vis-menu | xargs -n1 terraform workspace select