Trying to add a plugin.
thedanielfactor opened this issue · comments
I am trying to add a new plugin but I am getting an error during startup every time.
Plugin: zk-nvim
I have added the plugin to the plugins.tools
section in the lua/core/plugins.lua
file. I have tried many variations of this even just calling M.setup()
in the load function.
...
plugin.tools = {
{ "uga-rosa/translate.nvim" },
{ "olimorris/persisted.nvim" },
{ "norcalli/nvim-colorizer.lua" },
{ "askfiy/nvim-picgo", module = "nvim-picgo" },
{ "kristijanhusak/vim-carbon-now-sh", cmd = { "CarbonNowSh" } },
{ "lewis6991/gitsigns.nvim", event = { "BufRead", "BufNewFile" } },
{ "dstein64/vim-startuptime", cmd = { "StartupTime" } },
{ "folke/which-key.nvim", event = { "BufRead", "BufNewFile" } },
{ 'mickael-menu/zk-nvim' },
}
...
I have also added the config file in lua/config/zk-nvim.lua
-- https://github.com/mickael-menu/zk-nvim
local api = require("utils.api")
local M = {
requires = {
"zk",
},
}
function M.before()
M.register_key()
end
function M.load()
M.setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
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" },
},
},
})
end
function M.after() end
function M.register_key() end
function M.register_key()
local opts = { noremap=true, silent=false }
api.map.bulk_register({
{
mode = { "n" },
lhs = "<leader>zn",
rhs = "<cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<cr>",
options = opts,
description = "Create a new note after asking for it's title.",
},
{
mode = { "n" },
lhs = "<leader>zo",
rhs = "<cmd>ZkNotes { sort = { 'modified' } }<cr>",
options = opts,
description = "Open Notes.",
},
{
mode = { "n" },
lhs = "<leader>zt",
rhs = "<cmd>ZkTags<cr>",
options = opts,
description = "Open notes associated with tags.",
},
{
mode = { "n" },
lhs = "<leader>zf",
rhs = "<cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search') } }<cr>",
options = opts,
description = "Search for notes matching a given query.",
},
{
mode = { "v" },
lhs = "<leader>zf",
rhs = "<cmd>ZkMatch<cr>",
options = opts,
description = "Search for notes matching the current visual selection.",
},
})
end
plugin.lua file miss return M
Ok, I added return M
to the bottom of the file lua/config/tools/zk-nvim.lua
and ran PackerSync
. It seems to load fine but it does not seem to be loading the plugin. When I use the <leader>cn
I get an error:
E492: Not an editor command: ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }
Is there a log or some way for me to trace the startup? I am just learning Lua so I am not familiar with any tools that may exist for it.
rhs error.
Only viml syntax is allowed in , not lua syntax. You can define it as a function and write lua code in it.