diff options
Diffstat (limited to 'nvim/after/plugin')
-rw-r--r-- | nvim/after/plugin/harpoon.lua | 12 | ||||
-rw-r--r-- | nvim/after/plugin/lsp.lua | 2 | ||||
-rw-r--r-- | nvim/after/plugin/luasnip.lua | 46 | ||||
-rw-r--r-- | nvim/after/plugin/neotest-python.lua | 28 |
4 files changed, 75 insertions, 13 deletions
diff --git a/nvim/after/plugin/harpoon.lua b/nvim/after/plugin/harpoon.lua deleted file mode 100644 index 4a6ba87..0000000 --- a/nvim/after/plugin/harpoon.lua +++ /dev/null @@ -1,12 +0,0 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") - -vim.keymap.set("n", "<leader>a", mark.add_file) -vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) - -vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end) -vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end) -vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end) -vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end) - - diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua index e644f74..c54e03b 100644 --- a/nvim/after/plugin/lsp.lua +++ b/nvim/after/plugin/lsp.lua @@ -35,7 +35,7 @@ lsp.setup_nvim_cmp({ }) lsp.set_preferences({ - suggest_lsp_servers = false, + suggest_lsp_servers = true, sign_icons = { error = 'E', warn = 'W', diff --git a/nvim/after/plugin/luasnip.lua b/nvim/after/plugin/luasnip.lua new file mode 100644 index 0000000..6ff1131 --- /dev/null +++ b/nvim/after/plugin/luasnip.lua @@ -0,0 +1,46 @@ +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local luasnip = require("luasnip") +local cmp = require("cmp") + +cmp.setup({ + + -- ... Your other configuration ... + + mapping = { + + -- ... Your other mappings ... + + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + + -- ... Your other mappings ... + }, + + -- ... Your other configuration ... +}) diff --git a/nvim/after/plugin/neotest-python.lua b/nvim/after/plugin/neotest-python.lua new file mode 100644 index 0000000..9df429d --- /dev/null +++ b/nvim/after/plugin/neotest-python.lua @@ -0,0 +1,28 @@ +require("neotest").setup({ + adapters = { + require("neotest-python")({ + -- Extra arguments for nvim-dap configuration + -- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values + dap = { justMyCode = false }, + -- Command line arguments for runner + -- Can also be a function to return dynamic values + args = {"--log-level", "DEBUG"}, + -- Runner to use. Will use pytest if available by default. + -- Can be a function to return dynamic value. + runner = "pytest", + -- Custom python path for the runner. + -- Can be a string or a list of strings. + -- Can also be a function to return dynamic value. + -- If not provided, the path will be inferred by checking for + -- virtual envs in the local directory and for Pipenev/Poetry configs + python = ".venv/bin/python", + -- Returns if a given file path is a test file. + -- NB: This function is called a lot so don't perform any heavy tasks within it. + }) + } +}) + +require("neodev").setup({ + library = { plugins = { "neotest" }, types = true }, + ... +}) |