As you know in Cursor when you past multi line text into Cursor it makes it a “pill” or what they call it. For me it is annoying if am pasting text or errors - anything not code. You can of course just accept it, or you can make it into a single line text before pasting it.
I am very dependent on Raycast on my mac and the Raycast clipboard history.
Extending the clipboard history with an action that converts it into a single line would be nice, but then you need to fork the whole thing.
Let’s try a different approach. let’s create a shell script since Raycast is designed to work well with shell scripts, using raycast script commands:
- Open the Extensions tab in the Raycast preferences
- Click the plus button
- Click
Add Script Directory
- Select directories containing your Script Commands
- Copy my script to the folder you just selected,
- Save it as
clipboard-to-single-line.sh
- Make it executable:
chmod +x clipboard-to-single-line.sh
- Reload Raycast
- Add hotkey in raycast, for example option+cmd+v
Now copy text as normally cmd+c and past it in cursor with option+cmd+v
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Convert to Single Line
# @raycast.mode silent
# @raycast.packageName Text Tools
#
# Optional parameters:
# @raycast.icon :memo:
# @raycast.shortcut cmd+opt+v
#
# Documentation:
# @raycast.description Converts clipboard text to single line and pastes it automatically
# @raycast.author Your Name
# @raycast.authorURL https://github.com/yourusername
# Get clipboard content and convert to single line
CLIPBOARD=$(pbpaste | tr '\n' ' ' | tr -s ' ')
# Copy back to clipboard
echo -n "$CLIPBOARD" | pbcopy
# Paste using AppleScript
osascript -e 'tell application "System Events" to keystroke "v" using command down'
This script:
- Uses
tr
to replace newlines with spaces - Removes extra spaces with
tr -s
- Uses AppleScript to paste
If this still doesn’t work, let’s try to debug:
- Have you granted Raycast accessibility permissions in System Settings?