Command for adding a space to the beginning of each line of the Clipboard #2571
-
Halo
but it adds a space only to the beginning of the first line of my clipboard's text, not to the following lines.
but still not right. I even dont know where to find the RegEx documentation, which one CopyQ uses etc. (EDIT: ECMA Script, as I think now). Later I would like to add a command to delete the first char. at the beginning of each line, but only if I first get that space adding right... Thanks for hints. EDIT: but this works on the Try it from MDN Webdocs
I thought that the language of commands is ECMA Script like JS? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
OK then, I found it myself by looking into other command scripts, especially the Find & Replace did my trick :)
And the "Delete first char of line"
Both are just directly changing the selected (or newest) clipboard list entry. So no backup of the original clip, which is not neccessary for me anyway. EDIT 2023-12-19: here the code to remove commented code lines (only // and #). Sometimes I have e.g. config files with huge ammounts of comments (by dist or so) and only very few real config lines. To get just these "real" code lines, I can clean them with that command:
|
Beta Was this translation helpful? Give feedback.
-
There is something weird, not working as expected in this command: it adds one space to the very first line, but two spaces to each of the following lines. I dont understand that. |
Beta Was this translation helpful? Give feedback.
-
Is anybody here in this "Discussions" who could tell me in this very simple script what I am doing wrong? Why is the I tried hours now to "debug" it, but as even the console.log does not work, I dont find it 😢 This is working in MDN's Try it::
but not in the ECMA version of CopyQ 😢 |
Beta Was this translation helpful? Give feedback.
-
By the anchor of Sabords! It works! |
Beta Was this translation helpful? Give feedback.
-
But moment, this regexp: I can make it visible, if I change my regexp like this:
after the command that result:
|
Beta Was this translation helpful? Give feedback.
Yeah, there are spaces also on empty lines after the replacements.
Maybe it is best to avoid regular expressions in this case and use something like: