Advanced Cursors adds new commands to Obsidian which let you take more advantage of multiple cursors.
This plugin pairs really well with @spslater
's Cursor Position plugin
This command takes the text you currently have selected (or selects the word under the cursor if nothing is selected), and moves the cursor to the next instance of that same text.
If no next instance is found, it will loop back to the beginning of the note.
This command does mostly the same as the previous, except it keeps your previous cursor selections in place. Similarly, if no next instance is found, it will loop back to the beginning of the note.
This does the same thing as Ctrl + d
in VS Code.
Same as Move to next instance of current selection, except going backwards.
Same as Add next instance of current selection to selections, except going backwards.
This command copies the currently selected lines up or down depending on which option you choose.
Like Alt + Shift + ↑/↓
in VS Code.
Running this command opens a modal which lets you choose a start
number, and an increment inc
. On submitting, Advanced Cursors will overwrite each of your current selections with an incrementing value starting from start
and incrementing by inc
each cursor.
Both start
and inc
can be arbitray real numbers. The resulting number will be rounded to 4 decimals.
This command allows even more fine-grained control of where you place the cursor.
When you open the modal, you will see a text input field, and submit button, and an option to toggle Regex
.
Enter a search query into the input field, and Advanced Cursors will place a cursor at each place in the current document that matches the query.
Toggle Regex?
for the query to be treated as a regex, or a string literal.
You can now also use Saved Queries to quickly run queries.
In the settings tab of Advanced Cursors, you will see an interface allowing you to Add New Query
. This allows you to set up a query (regex or literal) to quickly access from the Match Modal, or run as an Obsidian command from the command palette.
In the Add New Query
modal, you have 4 options:
- The
name
of the query, - The actual
query
itself, - Any regex flags to apply to the query (if it is a regex),
- The
g
flag is automatically added, but it won't break if you add it yourself.
- The
- A toggle to say if the
query
should be interpretted as a regex or literal string.
After adding a query, it will appear in a list of saved queries in settings:
In the Match Modal (Simply click the query to run it):
As well as in the command palette:
The following is a list of queries created by users of the plugin:
/^- \[ ] .*$/m
/^- \[x] .*$/m
/^- +[\d\w][\.\)] /m
Matches a bullet point followed by a numbered bullet:
- 1.
- 1)
- a.
- a)
Having both is usually redundant, so this allows you to remove one or the other.
/\n\n>? ?[-\d]+\.?/
If you prefer bullet points to not have an extra line between them, use this to find offending bullet points.
- 1
- 2
- 3
/\b.*?\.(?=\s|$)/m
Select the shortest string between a word boundary \b
and a fullstop \.
/10\.[^\s]+\/[^\s]*\w/
/\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|(([^\s()<>]+|(([^\s()<>]+)))))+(?:(([^\s()<>]+|(([^\s()<>]+))))|[^\s`!()[]{};:'".,<>?«»“”‘’]))/
/\[Line\s\d{1,2}\]\(x-devonthink-item:\/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\?line=\d{1,2}\)/
- Look for all DT links in the note and copy then to clipboard;
- Delete
\(x-devonthink-item:\/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\?line=\d{1,2}\)
- Paste in the end of the note.
/==.*?==/
/(?<=id="green">).*?(?=\<)/
/^#+.*?$/m
/(?<=\[\[)(?!.*#\^).*(?=\]\])/
/#Tag/