Add documentation for operator and snippets.

This commit is contained in:
Max Bucknell 2025-01-14 00:30:47 +00:00
parent d742470375
commit 3c8d4d84b2
No known key found for this signature in database
2 changed files with 61 additions and 10 deletions

View file

@ -1,3 +1,11 @@
# Pre-amble
extends quarto, markdown, rmarkdown, pandoc
priority -1
# Header
snippet note "Note Front Matter" b snippet note "Note Front Matter" b
--- ---
title: "${1:Title}" title: "${1:Title}"
@ -9,6 +17,8 @@ date: "${3:`!v strftime(g:mbnotes_date_format_short, localtime() + (g:mbnotes_ne
$0 $0
endsnippet endsnippet
# Callouts
snippet :::n "Callout: Note" b snippet :::n "Callout: Note" b
::: {.callout-note} ::: {.callout-note}
${0:${VISUAL:text...}} ${0:${VISUAL:text...}}
@ -33,6 +43,8 @@ ${0:${VISUAL:text...}}
::: :::
endsnippet endsnippet
# Code
snippet `r "R Code Block" b snippet `r "R Code Block" b
\`\`\`{r} \`\`\`{r}
${1:#| output: ${2:false}} ${1:#| output: ${2:false}}
@ -57,13 +69,3 @@ ${0:${VISUAL:# code...}}
\`\`\` \`\`\`
endsnippet endsnippet
snippet todo "Make a To-Do List!" b
- [ ] ${0:What would you like to do..?}
endsnippet
snippet --- "Horizontal Rule" b
--------------------------------------------------------------------------------
$0
endsnippet

View file

@ -7,7 +7,10 @@
2. Setup ............................. |mbnotes-setup| 2. Setup ............................. |mbnotes-setup|
3. Configuration ..................... |mbnotes-config| 3. Configuration ..................... |mbnotes-config|
4. Commands .......................... |mbnotes-commands| 4. Commands .......................... |mbnotes-commands|
4.1. Operator .................... |mbnotes-operator|
5. Front Matter ...................... |mbnotes-front-matter| 5. Front Matter ...................... |mbnotes-front-matter|
6. Integrations ...................... |mbnotes-integrations|
6.1. UltiSnips ................... |mbnotes-ultisnips|
============================================================================== ==============================================================================
1. Introduction *mbnotes* 1. Introduction *mbnotes*
@ -214,6 +217,28 @@ results of the quarto render command that was attempted.
Render the current buffer as an HTML file and open it. See |:MBNotesRenderPDF| Render the current buffer as an HTML file and open it. See |:MBNotesRenderPDF|
for details on behaviour. for details on behaviour.
==============================================================================
4.1 Operator *mbnotes-operator*
New notes can be created from any text within Vim. These will be put into a new
note as created by `:MBNotesNew`, which will be opened.
*gb*
gb{motion} Yank the text that {motion} moves over and put it into a
new note buffer.
*gbb*
gbb Yank the current line into a new note buffer.
*v_gb*
{Visual}gb Yank the highlighted text into a new note buffer (for
{Visual} see |Visual-mode|).
These mappings are only set if `gb` is not already mapped to something. If they
are, or if you wish to customise these mappings, create new normal and visual
mode mappings (`nmap` and `xmap`) to `<Plug>MBNotesNew`, and a normal mode
mapping to `<Plug>MBNotesNewLine`.
============================================================================== ==============================================================================
5. Front Matter *mbnotes-front-matter* 5. Front Matter *mbnotes-front-matter*
@ -245,4 +270,28 @@ Anything supported by Quarto can be specified here and will be imported and
merged with any front matter specified at the top of any file. See the Quarto merged with any front matter specified at the top of any file. See the Quarto
docs for more information, specifically on projects. docs for more information, specifically on projects.
==============================================================================
6. Integrations *mbnotes-integrations*
There are many different plugins that I use to help my notes work better. I
have packaged some of the integrations in this plugin, such that they will load
if those plugin are installed.
==============================================================================
6.1. Snippets *mbnotes-ultisnips*
This plugin packages a few UltiSnips snippets out of the box. These facilitate
creating Quarto front matter with a date and title, callout blocks (as per the
Quarto documentation), and fenced code blocks that Quarto will execute.
If you use UltiSnips and would not like these, create a file called
`mbnotes.snippets` in your snippets directory, and include a line: >snippets
clearsnippets
The snippets vended by this plugin are at priority -1, so should be cleared by
a default priority instruction. Furthermore, any of these snippets can be very
easily overwritten. See the `priority` keyword in |ultisnips-basic-syntax| for
more information.
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl: