diff --git a/lua/teeja/lazy/conjure.lua b/lua/teeja/lazy/conjure.lua new file mode 100644 index 0000000..a80f6ef --- /dev/null +++ b/lua/teeja/lazy/conjure.lua @@ -0,0 +1 @@ +return { "Olical/conjure" } diff --git a/lua/teeja/lazy/lsp.lua b/lua/teeja/lazy/lsp.lua index c01f5e4..ca1d3c0 100644 --- a/lua/teeja/lazy/lsp.lua +++ b/lua/teeja/lazy/lsp.lua @@ -1,22 +1,43 @@ return { { - 'VonHeikemen/lsp-zero.nvim', branch = 'v3.x', + 'VonHeikemen/lsp-zero.nvim', branch = 'v4.x', dependencies = { - "neovim/nvim-lspconfig", "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", - "hrsh7th/cmp-nvim-lsp", + "neovim/nvim-lspconfig", + "L3MON4D3/LuaSnip", "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", - "L3MON4D3/LuaSnip" + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", }, config = function() local lsp_zero = require('lsp-zero') - lsp_zero.extend_lspconfig() - lsp_zero.on_attach(function(client, bufnr) - lsp_zero.default_keymaps({buffer = bufnr}) - end) + + local lsp_attach = function(client, bufnr) + local opts = {buffer = bufnr} + + vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) + vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) + vim.keymap.set({'n', 'x'}, '', 'lua vim.lsp.buf.format({async = true})', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) + end + + lsp_zero.extend_lspconfig({ + sign_text = true, + lsp_attach = lsp_attach, + float_border = 'rounded', + capabilities = require('cmp_nvim_lsp').default_capabilities() + }) require("mason").setup() require("mason-lspconfig").setup { @@ -30,42 +51,58 @@ return { "html", "dockerls", "docker_compose_language_service", - "intelephense" - } - } - require("mason-lspconfig").setup_handlers { - function (server_name) - require("lspconfig")[server_name].setup ({}) - end, + "intelephense", + "clojure_lsp" + }; + + handlers = { + function(server_name) + require('lspconfig')[server_name].setup({}) + end, + } } local cmp = require('cmp') local cmp_action = lsp_zero.cmp_action() + -- this is the function that loads the extra snippets + -- from rafamadriz/friendly-snippets + require('luasnip.loaders.from_vscode').lazy_load() + cmp.setup({ - mapping = cmp.mapping.preset.insert({ - -- `Enter` key to confirm completion - [''] = cmp.mapping.confirm({select = false}), - - -- Ctrl+Space to trigger completion menu - [''] = cmp.mapping.complete(), - - -- Navigate between snippet placeholder - [''] = cmp_action.luasnip_jump_forward(), - [''] = cmp_action.luasnip_jump_backward(), - - -- Scroll up and down in the completion documentation - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - }), + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'luasnip', keyword_length = 2}, + {name = 'buffer', keyword_length = 3}, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, - sources = { - { name = 'path' } - } + mapping = cmp.mapping.preset.insert({ + -- confirm completion item + [''] = cmp.mapping.confirm({ select = true }), + + -- trigger completion menu + [''] = cmp.mapping.complete(), + + -- scroll up and down the documentation window + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- navigate between snippet placeholders + [''] = cmp_action.luasnip_jump_forward(), + [''] = cmp_action.luasnip_jump_backward(), + }), + -- note: if you are going to use lsp-kind (another plugin) + -- replace the line below with the function from lsp-kind + formatting = lsp_zero.cmp_format({details = true}), }) end } diff --git a/lua/teeja/lazy/treesitter.lua b/lua/teeja/lazy/treesitter.lua index 3b71287..254dc53 100644 --- a/lua/teeja/lazy/treesitter.lua +++ b/lua/teeja/lazy/treesitter.lua @@ -15,7 +15,8 @@ return { "php", "dockerfile", "yaml", - "toml" + "toml", + "clojure" }, sync_install = false, highlight = { enable = true },