Is there a way to easily convert non-bullet lines to have bullet prefixes?

Increasingly while bulk-processing notes I find myself needing to convert regular lines into bullets. It is becoming tedious manipulating each line manually.

Is there a method / hotkey that can either:

  • prepend the bullet syntax - to the front of the current line or highlighted group of lines
  • toggle between a prepended bullet and no prepended bullet (i.e. make a line a bullet or non-bullet line, as a toggle)

?

2 Likes

Hi. You can install the community plugin- Hotkeys++.

argenos/hotkeysplus-obsidian: Adds hotkeys to toggle todos, ordered/unordered lists and blockquotes in Obsidian

3 Likes

In the options / settings, turn on “Vim key bindings” and “Show line number”. In edit mode, when you’ve identified a block of lines needing the bullets, for example lines 10 - 20, type the following:

:10,20s/^/- /

English: for lines 10 through 20, substitute the beginning of line for a dash and space. If you want to do the whole file, use the percent sign instead:

:%s/^/- /

If you’re not familiar with vim that’s a small problem. Two major modes: “hotkey” mode (the cursor is a blinking block) and insert mode (the cursor is a blinking line). Commands are entered in hotkey mode. If you’re in insert mode, press escape to go back to hotkey mode. If in hotkey mode and you want to insert, press “i”. There are a billion other functions, but that’s all you need to get started.

4 Likes

You can also try selecting the lines and pressing Ctrl Enter (or Command Enter). This will make it add - [ ] before each line (that is a Dash, Space, Open square bracket, Space, Close square bracket, Space).

Then you can do a search and replace (I think Ctrl h by default) and search for what is enclosed in parentheses here: (- [ ] )

(Dash, Space, Open square bracket, Space, Close square bracket, Space)

And Replace with what is enclosed in parentheses here: (- )

(Dash, Space)

I only add the parentheses so you notice the space. Also I do this because if I tried to isolate it on its own line for clarity, it would be formatted to show a checkbox or bullet here on the forum.

As a side note, you can use + or * instead of dash. This can be helpful in cases where you are doing searches for the bullet formatting but have lots of Dash Spaces within your note content that would also be returned in these searches. And if you ever wanted to switch the + to - you can just do a search and replace (assuming you don’t use + in your note content as well).

I hope that helps.

Thanks.

2 Likes

Aha, I thought this was in the plugins but I couldn’t find it.

Thanks @axcraig !

Edit: Turns out it can only do a single line at a time, but that’s better than it was. Weirdly it appears to toggle block quotes on multilines, but not bullets.

It definitely does multiple lines for me. I’m using Linux.

It appears to be a bug that occurs when changing the assigned hotkey. Changing the hotkey back to default returns it to multiline behavior. I’ve filed a bug report.

1 Like

Thank you @I-d-as, I did not notice that option. Well, you know what they say, when the only tool you have is a hammer, every problem looks like a nail. :slight_smile:

1 Like

You can also use multiple cursors to quickly update multiple lines.

“You can add additional cursors by holding Alt (or Option on macOS) and selecting another position in the note.”

and

" If you want to edit consecutive lines of text—for example, to turn paragraphs into list items—you can hold Shift+Alt (or Shift+Option on macOS) while dragging."

1 Like