From 5750b2b540318a13cfcab71937ca826d243f905d Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Fri, 6 Dec 2024 20:22:33 -0300 Subject: [PATCH] feat: ide features, auto-completetion --- lua/dot013/plugins/ide.lua | 67 +++++++++++++++++++++++++++++++++++++ lua/dot013/plugins/init.lua | 1 + neovim.nix | 4 +++ 3 files changed, 72 insertions(+) create mode 100644 lua/dot013/plugins/ide.lua diff --git a/lua/dot013/plugins/ide.lua b/lua/dot013/plugins/ide.lua new file mode 100644 index 0000000..1e541d3 --- /dev/null +++ b/lua/dot013/plugins/ide.lua @@ -0,0 +1,67 @@ +return { + { + "blink-cmp", + event = "InsertEnter", + dep_of = { "nvim-lspconfig" }, + after = function() + require("blink.cmp").setup({ + completion = { + list = { + selection = "auto_insert", + }, + }, + documentation = { + auto_show = true, + }, + keymap = { + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "hide", "fallback" }, + + [""] = { "accept", "fallback" }, + + [""] = { "select_next", "snippet_forward", "fallback" }, + [""] = { "select_prev", "snippet_backward", "fallback" }, + + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + }, + snippets = { + expand = function(snippet) + require("luasnip").lsp_expand(snippet) + end, + active = function(filter) + if filter and filter.direction then + require("luasnip").jumpable(filter.direction) + end + return require("luasnip").in_snippet() + end, + jump = function(direction) + require("luasnip").jump(direction) + end, + }, + sources = { + completion = { + enabled_providers = { + "lsp", + "path", + "snippets", + "buffer", + }, + }, + }, + }) + end, + }, + { + "luasnip", + dep_of = { "blink-cmp" }, + after = function() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip").setup() + end, + }, + { "friendly-snippets", dep_of = { "luasnip" } }, +} diff --git a/lua/dot013/plugins/init.lua b/lua/dot013/plugins/init.lua index f44c1a8..c16d908 100644 --- a/lua/dot013/plugins/init.lua +++ b/lua/dot013/plugins/init.lua @@ -1,6 +1,7 @@ return { { import = "dot013.plugins.appearance" }, { import = "dot013.plugins.debugger" }, + { import = "dot013.plugins.ide" }, { import = "dot013.plugins.lsp" }, { import = "dot013.plugins.navigation" }, { import = "dot013.plugins.treesitter" }, diff --git a/neovim.nix b/neovim.nix index 77f0d61..b1c1ec6 100644 --- a/neovim.nix +++ b/neovim.nix @@ -16,6 +16,7 @@ nvim-treesitter.withAllGrammars nvim-treesitter-textobjects nvim-treesitter-textsubjects + (vimUtils.buildVimPlugin { name = "dot013.nvim"; src = ./.; @@ -24,8 +25,11 @@ optPlugins = with pkgs; with pkgs.vimPlugins; [ + blink-cmp + friendly-snippets harpoon2 lualine-nvim + luasnip marks-nvim nvim-dap nvim-dap-go