From d3ab0568cfb285b028c804e773bf251b86e8d03f Mon Sep 17 00:00:00 2001 From: pseudometa <73286100+chrisgrieser@users.noreply.github.com> Date: Tue, 17 May 2022 13:46:01 +0200 Subject: [PATCH] Info how to add Folding & Tab Switching Commands `gt`, `zo`, etc. --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d947ac..29abd31 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you're using multiple vaults, you'll need this file on each one. Here's a simple & useful `.obsidian.vimrc` that I'm using: -``` +```vim " Have j and k navigate visual lines rather than logical ones nmap j gj nmap k gk @@ -38,6 +38,31 @@ exmap forward obcommand app:go-forward nmap :forward ``` +## Emulate Common Vim Commands via Obsidian commands + +Using `obcommand`, it is possible to emulate some additional vim commands that aren't included in Obsidian's vim mode, like for example `gt` and and `zo`. + +```vim +" Emulate Folding https://vimhelp.org/fold.txt.html#fold-commands +exmap togglefold obcommand editor:toggle-fold +nmap zo :togglefold +nmap zc :togglefold +nmap za :togglefold + +exmap unfoldall obcommand editor:unfold-all +nmap zR :unfoldall + +exmap foldall obcommand editor:fold-all +nmap zM :foldall + +" Emulate Tab Switching https://vimhelp.org/tabpage.txt.html#gt +" requires Cycle Through Panes Plugins https://obsidian.md/plugins?id=cycle-through-panes +exmap tabnext obcommand cycle-through-panes:cycle-through-panes +nmap gt :tabnext +exmap tabprev obcommand cycle-through-panes:cycle-through-panes-reverse +nmap gT :tabprev +``` + ## Supported Commands The commands that can be used are whatever CodeMirror supports.