- VimwikiUtils
- Requirements
- Features
- Default Key mappings
- Installation
- Getting Started
[!INFO] This is a work in progress and my first time implementing a plugin for nvim.
This plugin is an extension for Vimwiki, trying to add to its many capabilities. It also has a predefined wiki structure, which I use in my bioinformatics studies. The wiki structure was inspired by this YouTube video.
/home/usr/zettelkasten/
.
├── 1_rough_notes/
│ ├── unprocessed_note.md
│ └── ...
├── 2_source_material/
│ ├── lecture_slides_1.pdf
│ └── ...
├── 3_tags/
│ ├── rna.md
│ ├── computer_science.md
│ ├── biochemistry.md
│ └── ...
├── 4_atomic_notes/
│ ├── atomic_note_1.md
│ ├── atomic_note_2.md
│ ├── atomic_note_3.md
│ └── ...
├── assets/
│ ├── screenshots/
│ │ ├── screenshot_1.png
│ │ ├── screenshot_2.png
│ │ └── ...
│ ├── gifs/
│ └── ...
├── templates/
│ ├── template_1.md
│ ├── template_2.md
│ └── ...
└── README.mdAllows you to quickly link to an existing file or to create a new file based on
a template. Pressing <C-f> in insert mode opens a telescope prompt
showing all files in 4_atomic_notes/. Either hit <CR> on an existing note
(creating a link to it), or press <A-CR> (options + enter) to forcefully
create a new note (based on where you are currently at), which will be named
after what you typed into the promt. If you type a new note name and there's no
other similar note in the fuzzy findings of telescope, you can also just hit
<CR> to create the new note. This helps you to dynamically create new notes or
link to already existing notes. Use <tab> to autocomplete your promt with the
current selection. If you accidentally create a new atomic_note
in e.g 3_tags/ or at root level of your wiki, just use
VimwikiUtilsEmbed in order to move it to
4_atomic_notes/.
If you link to a new note (pressing <A-CR> while in VimwikiUtilsLink) from
within a tag note (a note which is stored 3_tags/), a link to the
corresponding tag will automatically be substituted into your template
if your template contains a TAG token. See template examples in
templates/
Templates currently support the following tokens:
DATE-> formats to current dateHEADER-> formats to name of file (removes any_)TAG-> links back to tag file (if new note was created from within a tag file)
One can also just disable the templates completely by using use_templates = false
in the config.
Find parent files linking to the currently opened file by pressing <leader>fb.
Since one file can be referenced by several other files, the files displayed in the
picker are by name and line number.
Press <leader>nn to create a rough_note.md in your
1_rough_notes/ based on a chosen template. This is not necessary,
but it is useful when you want to quickly take temporary note or notes that don't
belong to any tag yet. After polishing the note you can use VimwikiUtilsEmbed
to move the rough_note to 4_atomic_notes.
Using this function you can linkt to your soure files (e.g lectures, papers, etc) stored in 2_source_material/. Make sure to
name your sources clearly in order to prevent chaos.
Easily create or link to existing tags in 3_tags/,
which are meant to also structure your wiki. An index can be generated, holding
all files tagged by the current tag file. While in insert mode, press <C-e>
to open a telescope prompt. Here all your tags will be displayed. Hit <CR>
to create a link to the selected tag or hit <A-CR> (options + enter) to
forcefully create a new tag (named after what you typed in the promt). If you
type a new tag name and there's no other similar tag in the fuzzy findings of
telescope, you can also just hit enter to create the new tag (same behavior as
VimwikiUtilsLink).
Helps handling notes stored in 1_rough_notes/ (or
anywhere but 4_atomic_notes/) by automatically moving the currently opened
note into your 4_atomic_notes/ dir after you abstract and summarize it.
Generates a list of all referencing files formatted as links.
Useful when in README.md or in any tag file.
Due to the adjusted wiki structure, the default
VimwikiRename doesn't work as expected. This function fixes said issue, it
uses several matching patterns to identify links and replaces them using sed.
Take screenshots on the fly by and embed them into the current markdown file.
After calling VimwikiUtilsSc you need to provide an image name. If that image
already exists, nothing will happen, otherwise nvim will call the screenshot
script after a 5 second delay. This way, you have enough time to set everything
up.
VimwikiUtilsSc calls Flameshot with the following parameters:
flameshot gui -p <image_path> -d <delay>
, where <image_path> points to the image destination assets/screenshots/<name>.png.
[!INFO]
In order to hide the hint that gets displayed by
flameshot gui, disable it in the internal configuration offlameshot(usingflameshot config)
Hovering over an embedded screenshot and pressing <leader>ii opens KolourPaint (if installed).
This allows for additional annotation of already existing screenshots.
You can also replace it with any other light weight image editing software
using edit_image_exe = "<path_to_alt_executable>".
You can also provide args for the alternative exe using
edit_image_args = "<args>". Note that <args> needs to be
a table, e,g:
{
images = {
edit_image_args = { "--fullscreen", "--delay", "3" }, -- (random args)
}
}
I personally like to summarize my lectures in .md and during so I mark key words using the inline code syntax. Having summarized a lecture, it is
sometimes tedious to create good Anki cards
afterwards. That's why I try to already format my summary into smaller chunks, f.e:
## Multi-modal registration using MIND
- **MIND**: `Modality-Independent Non-local descriptor`
- Idea: Converting `multi-modal` into `mono-modal` problem
- For each `image pixel`, a set of `local weights` are calculated over `non-local image patches`
- These `weights` can be directly compared between images of different `modalities`If I now want to quickly create a cloze type Anki card, I can select this
paragraph in VISUAL (block or line) mode and hit <leader>ac to call VimwikiUtilsAnkiCloze.
There are three options for converting the paragraph into a cloze style Anki card:
Default (''):
All inline code parts share the same cloze id:
## Multi-modal registration using MIND
- **MIND**: {{c1::`Modality-Independent Non-local descriptor`}}
- Idea: Converting {{c1::`multi-modal`}} into {{c1::`mono-modal`}} problem
- For each {{c1::`image pixel`}}, a set of {{c1::`local weights`}} are calculated over {{c1::`non-local image patches`}}
- These {{c1::`weights`}} can be directly compared between images of different {{c1::`modalities`}}Per word ('0'):
## Multi-modal registration using MIND
- **MIND**: {{c1::`Modality-Independent Non-local descriptor`}}
- Idea: Converting {{c2::`multi-modal`}} into {{c3::`mono-modal`}} problem
- For each {{c4::`image pixel`}}, a set of {{c5::`local weights`}} are calculated over {{c6::`non-local image patches`}}
- These {{c7::`weights`}} can be directly compared between images of different {{c8::`modalities`}}Per line ('1')
## Multi-modal registration using MIND
- **MIND**: {{c1::`Modality-Independent Non-local descriptor`}}
- Idea: Converting {{c2::`multi-modal`}} into {{c2::`mono-modal`}} problem
- For each {{c3::`image pixel`}}, a set of {{c3::`local weights`}} are calculated over {{c3::`non-local image patches`}}
- These {{c4::`weights`}} can be directly compared between images of different {{c4::`modalities`}}The converted text is saved to your systems clipboard.
| Keymap | Function |
|---|---|
INSERT <C-f> |
VimwikiUtilsLink |
INSERT <C-e> |
VimwikiUtilsTags |
NORMAL <leader>nn |
VimwikiUtilsRough |
NORMAL <leader>fb |
VimwikiUtilsBacklinks |
NORMAL <leader>sc |
VimwikiUtilsSc |
NORMAL <leader>ii |
VimwikiUtilsEditImage |
NORMAL <leader>sm |
VimwikiUtilsSource |
NORMAL <leader>m |
VimwikiUtilsEmbed |
NORMAL <leader>wm |
VimwikiUtilsGenerateIndex |
NORMAL <leader>wr |
VimwikiUtilsRename |
VISUAL <leader>ac |
VimwikiUtilsAnkiCloze |
use {
'mweyrich28/vimwiki_utils',
requires = {
'nvim-telescope/telescope.nvim',
'vimwiki/vimwiki'
}
}return {
'mweyrich28/vimwiki_utils',
dependencies = {
'nvim-telescope/telescope.nvim',
'vimwiki/vimwiki',
},
config = function()
require('vimwiki_utils').setup({})
end,
}require('vimwiki_utils').setup({})Or configure your keymaps and dirs like this:
require('vimwiki_utils').setup({
globals = {
rough_notes_dir = "1_rough_notes",
source_dir = "2_source_material",
tag_dir = "3_tags",
atomic_notes_dir = "4_atomic_notes",
screenshot_dir = "assets/screenshots",
},
keymaps = {
vimwiki_utils_link_key = "<C-b>",
vimwiki_utils_tags_key = "<C-e>",
vimwiki_utils_rough_key = "<leader>nn",
vimwiki_utils_backlinks_key = "<leader>fb",
vimwiki_utils_sc_key = "<leader>sc",
vimwiki_utils_edit_image_key = "<leader>ii",
vimwiki_utils_source_key = "<leader>sm",
vimwiki_utils_embed_key = "<leader>m",
vimwiki_utils_generate_index_key = "<leader>wm",
vimwiki_utils_rename = "<leader>wr",
vimwiki_utils_anki_cloze = "<leader>ac",
},
templates = {
use_templates = false,
dir = "templates",
},
images = {
edit_image_exe = "/snap/bin/kolourpaint",
edit_image_args = "",
}
})Make sure to create a wiki in your vimwiki.lua config like so:
vim.g.vimwiki_auto_chdir = 1 -- this is currently necessary
vim.g.vimwiki_list = {
{
path = '~/path/to/zettelkasten/',
syntax = 'markdown',
ext = '.md',
index = 'README'
}
}