<%* tp.user.para(tp, false) %>
Created
January 12, 2023 18:59
-
-
Save dmych/21dfcf31ccdba9b24dc81ea9c62fae1b to your computer and use it in GitHub Desktop.
Go to the next/previous paragraph (e.g. empty line) using Templater scripts. Put all files to your Templater scripts folder, add both .md files to the Template Hotkeys and assign hot keys.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Move cursor paragraph up or down | |
// Paragraph separator is an empty line (probably with spaces) | |
async function para(tp, backwards) | |
{ | |
let editor = app.workspace.activeLeaf.view.editor; | |
let cur = editor.getCursor("from").line; | |
if (backwards) { | |
cur--; | |
while (cur > 0 && editor.getLine(cur).trim().length != 0) cur--; | |
} | |
else { | |
cur++; | |
while (cur < editor.lineCount() && editor.getLine(cur).trim().length != 0) cur++; | |
} | |
editor.setCursor(cur, 0); | |
} | |
module.exports = para; |
<%* tp.user.para(tp, true) %>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment