dotfiles/.config/helix/scripts/paste.py

14 lines
362 B
Python
Executable file

#!/usr/bin/env python
import subprocess
import sys
# tiny script to force inline vs. linewise paste in Helix
cmd = sys.argv[1]
contents = subprocess.check_output(["wl-paste", "-n"], text=True)
if cmd == "inline":
print(contents.rstrip("\n"), end="")
elif cmd == "linewise":
if contents[-1] != "\n":
contents += "\n"
print(contents, end="")