Is it possible to manipulate source code in the ed...
# intellij
z
Is it possible to manipulate source code in the editor using Kotlin? I have a bunch of
include(SomeSerializerModule)
calls (400+) in a method, and I'd like to order them alphabetically. I've been copying it to a string sorter and pasting back the response, but it would be nice if I could just select the lines in the editor, and use some inline evaluator to do something like
editor.selectedLines.sorted()
Additionally, I think it could be extended to multi-file templates, where given some context, make 4 different files in 4 different projects with different templates for each, across modules and packages
h
You can just select the lines in the editor and choose Edit->Sort Lines?
🙌 1
plus one 1
z
Oh my god, I've never even noticed that option before, and it works perfectly
I see that there's a macro option too. I've spent a few days nailing down key binds to make these files, which probably could've been done once in a recording and repeated. Alt+1 + Alt+Ins + Paste + Live Template + Alt+Left + Copy | Repeat
Is there some similar functionality to dedupe lines as well?
e
get a better editor? in vim that is
:sort u
, and afaik it works in IdeaVim too
c
I've heard good things about this plugin: https://plugins.jetbrains.com/plugin/2162-stringmanipulation
âž• 1