Last active
January 15, 2026 02:42
-
-
Save AbeEstrada/1d6b859bcbdc81f8f94ff44258a0cdae to your computer and use it in GitHub Desktop.
Toggle booleans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| if [[ $# -gt 0 ]]; then | |
| input="$1" | |
| else | |
| read -r input _ <<< "$(cat)" | |
| fi | |
| if [[ -z "$input" ]]; then | |
| exit 0 | |
| fi | |
| case "$input" in | |
| "true") echo "false" ;; | |
| "True") echo "False" ;; | |
| "TRUE") echo "FALSE" ;; | |
| "false") echo "true" ;; | |
| "False") echo "True" ;; | |
| "FALSE") echo "TRUE" ;; | |
| "1") echo "0" ;; | |
| "0") echo "1" ;; | |
| "yes") echo "no" ;; | |
| "Yes") echo "No" ;; | |
| "YES") echo "NO" ;; | |
| "no") echo "yes" ;; | |
| "No") echo "Yes" ;; | |
| "NO") echo "YES" ;; | |
| "and") echo "or" ;; | |
| "And") echo "Or" ;; | |
| "AND") echo "OR" ;; | |
| "or") echo "and" ;; | |
| "Or") echo "And" ;; | |
| "OR") echo "AND" ;; | |
| "on") echo "off" ;; | |
| "On") echo "Off" ;; | |
| "ON") echo "OFF" ;; | |
| "off") echo "on" ;; | |
| "Off") echo "On" ;; | |
| "OFF") echo "ON" ;; | |
| *) echo "$input" ;; | |
| esac |
Author
Author
Neovim
vim.keymap.set("n", "<leader>t", function()
local word = vim.fn.expand("<cword>")
local output = vim.fn.system("echo -n " .. word .. " | tog.sh")
output = output:gsub("%s+$", "")
vim.api.nvim_command('normal! "_ciw' .. output)
end, { desc = "Toggle word under cursor using 'tog.sh' shell command" })
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Helix Editor