Page 1 of 1

How can I delete lines that contain a specific text

Posted: 03.01.2022 21:53
by BBServ
I have been using CudaText for a few months now and have been able to find ways to easily do most of the things I do on a regular basis. The one thing that I have not been able to do with the ease and speed of my previous editor is to delete lines containing a specific text. I can get that accomplished by finding the string and selecting all occurrences, bookmarking the carets, and then deleting lines with the bookmarks. I tried a macro, but it keeps the previously used string as indicated below "gallbladder":

Code: Select all

ed.cmd(cmds.cmd_FinderAction,'findsel\x01[color=#4000FF][color=#FF4040]gallbladder[/color][/color]\x01\x01')
ed.cmd(cmds.cmd_BookmarkPlaceBookmarksOnCarets)
ed.cmd(cmds.cmd_BookmarkDeleteMarkedLines)
I thought this would be ideal for a plugin, but I found quickly that is above my level of expertise.

Is there a plugin that has this functionality or a way I can change the macro to have it prompt me for the string?

Thanks in advance for any help.

joe

Posted: 03.01.2022 22:38
by main Alexey
I wrote a small plugin. it gives 2 commands:

Plugins / Select lines with text / Select lines...
Plugins / Select lines with text / Delete lines...

They ask for a string.
Please test.
Open zip file in CudaText and confirm to install.
When it's OK I may merge it to CudaExt plugin.

Posted: 04.01.2022 14:50
by BBServ
Thank you! The plugin works well. I appreciate your kindness.

Posted: 05.01.2022 10:48
by main Alexey
Plugin CudaExt updated.
1.7.36 (2022-01-05)
added: Command "Delete lines containing text..." (by Alexey T.)