-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
zk.lua
101 lines (86 loc) · 1.96 KB
/
zk.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
return {
'zk',
requires = { 'mickael-menu/zk-nvim', 'prncss-xyz/neo-tree-zk.nvim' },
config = function(config)
require('zk').setup(config.zk)
end,
defaultConfig = {
'zk',
{
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = 'select',
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { 'zk', 'lsp' },
name = 'zk',
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = { enabled = true, filetypes = { 'markdown' } },
},
},
},
keymaps = {
{ 'n', '<space>Z', ':Neotree toggle zk<CR>', { silent = true } },
{
'n',
'<leader>zn',
function()
require('zk.commands').get('ZkNew')({ title = vim.fn.input('New Note Title: ') })
end,
{ desc = 'Create a new note after asking for its title.' },
},
{
'v',
'<leader>zn',
function()
require('zk.commands').get('ZkNewFromContentSelection')({
title = vim.fn.input('New Note Title: '),
})
end,
},
{
'n',
'<leader>zo',
function()
require('zk.commands').get('ZkNotes')({ sort = { 'modified' } })
end,
{ desc = 'Open note.' },
},
{
'n',
'<leader>zt',
function()
require('zk.commands').get('ZkTags')({})
end,
{ desc = 'Open notes associated with the selected tags.' },
},
{
'n',
'<leader>zi',
function()
require('zk.commands').get('ZkIndex')()
end,
{ desc = 'Search for the notes matching a given query.' },
},
{
'n',
'<leader>zl',
function()
require('zk.commands').get('ZkLinks')({})
end,
{ desc = 'Search for the notes matching a given query.' },
},
{
'v',
'<leader>zf',
function()
require('zk.commands').get('ZkMatch')({})
end,
{ silent = false, desc = 'Search for the notes matching the current visual selection.' },
},
},
}