"Avoid unfolding folded sections" JS is not working
Hello! For some reason the Avoid unfolding folded sections does not work for me. Each time I type j or k it just starts typing :upSkipFol... and so on, instead of actually moving lines.
I have mdHelpers.js file in the root vault folder.
❯ cat mdHelpers.js
function moveUpSkipFold() {
view.editor.exec('goUp');
}
function moveDownSkipFold() {
view.editor.exec('goDown');
}
In my .obsidian.vimrc I have this:
" Fix for unfolding of folded lines when curor is hovered over
exmap upSkipFold jsfile mdHelpers.js {moveUpSkipFold()}
exmap downSkipFold jsfile mdHelpers.js {moveDownSkipFold()}
nmap k :upSkipFold
nmap j :downSkipFold
In Vimrc Support settings I have Support JS command optional enabled.
Starting in Obsidian 1.7.2, ex commands (those entered with a leading : in Vim) must be followed by an explicit Enter (<CR>) to execute. Previously, Obsidian’s Vim implementation could execute some ex commands without needing <CR>, but that behavior changed with the underlying CodeMirror updates. Hence, any custom ex commands need to end with <CR>.
Below is an example of that in effect.
exmap back obcommand app:go-back
nmap <C-o> :back<CR>
Starting in Obsidian 1.7.2, ex commands (those entered with a leading : in Vim) must be followed by an explicit Enter
(<CR>)to execute. Previously, Obsidian’s Vim implementation could execute some ex commands without needing<CR>, but that behavior changed with the underlying CodeMirror updates. Hence, any custom ex commands need to end with<CR>.Below is an example of that in effect.
exmap back obcommand app:go-back nmap <C-o> :back<CR>
That was it, thanks!
Unfortunately this plugin this does not work for me as expected. After I do [[ or ]] it does work properly and I can use j or k to move through unfolded sections, but as soon as I use e.g. G to jump to the end of the file or O to move above current heading, it auto-expands that heading and then after manually colapsing j or k again opens the folds. Then I again need to click [[ or ]] to re-enable it.