Hi!
I’m trying to convert a couple maps from vim.cmd
to vim.keymap
. I’ve tried several things but haven’t been able to get them to work.
vim.cmd([[imap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>']])
vim.cmd([[smap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>']])
What I have tried so far that doesn’t work is
vim.keymap.set({ "i", "s" }, "<C-l>", function()
if vim.fn["vsnip#available"](1) == 1 then
return "<Plug>(vsnip-expand-or-jump)"
else
return "<C-l>"
end
end, { buffer = bufnr, expr = true, remap = true })
I have also tried
vim.keymap.set({"i", "s"}, "<C-l>", [[vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>']], {buffer = bufnr, expr = true, remap = true})
Thanks for the help!