From f7e802d3f3bc22806a3b837da9ca85cffa26b2ca Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 3 Jun 2025 14:59:53 -0700 Subject: [PATCH 1/4] [zsh] bool() function Converts its first argument to a bool return value (0 or 1) and echos "yes" or "no". --- zsh/func/bool | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 zsh/func/bool diff --git a/zsh/func/bool b/zsh/func/bool new file mode 100644 index 0000000..c5bf961 --- /dev/null +++ b/zsh/func/bool @@ -0,0 +1,31 @@ +# Eryn Wells +# vim: set ft=zsh: + +function bool { + if [[ $1 -eq 0 ]]; then + echo "no" + return false + fi + + local lowercase_value=${(L)1} + + if [[ "$lowercase_value" == "yes" ]]; then + echo "yes" + return true + fi + + if [[ "$lowercase_value" == "no" ]]; then + echo "no" + return false + fi + + if [[ "$lowercase_value" =~ '^[0-9]+$' ]]; then + echo "yes" + return true + fi + + echo "no" + return false +} + +bool "$@" From bb82a7ca75bd59af633b8dc9503d360c6b01aa0a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 1 Aug 2025 10:33:03 -0700 Subject: [PATCH 2/4] [nvim] Update format of rust-analyzer LSP config I think the format of the config table for rust-analyzer changed. checkOnSave takes a bool, and a separate check table provides the parameters. --- config/nvim/lua/lsp.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 87f964f..0bed968 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -115,7 +115,8 @@ lspconfig.rust_analyzer.setup { enable = true, }, }, - checkOnSave = { + checkOnSave = true, + check = { command = 'clippy', extraArgs = { "--", From 6dc9120dd0fd965b970424fab9e57e57ffbb7798 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 1 Aug 2025 10:37:26 -0700 Subject: [PATCH 3/4] [zsh] Update the Usage message of update-path to note the default is exporting the modified variable --- zsh/func/update-path | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zsh/func/update-path b/zsh/func/update-path index 4172df4..624258a 100644 --- a/zsh/func/update-path +++ b/zsh/func/update-path @@ -20,7 +20,8 @@ Arguments --------- %B-e%b | %B--export%b | %B--no-export%b - Export the variable after modification. + Export the variable after modification. The default is to export if the + variable is modified. %B-f%b | %B--force%b Unconditionally add the path, even if it doesn't exist. From fa0e59ea3911a7660c39ac07f994eee23dc4d450 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 1 Aug 2025 10:38:48 -0700 Subject: [PATCH 4/4] [zsh] Autoload the bool function --- zsh/func/bool | 26 +++++++++++++------------- zshrc | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zsh/func/bool b/zsh/func/bool index c5bf961..1fe2567 100644 --- a/zsh/func/bool +++ b/zsh/func/bool @@ -2,30 +2,30 @@ # vim: set ft=zsh: function bool { - if [[ $1 -eq 0 ]]; then - echo "no" - return false + if [[ "$1" =~ '^-?[0-9]+$' ]]; then + if (( $1 == 0 )); then + echo "no" + return 1 + else + echo "yes" + return 0 + fi fi local lowercase_value=${(L)1} - if [[ "$lowercase_value" == "yes" ]]; then + if [[ "$lowercase_value" == "yes" || "$lowercase_value" == "true" ]]; then echo "yes" - return true + return 0 fi - if [[ "$lowercase_value" == "no" ]]; then + if [[ "$lowercase_value" == "no" || "$lowercase_value" == "false" ]]; then echo "no" - return false - fi - - if [[ "$lowercase_value" =~ '^[0-9]+$' ]]; then - echo "yes" - return true + return 1 fi echo "no" - return false + return 1 } bool "$@" diff --git a/zshrc b/zshrc index 8f70595..da1297d 100644 --- a/zshrc +++ b/zshrc @@ -21,6 +21,7 @@ fi do_init_functions zsh_init_rc_functions +autoload -Uz bool autoload -Uz g autoload -Uz nethack autoload -Uz pw