From 469ccb00c17c22fbbfa146b966f57b3e86d5bb64 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Sat, 10 May 2025 14:27:08 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-10 14:27:08 --- .config/helix/scripts/paste-util.fish | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 .config/helix/scripts/paste-util.fish diff --git a/.config/helix/scripts/paste-util.fish b/.config/helix/scripts/paste-util.fish new file mode 100755 index 00000000..281466fc --- /dev/null +++ b/.config/helix/scripts/paste-util.fish @@ -0,0 +1,25 @@ +#!/usr/bin/env fish + +# script takes the clipboard contents and +# trims/adds newlines appropriately to force +# inline or above/below line paste + +# In helix, if there's a trailing newline, it's pasted linewise +# Otherwise it's pasted inline + +set -l cmd $argv[1] +# get clip contents, and preserve newlines +set -l contents (wl-paste -n | string collect -N) +count "$contents" +if test "$cmd" = inline + # if there's more than 1 newline, it + # has to be linewise + set -l newlines (string split \n "$contents" | count) + echo $newlines + echo \'"$(string replace \n → "$contents")"\' + +else if test "$cmd" = linewise + +end + +echo paste-util