' shortcuts, including flip-bool

This commit is contained in:
Schrottkatze 2025-03-10 14:22:10 +01:00
parent 4b9a8323e9
commit 870e5ec059
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo
5 changed files with 50 additions and 13 deletions

6
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@ -400,6 +400,10 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flip-bool"
version = "0.1.0"
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"

View file

@ -1,5 +1,5 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = [ "programs/bar-pinger", "programs/bar-ws-monitor", members = [ "programs/bar-pinger", "programs/bar-ws-monitor", "programs/flip-bool",
"programs/jrnl" "programs/jrnl"
, "programs/traveldings"] , "programs/traveldings"]

View file

@ -1,8 +1,4 @@
{ {config, ...}: {
config,
helix-inline-diags,
...
}: {
home-manager.users.jade = { home-manager.users.jade = {
pkgs, pkgs,
pkgs-stable, pkgs-stable,
@ -23,7 +19,6 @@
programs.helix = { programs.helix = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
package = helix-inline-diags.outputs.packages."x86_64-linux".default;
settings = { settings = {
theme = "gruvbox_dark_hard"; theme = "gruvbox_dark_hard";
editor = { editor = {
@ -31,11 +26,10 @@
bufferline = "multiple"; bufferline = "multiple";
color-modes = true; color-modes = true;
cursorline = true; cursorline = true;
# auto-save = { auto-save = {
# focus-lost = true; after-delay.enable = true;
# after-delay.enable = true; after-delay.timeout = 10000;
# after-delay.timeout = 10000; };
# };
auto-format = true; auto-format = true;
end-of-line-diagnostics = "hint"; end-of-line-diagnostics = "hint";
# slightly optimized based on my layout # slightly optimized based on my layout
@ -99,6 +93,14 @@
# smart tab++ # smart tab++
tab = "move_parent_node_end"; tab = "move_parent_node_end";
S-tab = "move_parent_node_start"; S-tab = "move_parent_node_start";
"'" = {
D = "@<C-w>sgd";
F = "@<C-w>sgy";
d = "@<C-w>vgd";
f = "@<C-w>vgy";
h = ":toggle-option lsp.display-inlay-hints";
t = "@|flip-bool<ret>";
};
}; };
insert = { insert = {
up = "no_op"; up = "no_op";

View file

@ -0,0 +1,6 @@
[package]
name = "flip-bool"
version = "0.1.0"
edition = "2021"
[dependencies]

View file

@ -0,0 +1,25 @@
use std::io::{Read, Write};
fn main() {
let mut input = String::new();
let mut stdin = std::io::stdin();
let mut stdout = std::io::stdout();
stdin.read_to_string(&mut input).unwrap();
stdout
.write_all(match input.as_bytes() {
b"true" => b"false",
b"True" => b"False",
b"TRUE" => b"FALSE",
b"false" => b"true",
b"False" => b"True",
b"FALSE" => b"TRUE",
b"1" => b"0",
b"yes" => b"no",
b"0" => b"1",
b"no" => b"yes",
other => other,
})
.unwrap();
}