nvim: add zk
This commit is contained in:
parent
64f39e2fdc
commit
40c422e890
|
@ -330,14 +330,14 @@ in
|
|||
nnoremap <leader>gc :G commit -v -q %:p<CR>
|
||||
|
||||
" kitaab
|
||||
map <leader>cz :VimwikiIndex<CR>:ZettelNew
|
||||
map <leader>zs :ZettelSearch<CR>
|
||||
map <leader>zn :ZettelNew<CR>
|
||||
map <leader>zo :ZettelOpen<CR>
|
||||
map <leader>zf :Telescope oldfiles only_cwd=true<CR>
|
||||
map <leader>wt :VimwikiMakeTomorrowDiaryNote
|
||||
map <leader>wd :VimwikiMakeYesterdayDiaryNote
|
||||
map <leader>zm :ZenMode<CR>:setlocal nospell<CR>
|
||||
"map <leader>cz :VimwikiIndex<CR>:ZettelNew
|
||||
"map <leader>zs :ZettelSearch<CR>
|
||||
"map <leader>zn :ZettelNew<CR>
|
||||
"map <leader>zo :ZettelOpen<CR>
|
||||
"map <leader>zf :Telescope oldfiles only_cwd=true<CR>
|
||||
"map <leader>wt :VimwikiMakeTomorrowDiaryNote
|
||||
"map <leader>wd :VimwikiMakeYesterdayDiaryNote
|
||||
"map <leader>zm :ZenMode<CR>:setlocal nospell<CR>
|
||||
let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 1 }]
|
||||
let g:sync_taskwarrior = 0
|
||||
let g:zettel_format = "%y%m%d-%H%M"
|
||||
|
@ -802,6 +802,39 @@ in
|
|||
|
||||
-- zk
|
||||
require("zk").setup()
|
||||
vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
|
||||
|
||||
-- Open notes.
|
||||
vim.api.nvim_set_keymap("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts)
|
||||
-- Open notes associated with the selected tags.
|
||||
vim.api.nvim_set_keymap("n", "<leader>zt", "<Cmd>ZkTags<CR>", opts)
|
||||
|
||||
local map = vim.api.nvim_set_keymap
|
||||
-- Search for the notes matching a given query.
|
||||
vim.api.nvim_set_keymap("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", opts)
|
||||
-- Search for the notes matching the current visual selection.
|
||||
vim.api.nvim_set_keymap("v", "<leader>zf", ":'<,'>ZkMatch<CR>", opts)
|
||||
map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
|
||||
-- Create a new note after asking for its title.
|
||||
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
|
||||
map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
|
||||
-- Create a new note in the same directory as the current buffer, using the current selection for title.
|
||||
map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
|
||||
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
|
||||
map("v", "<leader>znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
|
||||
|
||||
-- Open notes linking to the current buffer.
|
||||
map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts)
|
||||
-- Alternative for backlinks using pure LSP and showing the source context.
|
||||
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
-- Open notes linked by the current buffer.
|
||||
map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
|
||||
|
||||
-- Preview a linked note.
|
||||
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
-- Open the code actions for a visual selection.
|
||||
map("v", "<leader>za", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
|
||||
|
||||
-- zen mode
|
||||
require('zen-mode').setup{
|
||||
|
|
Loading…
Reference in a new issue