|
|
|
@ -12,9 +12,9 @@ cmp.setup({
|
|
|
|
|
snippet = {
|
|
|
|
|
-- REQUIRED - you must specify a snippet engine
|
|
|
|
|
expand = function(args)
|
|
|
|
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
|
|
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
|
|
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
|
|
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
|
|
|
require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
|
|
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
@ -25,30 +25,40 @@ cmp.setup({
|
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
|
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
|
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
|
|
|
if vim.fn["vsnip#jumpable"](1) == 1 then
|
|
|
|
|
feedkey("<Plug>(vsnip-jump-next)", "")
|
|
|
|
|
elseif cmp.visible() then
|
|
|
|
|
cmp.select_next_item()
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
if require'snippy'.can_expand_or_advance() then
|
|
|
|
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
|
|
|
|
else
|
|
|
|
|
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
|
|
|
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
|
|
|
|
end
|
|
|
|
|
elseif require'snippy'.can_expand_or_advance() then
|
|
|
|
|
require'snippy'.expand_or_advance()
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end, { "i", "s" }),
|
|
|
|
|
|
|
|
|
|
['<S-Tab>'] = cmp.mapping(function()
|
|
|
|
|
if vim.fn["vsnip#jumpable"](1) == 1 then
|
|
|
|
|
feedkey("<Plug>(vsnip-jump-next)", "")
|
|
|
|
|
elseif cmp.visible() then
|
|
|
|
|
cmp.select_next_item()
|
|
|
|
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
if require'snippy'.can_expand_or_advance() then
|
|
|
|
|
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
|
|
|
|
|
else
|
|
|
|
|
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
|
|
|
|
end
|
|
|
|
|
elseif require'snippy'.can_jump(-1) then
|
|
|
|
|
require'snippy'.previous()
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end, { "i", "s" }),
|
|
|
|
|
}),
|
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
|
{ name = 'path' },
|
|
|
|
|
{ name = 'vsnip' }, -- For vsnip users.
|
|
|
|
|
-- { name = 'vsnip' }, -- For vsnip users.
|
|
|
|
|
-- { name = 'luasnip' }, -- For luasnip users.
|
|
|
|
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
|
|
|
|
-- { name = 'snippy' }, -- For snippy users.
|
|
|
|
|
{ name = 'snippy' }, -- For snippy users.
|
|
|
|
|
}, {
|
|
|
|
|
{ name = 'buffer' },
|
|
|
|
|
})
|
|
|
|
@ -104,7 +114,7 @@ require("mason").setup {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
require("mason-lspconfig").setup {
|
|
|
|
|
ensure_installed = { "pyright", "texlab", "clangd", "bashls", "cmake", "jsonls", "tsserver", "vuels", "dockerls", "vimls", "html", "yamlls", "cssls", "lua_ls", "ltex", "gopls", "rust_analyzer", "jdtls"},
|
|
|
|
|
ensure_installed = { "pyright", "texlab", "clangd", "bashls", "cmake", "jsonls", "tsserver", "vuels", "dockerls", "vimls", "html", "yamlls", "cssls", "lua_ls", "ltex", "gopls", "rust_analyzer", "jdtls", "emmet_ls" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require('lspconfig').pyright.setup {
|
|
|
|
@ -179,6 +189,18 @@ require('lspconfig').html.setup {
|
|
|
|
|
capabilities = capabilities
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require('lspconfig').emmet_ls.setup({
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
|
|
|
|
|
init_options = {
|
|
|
|
|
html = {
|
|
|
|
|
options = {
|
|
|
|
|
["bem.enabled"] = true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
require('lspconfig').yamlls.setup {
|
|
|
|
|
capabilities = capabilities
|
|
|
|
|
}
|
|
|
|
|