I was wrong
about binding multiple commands to a single hotkey, not only does this not work, it's non-deterministic and only SOMETIMES doesn't work, which fooled me!
I have tweaked the post to be about the method that DOES work, using the Commander plugin. My apologies for the error, and thanks so much to Sam R for pointing this out to me!
Hi friends, a quick (corrected) Obsidian tip for you.
As you CAN'T bind multiple commands to a single hotkey, I use the commander plugin to build a custom command that combines the four things I want to happen on save:
1. Save Current file (of course)
2. Linter: Lint the current file
3. LanguageTool: Check Text
4. Breadcrumbs: Rebuild Graph
This new command I have named "Save Hook", which I have bound in the hotkey settings to ctrl+s, and it all works perfectly.
(Note the delay before calling Languagetool, this is so that Linter has had a change to reformat the file, otherwise Languagetool's errors don't line up!)
Explanation:
(1) is obvious, if you're remapping the save key, it should still save the file! Obsidian autosaves, but especially if I'm interacting with external tools, I often need to manually save, too.
(2) Linter is a comprehensive autoformatter for Markdown, which stops me wasting time fiddling with formatting. With it, you can enable auto capitalisation for headings, automatically add blank lines around lists or blockquotes, delete trailing spaces and lines, and many, MANY more. All options are togglable on and off to suit.
(3) LanguageTool Is my preferred "spelling/grammar/and more" checker. The quality of this open-source software is unmatched (Grammarly WISHES it was LanguageTool), and while I can run it locally for offline use, I usually prefer to use the API provided by languagetool.org, which has access to more power-intensive n-gram models. *
(As a writer of historical fiction, THIS IS GENIUS!)
(4) Breadcrumbs provides visualisation and traversal commands for navigating my notes' ontology. Most of my notes have a link to a parent in the file properties, with the YAML key 'up'. I can then use breadcrumbs' commands to navigate to parents, children, etc, without touching my mouse (always a goal). Because rebuilding the breadcrumbs graph can take a few hundred ms, running it after every change is too much, but manually on save is perfect.
More to come, thank you all for your support!
Tris
*You better believe that LanguageTool works in neovim, too! I use barreiroleo/ltex_extra.nvim as my LSP
No Boilerplate
2025-03-13 12:03:54 +0000 UTCSam Rogers
2025-03-11 21:49:50 +0000 UTCRantingHuman
2025-03-11 15:58:17 +0000 UTC