cormacrelf / zk.nvim

Neovim plugin as a lightweight wrapper around https://github.com/mickael-menu/zk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zk.nvim

NOTE: This plugin is presently WIP

A lightweight neovim, lua-based wrapper around zk.

The primary goals of this plugin are to provide handy maps, commands, and user-interface elements around the fantastic golang zettelkasten project, zk.

For more information with how to fully use zk, please visit zk's docs

LSP support within zk is new and still under development. It works quite well as-is, though. 😄

Prerequisites

Install

paq-nvim

paq { "megalithic/zk.nvim" }

packer.nvim

use { "megalithic/zk.nvim" }

vim-plug

Plug "megalithic/zk.nvim"

Configuration

-- with default config options:

require("zk").setup({
  debug = false,
  log = true,
  default_keymaps = true,
  default_notebook_path = vim.env.ZK_NOTEBOOK_DIR or "",
  fuzzy_finder = "fzf", -- or "telescope"
  link_format = "markdown" -- or "wiki"
})

Usage

For all usages of this plugin, the parlance of notebook is common place, and refers to a sub-directory within your root ZK_NOTEBOOK_DIR; or more specifically, a notebook is any directory that contains a .zk directory (think of it like a .git-controlled directory). These notebooks also relate to your groups setup within your config.toml.

Install zk

Install the zk binary (as long as go is installed in your system's PATH).

:ZkInstall

Create a new note

:lua require('zk.command').new({ title = "my note title" })

Default arguments:

{
  title = "",
  notebook = "",
  content = "",
  action = "vnew",
  start_insert_mode = true
}

Search/filtering of notes

zk offers such a wealth of power with searching, filtering and more for your notes, notebooks, etc.

Presently only supports interacting with fzf, via a flexible and fast lua-based API plugin, nvim-fzf. Searching via vim command, :ZkSearch only supports query searches at the moment. Using the lua command, the option to pass tags, notebook, and query are supported.

Future support for telescope.nvim integration, coming soon.

:lua require('zk.command').search({ query = "hiring NOT onboarding" })
" or
:ZkSearch "hiring NOT onboarding"

Default arguments:

{
  query = "",
  notebook = "",
  tags = "",
}

Generate a new note and inline link

Quickly change the word under cursor (or visually selected) to markdown or wiki syntax:

:lua require('zk.command').create_note_link({ title = "my note title", notebook = "wiki", action = "e" })

Default arguments:

{
  title = "",
  notebook = "",
  action = "vnew",
  open_note_on_creation = true
}

Default keymaps:

vim.api.nvim_set_keymap(
  "x",
  "<CR>",
  "<cmd>lua require('zk.command').create_note_link({})<cr>",
  {noremap = true, silent = false}
)
vim.api.nvim_set_keymap(
  "n",
  "<CR>",
  "<cmd>lua require('zk.command').create_note_link({title = vim.fn.expand('<cword>')})<cr>",
  {noremap = true, silent = false}
)

Credit

About

Neovim plugin as a lightweight wrapper around https://github.com/mickael-menu/zk

License:GNU General Public License v3.0


Languages

Language:Lua 96.9%Language:Vim Script 3.1%