fixed zk
This commit is contained in:
parent
943f29a165
commit
9af61291c3
@ -1,8 +1,9 @@
|
||||
-- Add the key mappings only for Markdown files in a zk notebook.
|
||||
if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
|
||||
-- if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
|
||||
local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end
|
||||
local opts = { noremap = true, silent = false }
|
||||
|
||||
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.
|
||||
vim.keymap.set('n', '<leader>zn', "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
|
||||
@ -25,4 +26,4 @@ if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
|
||||
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)
|
||||
end
|
||||
-- end
|
||||
|
@ -298,6 +298,11 @@ return {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
lspconfig['zk'].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
lspconfig['yamlls'].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
|
@ -3,9 +3,24 @@ return {
|
||||
config = function()
|
||||
require('zk').setup({
|
||||
picker = 'telescope',
|
||||
-- config = {
|
||||
-- on_attach = require('plugins.lspconfig').on_attach
|
||||
-- }
|
||||
lsp = {
|
||||
-- `config` is passed to `vim.lsp.start_client(config)`
|
||||
config = {
|
||||
on_attach = require('plugins.lspconfig').on_attach
|
||||
}
|
||||
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' },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user