Architecture of the plugin #6
mickael-menu
started this conversation in
General
Replies: 1 comment 1 reply
-
I'm definitely a fan of this kind of architecture and think that it would allow for |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We can identify two layers in
zk-nvim
:zk
surface API.fzf
, etc.) to thezk
API.zk
Lua APIThe low-level
zk
Lua API offers two kind of APIs:nvim-lspconfig
.Adapters
Depending on the plugin to bind to, the adapters could offer different kind of components/functions. To stay coherent across adapters, it could be useful to specify a shared catalog of APIs.
Building block components
These TUI components don't do anything besides presenting data on the screen and handling user interaction. Higher-level APIs are built upon them and the user can also use them directly for custom use cases.
NotePicker
displays the output ofzk list
and allows the user to select one (or more) notes.<CR>
), the caller should be able to add additional keybinding for additional actions, e.g:TagPicker
displays the output ofzk tag list
and allows the user to select one (or more) tags.NoteViewer
can be used to preview a note without fully opening it. We can do that with the LSP client already but the interface is pretty limited.SnippetsViewer
displays a list of notes and related snippets.match
search query.Higher-level APIs
This entry-point APIs can be directly used by the user with keybindings to answer common use cases. Ideally they should (when relevant) forward filtering options to
zk
, but offer sane defaults.browseNotes
opens aNotePicker
to edit note(s), it has a additional keybindings:browseTags
opens aTagPicker
to select one or more tags, then callbrowseNotes
to open notes with the selected tags.previewNote
opens aNoteViewer
with the link under the caret.linkToNote
opens aNotePicker
and insert a link to the selected note at the caret position.NotePicker
has better filtering options so might be more practical.Beta Was this translation helpful? Give feedback.
All reactions