Home

Awesome

kb-notes.nvim

Yet another note management system for neovim.

Supports:

Installation

Install with your favorite plugin manager.

Example for lazy.nvim

require("lazy").setup({
  { 
    'dobrovolsky/kb-notes.nvim',
    dependencies = {
      'ibhagwan/fzf-lua',
      -- open markdown link
      'jghauser/follow-md-links.nvim',
      -- nice notifcaitons
      'rcarriga/nvim-notify',
    },
  },
}

require('kb_notes').setup {
  -- Required: full path to your notes
  notes_path = '/Users/s/kb/notes/',
  -- Optinal: use a custom post init function
  note_post_init = KBPostInit
  -- Optinal: define your own template for new notes
  -- supported variabled {note_name} will be replaced with your name
  template = '# {note_name}\n\n'
}

-- Example post init function
function KBPostInit()
  -- set spelling
  vim.opt_local.spell = true
  vim.opt_local.spelllang = "uk,en,ru"

  -- insert wikilink
  vim.api.nvim_buf_set_keymap(0, 'i', '<c-e>', '<esc>:KBLinkSuggestion<cr>', {})
  vim.api.nvim_buf_set_keymap(0, 'n', '<c-e>', ':KBLinkSuggestion<cr>', {})
  -- find suggestion for word under cursor
  vim.api.nvim_buf_set_keymap(0, 'n', 'zf', ':KBSpellSuggest<cr>', {})
  -- create new note
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>nn', ':KBNewNote<cr>', {})
  -- rename note
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>re', ':KBRenameNote<cr>', {})
  -- go to parent of current note
  vim.api.nvim_set_keymap('n', '<leader>u', ':KBGoToParentNote<cr>', {})
  -- search for parent notes
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>U', ':KBShowParentNotes<cr>', {})
  -- open random note
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>or', ':KBRandomNote<cr>', {})
  -- follow via wikilink
  vim.api.nvim_buf_set_keymap(0, 'n', 'gd', ':KBOpenLink<cr>', {})
  -- find all links from and to current buffer
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>nl', ':KBGetLinks<cr>', {})
  -- search note with predefined query
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>sl', ':KBSearchNoteWithPrefix<cr>', {})
  -- search connected links for link under cursor
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>sc', ':KBShowConnectedNotesForLink<cr>', {})

  -- use prettier and update title with filename for w and q
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>q', ':Neoformat<cr>:KBUpdateNoteHeader<cr>:wq<cr>', {})
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>w', ':Neoformat<cr>:KBUpdateNoteHeader<cr>:w<cr>', {})
  --vim.api.nvim_buf_set_keymap(0, 'n', '<leader>q', ':KBUpdateNoteHeader()<cr>:wq<cr>', {})
  --vim.api.nvim_buf_set_keymap(0, 'n', '<leader>w', ':KBUpdateNoteHeader()<cr>:w<cr>', {})

  -- find all backlinks
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>bl', ':KBShowBacklinks<cr>', {})
  -- open file as mind map in browser
  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>fs', ':KBOpenMap<cr>', {})

List of commands

General commands

Additional commands

This is a very specific command that I use for my own notes.

Known issues

Old python version

There is old python version. Stores in old_python.