boolswitcher-hx
Switch and toggle booleans
Switch and toggle booleans
Github is a mirror! I work on my private git server, feel free to do PRs, but I might respond late.
A vibecoded Helix plugin for switching and toggling booleans, written for the Steel plugin system.
switch-boolean: Toggle boolean values (e.g. true $\leftrightarrow$ false, 1 $\leftrightarrow$ 0, yes $\leftrightarrow$ no, y $\leftrightarrow$ n).set-boolean-positive: Turn boolean values positive (e.g. false $\rightarrow$ true, 0 $\rightarrow$ 1).set-boolean-negative: Turn boolean values negative (e.g. true $\rightarrow$ false, 1 $\rightarrow$ 0).Add to your plugins attribute set in your Nix configuration (e.g. via home-manager or Hjem) as described in helix-plugins-nix:
programs.helix.plugins = {
"boolswitcher.hx" = pkgs.fetchFromGitHub {
owner = "me";
repo = "boolswitcher-hx";
rev = "newset or smth";
hash = "some-hash";
};
};
This copies all .scm files into ~/.local/share/steel/cogs/boolswitcher.hx.
forge is the Steel package manager:
forge pkg install --git https://github.com/<owner>/boolswitcher-hx
I never tested this
Copy the repository into your Steel cogs directory:
mkdir -p ~/.local/share/steel/cogs/boolswitcher.hx
cp -r * ~/.local/share/steel/cogs/boolswitcher.hx/
I never tested this either
Require boolswitcher.hx/boolswitcher.scm in ~/.config/helix/init.scm and bind the commands or create a sub-keymap:
(require "boolswitcher.hx/boolswitcher.scm")
(require (only-in "helix/keymaps.scm" add-global-keybinding))
;; Sub-mode for booleans
(define bool-mode
(hash "s" ":switch-boolean"
"p" ":set-boolean-positive"
"n" ":set-boolean-negative"))
(add-global-keybinding (hash "normal" (hash "ü" bool-mode)
"select" (hash "ü" bool-mode)))
| Command | Alias | Description |
|---|---|---|
:switch-boolean | :toggle-boolean | Toggles boolean (e.g. true $\leftrightarrow$ false) |
:set-boolean-positive | :set-boolean-true | Sets boolean to positive (false $\rightarrow$ true) |
:set-boolean-negative | :set-boolean-false | Sets boolean to negative (true $\rightarrow$ false) |
| Positive | Negative |
|---|---|
true | false |
True | False |
TRUE | FALSE |
yes | no |
Yes | No |
YES | NO |
y | n |
Y | N |
1 | 0 |
Run the test suite with steel:
steel test.scm