timhor / obsidian-editor-shortcuts

Obsidian plugin to add keyboard shortcuts commonly found in code editors such as Visual Studio Code (vscode) or Sublime Text
MIT License
356 stars 25 forks source link

[Feature Request] Custom selection transform #42

Closed vkhobor closed 2 years ago

vkhobor commented 2 years ago

Hi!

I was looking for a way to transform selected text to other formats. My use case was that I wrote a list comma separated and not markdown formatted, and I wanted to transform it via a command.

From:

apple, banana

To:

- apple
- banana

I've seen this plugin supports Transform selection to uppercase which is similar, only the logic is different.

I was wondering if something like Transform selection to uppercase with custom js code could be supported or if you know any plugins that have this functionality.

Thank you for the help.

timhor commented 2 years ago

You could use Select all occurrences of selection to select the comma delimiters and then press Enter and -? That should get you most of the way for this use case.

If it's a common action you need to perform, you can also create a macro to chain those operations in the QuickAdd plugin.