Has anyone figured out a way to use Atom.io's awesome search feature to find and delete lines? For example, I want to remove all lines that match ^\s*color: #3f3f3f;$
from my css.
I don't want to leave empty lines.
To search within your current file you can press Ctrl+F , type in a search string and press Enter (or F3 or the "Find Next" button) multiple times to cycle through all the matches in that file. Alt+Enter will find all occurences of the search string.
When in a file that needs reverting, press ctrl-cmd-r to revert the file.
Delete Whitelines is an Atom package for removing empty lines. Just Select the text, use command palette (cmd + shift + P) > delete-whitelines:toggle or alt+shift+D (for MAC & windows) to remove empty lines within the selected text area.
Because $
doesn't match newline or carriage return I needed to be more explicit. The pattern \n?\r?
seemed to do the trick for me.
My final regex is:
^\s*color: #3f3f3f;\n?\r?
It might need to be modified depending on your line endings. I think ^\s*color: #3f3f3f;\n?\r?\n?
should be pretty universal.
You can simply replace that match with an empty string - ie, leave the Replace in current buffer
field empty, and do a Replace
.
You have to take care of matching the whole line so you don't end up with an empty line.
I just tested it and if you simply leave the replace field empty, then click replace, it will delete.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With