Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: ignore $ from the beginning of the copied text #1

Open
mihalycsaba opened this issue Jan 8, 2023 · 3 comments
Open

Comments

@mihalycsaba
Copy link

This would be nice as an option, everyone can decide if they want to enable it. I copy a lot of terminal commands and they have $ as the first character, I don't need that character, I have to select the text to not copy that character into the terminal.

@icelam
Copy link
Owner

icelam commented Jan 9, 2023

I think your idea is great and would be very beneficial for other users if it is implement in a more generic way like allowing users to input a list of regex for pattern matching on what they want to replace.

I will definitely look into it in my free time and try to work on it. However, I haven't been touch the code in this repository for 3 years, so I guess I will need to spend some time to keep the dependencies up-to-date in order to meet the latest Chrome Web Store requirement. I will expect to have the next release ready within several months, but I cannot make any definitive promises as it will also depends on the approval process of Chrome Web Store.

P.S. Thank you so much on your generous support, this means so much to me!

@mihalycsaba
Copy link
Author

I think your idea is great and would be very beneficial for other users if it is implement in a more generic way like allowing users to input a list of regex for pattern matching on what they want to replace.

I will definitely look into it in my free time and try to work on it. However, I haven't been touch the code in this repository for 3 years, so I guess I will need to spend some time to keep the dependencies up-to-date in order to meet the latest Chrome Web Store requirement. I will expect to have the next release ready within several months, but I cannot make any definitive promises as it will also depends on the approval process of Chrome Web Store.

P.S. Thank you so much on your generous support, this means so much to me!

Regex is a great idea, but there should be a few predefined options for the lazy people, if it's not a big deal. No rush, just had the idea yesterday when copying a command. Been using your extension for more than a year it works really well saves me a few seconds with every copy.

Don't mention the donation, it's my new year resolution to sponsor open source projects I regularly use, it's only a dollar per month.

@willbchang
Copy link

willbchang commented Mar 22, 2023

I believe this regex /^\s*\$\s+/ can ignore $ from the beginning of the copied text.

Tests:

  • Should ignore
    • $ echo right click
    • $ echo Oh fantastic!
  • Should not ignore
    • $test Oh fantastic! (assume test=echo in this context)

However, this should be cautious when using this method for large piece of code, because it will replace the sole $ at the beginning of every line and we cannot be sure that is bash code. To make it safer, it may be better to set the default range for replacing to 1-3 lines, as in my experience, bash code snippets that prefix $ are usually only a few lines long. It would be helpful to provide an option for user to adjust the line limit based on their own needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants