Blazing fast text formatting
About a year ago I wrote a post on formatting strings.
The basic idea is to improve the text formatting workflow. This workflow usually looks like:
- Copy text, this could be json, sql…
- Open formatting tool, IDE, web browser…
- Paste text
- Click button
- Copy output
Doing this over time is very time consuming. Also, the formatting tool might be sluggish.
A simplified workflow would be:
- Copy text
- Click button. This triggers some bash commands which take text from clipboard, format it, and place it back on top of clipboard list. Job done!
Benefits: less steps, less tools, offline tool.
New clipboard manager
At some point in the last year I updated my machine and replaced GNOME with KDE. I took the occasion to update the clipboard manager to CopyQ. Somehow I prefer the cli of this clipboard and also has a nice gui.
Updating scripts
Formatting json
copyq copy "$(copyq clipboard | jq .)"
Formatting sql
copyq copy "$(copyq clipboard | sqlfmt - --single-process -q)"
Sorting string
This is a new addition
copyq copy "$(sort <(copyq clipboard))"