nvim: Only enable markdown mdeval mappings if available
Check for the existence of the 'mdeval' plugin before setting the corresponding key mappings in markdown type files.
This commit is contained in:
parent
613df98520
commit
068fc77019
1 changed files with 13 additions and 6 deletions
|
|
@ -11,12 +11,19 @@ if require("core.util").is_available("zk") and require("zk.util").notebook_root(
|
|||
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })
|
||||
end
|
||||
|
||||
-- execute code cells
|
||||
if vim.fn.mapcheck("<localleader>cc") == "" then
|
||||
if require("core.util").is_available("mdeval") then
|
||||
-- execute code cells
|
||||
if vim.fn.mapcheck("<localleader>cc") == "" then
|
||||
map("n", "<localleader>cc", require("mdeval").eval_code_block, { silent = true, desc = "evaluate code block" })
|
||||
end
|
||||
if vim.fn.mapcheck("<localleader>cx") == "" then
|
||||
map("n", "<localleader>cx", require("mdeval").eval_clean_results, { silent = true, desc = "clear code results" })
|
||||
end
|
||||
if vim.fn.mapcheck("<localleader>cx") == "" then
|
||||
map(
|
||||
"n",
|
||||
"<localleader>cx",
|
||||
require("mdeval").eval_clean_results,
|
||||
{ silent = true, desc = "clear code results" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- jump to beginning of previous/ next cell code
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue