From 786431f769e5c66b1f2cac7ca5ac3c4dcf7d4794 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Thu, 26 May 2022 08:52:54 -0400 Subject: [PATCH] Reanranging + Some useful shortcut Still TODO: make sure each file is loaded only when it's supporting prereqs exist --- _home/dot_sz.shrc.d/{byobu => 00_byobu} | 0 _home/dot_sz.shrc.d/{bin.path => 10_bin.path} | 0 _home/dot_sz.shrc.d/{aliases => 21_aliases} | 0 _home/dot_sz.shrc.d/21_gcp.shortcuts | 21 +++++++++++++++++++ .../{chezmoi.changes => 99_chezmoi.changes} | 0 _home/dot_sz.shrc.d/99_keyboard_mappings | 3 +++ .../bash.post/{oh-my-posh => 10_oh-my-posh} | 0 .../bash.post/11_persistent.history | 7 +++++++ .../dot_sz.shrc.d/bash.post/99_pip.completion | 2 ++ 9 files changed, 33 insertions(+) rename _home/dot_sz.shrc.d/{byobu => 00_byobu} (100%) rename _home/dot_sz.shrc.d/{bin.path => 10_bin.path} (100%) rename _home/dot_sz.shrc.d/{aliases => 21_aliases} (100%) create mode 100644 _home/dot_sz.shrc.d/21_gcp.shortcuts rename _home/dot_sz.shrc.d/{chezmoi.changes => 99_chezmoi.changes} (100%) create mode 100644 _home/dot_sz.shrc.d/99_keyboard_mappings rename _home/dot_sz.shrc.d/bash.post/{oh-my-posh => 10_oh-my-posh} (100%) create mode 100644 _home/dot_sz.shrc.d/bash.post/11_persistent.history create mode 100644 _home/dot_sz.shrc.d/bash.post/99_pip.completion diff --git a/_home/dot_sz.shrc.d/byobu b/_home/dot_sz.shrc.d/00_byobu similarity index 100% rename from _home/dot_sz.shrc.d/byobu rename to _home/dot_sz.shrc.d/00_byobu diff --git a/_home/dot_sz.shrc.d/bin.path b/_home/dot_sz.shrc.d/10_bin.path similarity index 100% rename from _home/dot_sz.shrc.d/bin.path rename to _home/dot_sz.shrc.d/10_bin.path diff --git a/_home/dot_sz.shrc.d/aliases b/_home/dot_sz.shrc.d/21_aliases similarity index 100% rename from _home/dot_sz.shrc.d/aliases rename to _home/dot_sz.shrc.d/21_aliases diff --git a/_home/dot_sz.shrc.d/21_gcp.shortcuts b/_home/dot_sz.shrc.d/21_gcp.shortcuts new file mode 100644 index 0000000..b3598f9 --- /dev/null +++ b/_home/dot_sz.shrc.d/21_gcp.shortcuts @@ -0,0 +1,21 @@ +function gcp_project() { + gcloud config get-value core/project 2> /dev/null +} + +function gcp_get_project_id() { + gcloud projects list \ + --filter="$1" \ + --format="value(project_id)" \ + 2> /dev/null +} + +function gcp_get_project_number() { + gcloud projects list \ + --filter="project_id:$1" \ + --format='value(project_number)' \ + 2> /dev/null +} + +function gcp_region() { + gcloud config get-value compute/region 2> /dev/null +} diff --git a/_home/dot_sz.shrc.d/chezmoi.changes b/_home/dot_sz.shrc.d/99_chezmoi.changes similarity index 100% rename from _home/dot_sz.shrc.d/chezmoi.changes rename to _home/dot_sz.shrc.d/99_chezmoi.changes diff --git a/_home/dot_sz.shrc.d/99_keyboard_mappings b/_home/dot_sz.shrc.d/99_keyboard_mappings new file mode 100644 index 0000000..4790b4e --- /dev/null +++ b/_home/dot_sz.shrc.d/99_keyboard_mappings @@ -0,0 +1,3 @@ +setxkbmap -option +setxkbmap -option caps:escape +setxkbmap -option caps:ctrl_modifier diff --git a/_home/dot_sz.shrc.d/bash.post/oh-my-posh b/_home/dot_sz.shrc.d/bash.post/10_oh-my-posh similarity index 100% rename from _home/dot_sz.shrc.d/bash.post/oh-my-posh rename to _home/dot_sz.shrc.d/bash.post/10_oh-my-posh diff --git a/_home/dot_sz.shrc.d/bash.post/11_persistent.history b/_home/dot_sz.shrc.d/bash.post/11_persistent.history new file mode 100644 index 0000000..0a5fcde --- /dev/null +++ b/_home/dot_sz.shrc.d/bash.post/11_persistent.history @@ -0,0 +1,7 @@ +export HISTCONTROL=ignoreboth:erasedups # no duplicate entries +export HISTSIZE=100000 # big big history +export HISTFILESIZE=100000 # big big history +shopt -s histappend # append to history, don't overwrite it + +# Save and reload the history after each command finishes +export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" diff --git a/_home/dot_sz.shrc.d/bash.post/99_pip.completion b/_home/dot_sz.shrc.d/bash.post/99_pip.completion new file mode 100644 index 0000000..b34f2ef --- /dev/null +++ b/_home/dot_sz.shrc.d/bash.post/99_pip.completion @@ -0,0 +1,2 @@ +source <(pip completion --bash) +