mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
2.0 KiB
2.0 KiB
Snippet
Snippet is designed to facilitate the repeated input of some words.
Snippet Management
You could manage snippets via the Tools
dock widget.
In this panel, we could:
- Create a snippet;
- Open snippet folder;
VNote uses a folder in the configuration folder to store all the snippets and use configuration filesnippet.json
for management. Each snippet corresponds to one file. - View and edit the information about a snippet;
- Sort and delete snippets;
- Apply (insert) a snippet into the editor;
Define A Snippet
A snippet contains:
- Snippet Name
- Identifies a snippet. It is also the name of the corresponding file in the snippet folder.
- Snippet Type
- Plain text or HTML. Currently only plain text is supported.
- Shortcut
- You could designate one of the 26 characters (
a
toz
) to insert snippet quickly.
- You could designate one of the 26 characters (
- Cursor Mark
- VNote uses Cursor Mark to mark the position of the cursor after applying a snippet. Should appears only once in the
Content
.
- VNote uses Cursor Mark to mark the position of the cursor after applying a snippet. Should appears only once in the
- Selection Mark
- VNote uses Selection Mark to mark the position to insert the selected text before applying a snippet. Selection mark could appear multiple times in the
Content
. After applying a snippet, all the selection marks will be replaced with the selected text.
- VNote uses Selection Mark to mark the position to insert the selected text before applying a snippet. Selection mark could appear multiple times in the
- Content
- The content of the snippet which will be inserted at the position of current cursor while applying a snippet.
Apply A Snippet
Snippet Panel
Place the cursor at the proper position and double click a snippet in the snippet panel to apply a snippet.
Shortcuts
You could use Captain Mode to apply a snippet quickly. In edit mode, press Ctrl+E S
to activate snippet selection dialog, which shows all the snippets with shortcut defined. Press the corresponding shortcut key to apply a snippet.
Examples
Insert Code Block with CPP
```cpp
@@
```
Comment Out Selected Text
<!-- $$@@ -->
Tag for Color
<font color=red>$$@@</font>
Or:
<mark>$$@@</mark>