option to skip creation of user commands

pull/8/head
Karim Abou Zeid 3 years ago
parent 89179f1949
commit cd66837e8c

@ -34,6 +34,9 @@ require("telescope").load_extension("zk")
#### Default configuration #### Default configuration
```lua ```lua
require("zk").setup({ require("zk").setup({
-- create user commands such as :ZkNew
create_user_commands = true,
lsp = { lsp = {
-- automatically attach buffers in a zk notebook that match the given filetypes -- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = { auto_attach = {

@ -9,9 +9,15 @@ M.lsp = require("zk.lsp")
function M.setup(options) function M.setup(options)
config.options = vim.tbl_deep_extend("force", config.defaults, options or {}) config.options = vim.tbl_deep_extend("force", config.defaults, options or {})
if config.options.lsp.auto_attach.enabled then if config.options.lsp.auto_attach.enabled then
util.setup_lsp_auto_attach() util.setup_lsp_auto_attach()
end end
if config.options.create_user_commands then
vim.cmd("command! ZkIndex lua require('zk').index()")
vim.cmd("command! -nargs=? ZkNew lua require('zk').new(nil, { dir = [=[<args>]=]})")
end
end end
-- Commands -- Commands
@ -28,7 +34,4 @@ function M.new(path, args)
end) end)
end end
vim.cmd("command! ZkIndex lua require('zk').index()")
vim.cmd("command! -nargs=? ZkNew lua require('zk').new(nil, { dir = [=[<args>]=]})")
return M return M

@ -1,6 +1,7 @@
local M = {} local M = {}
M.defaults = { M.defaults = {
create_user_commands = true,
lsp = { lsp = {
auto_attach = { auto_attach = {
enabled = true, enabled = true,

Loading…
Cancel
Save