Giter VIP home page Giter VIP logo

zk.nvim's Introduction

zk.nvim (archived/deprecated)

NOTE: This plugin is now archived/deprecated. Please see megalithic#41 for more information.

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}
)

Telescope support

Load the zk extension to enable zk support in telescope.

require('telescope').load_extension('zk')

Register a keymap to open the picker for the zk notes.

nnoremap <leader>n <cmd>lua require('telescope').extensions.zk.zk_notes()<cr>
nnoremap <leader>zg <cmd>lua require('telescope').extensions.zk.zk_grep()<cr>
nnoremap <leader>zb <cmd>lua require('telescope').extensions.zk.zk_backlinks()<cr>

Credit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.