Simple neovim zettelkasten functionality as a lua plugin.
Go to file
Marty Oehme 3a9e04d3ce
Refactor open actions
Open actions now make use of a 'link' data structure containing a text
and ref string, and the respective start and end positions on the line.

Additionally, parsers are now simple objects containing extraction regex
for extracting their text and ref link individually.
2020-11-04 21:37:16 +01:00
autoload Initial commit 2020-10-26 15:55:40 +01:00
lua/zettelkasten Refactor open actions 2020-11-04 21:37:16 +01:00
plugin Move anchor prepend function to anchor module 2020-10-31 11:05:30 +01:00
.tmux.session Add tmux session setup 2020-11-02 21:40:39 +01:00
README.md Add function to search for next link on line 2020-11-02 21:51:14 +01:00

Zettelkasten.nvim

To develop / debug:

start neovim with nvim --cmd "set rtp+=$(pwd)" . to automatically load the files in project dir as if they were on path

next up:

  • link following option (under cursor, next on line)
  • next link on line function (actions)
  • helper function to decide which one to use from A.open

TODO: needed functionality

  • note creation (new anchor)
    • create anchor
      • unique anchor creation
    • create link (md / wiki)
  • note listing (anchors / titles, no anchor)
    • list anchors
    • list filenames
  • link following (to existing anchor)
    • fallback to filename if anchor invalid / not found
  • link creation (to existing note)
    • list existing
    • create link (md / wiki)
  • link switching (point to another existing note)
  • note search (title / full-text)
  • jump to zettel (open existing anchor)
    • select by anchor
    • select by (fuzzy) title match
  • options
  • zettel anchor separator
  • zettel extension
  • link style (wiki/markdown)
  • custom link style?
  • link detection/following (under word, next on line)
  • recursive dir lookup for zettel
  • zettel anchor regex

TODO: nice-to-haves

  • refactor parsers (md/wiki) to be tables of functions/regex in options, so e.g. valid link detection can call options.parser.isValidLink(link) or transformation options.parser.styleLink(anchor, text)

    • enable custom parser supply
  • completion engine (e.g. for completion-nvim, look in completion_buffers/completion-tags for reference)

  • zettel caching for big directories

  • backlinks (via rg for filename anchor?)

    • keep tree of notes cached?
  • zettel maintenance

    • fix malformed anchors
    • add missing anchors
    • 'rename' anchor (goes against stability?)
    • recognize duplicate anchors (in directory, when listing, etc)
      • provide option to rename and automatically change backlinks
  • zettel 'lens' (preview first headline + content of linked zettel through floating window etc, on keypress)

  • anchor creation

    • must be unique
    • default: 10 digits, usually current date+time (YYMMDDHHmm)
    • but, if multiple links created within one minute (or other circumstances), this would duplicate
    • thus, duplicate-check before creating a new anchor
    • if duplicated, generate first non-duplicated link (recursive?)
    • try to move backwards through minutes not forward
      • i.e. if 2030101200 exists move to 2030101159, 2030101158, ...
      • if moving backwards, we do not take away id space from future note creation
      • if moving forwards, every zettel created within a minute would delay next zettel creation another minute

Options

atm:

anchor_separator = vim.g["zettel_anchor_separator"] or vim.b["zettel_anchor_separator"] or "_",
zettel_extension = vim.g["zettel_extension"] or vim.b["zettel_extension"] or ".md",
zettel_root = vim.g["zettel_root"] or vim.b["zettel_root"] or "~/documents/notes",