diff options
Diffstat (limited to 'lua/conf/plugins')
-rw-r--r-- | lua/conf/plugins/dap.lua | 20 | ||||
-rw-r--r-- | lua/conf/plugins/gitsigns.lua | 3 | ||||
-rw-r--r-- | lua/conf/plugins/harpoon.lua | 8 | ||||
-rw-r--r-- | lua/conf/plugins/hml.lua | 5 | ||||
-rw-r--r-- | lua/conf/plugins/leetcode.lua | 17 | ||||
-rw-r--r-- | lua/conf/plugins/lspconfig.lua | 2 | ||||
-rw-r--r-- | lua/conf/plugins/luasnip.lua | 20 | ||||
-rw-r--r-- | lua/conf/plugins/neogen.lua | 3 | ||||
-rw-r--r-- | lua/conf/plugins/oil.lua | 3 | ||||
-rw-r--r-- | lua/conf/plugins/refactoring.lua | 9 | ||||
-rw-r--r-- | lua/conf/plugins/telescope.lua | 3 | ||||
-rw-r--r-- | lua/conf/plugins/todo-comments.lua | 3 | ||||
-rw-r--r-- | lua/conf/plugins/treesitter-context.lua | 10 | ||||
-rw-r--r-- | lua/conf/plugins/treesitter.lua | 12 | ||||
-rw-r--r-- | lua/conf/plugins/treesj.lua | 5 | ||||
-rw-r--r-- | lua/conf/plugins/undotree.lua | 3 |
16 files changed, 53 insertions, 73 deletions
diff --git a/lua/conf/plugins/dap.lua b/lua/conf/plugins/dap.lua index afa9f29..3765350 100644 --- a/lua/conf/plugins/dap.lua +++ b/lua/conf/plugins/dap.lua @@ -1,18 +1,4 @@ -local misc = require("core.misc") -local map = misc.map - ---- select a program to execute ----@return thread coroutine containing the picker -local function select_program() - return coroutine.create(function(coro) - ---@diagnostic disable-next-line: param-type-mismatch - local entries = vim.fn.readdir(".", [[v:val !~ '^\.']]) - vim.ui.select(entries, { prompt = "Select the executable to run:" }, - function(choice) - coroutine.resume(coro, choice) - end) - end) -end +local map = core.misc.map local keymap_restore = {} --- make the default hover binding work for nvim-dap instead of lsp @@ -66,7 +52,9 @@ return { "mfussenegger/nvim-dap", name = "Launch file", type = "codelldb", request = "launch", - program = select_program, + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd()..'/', 'file') + end, cwd = "${workspaceFolder}", stopOnEntry = false diff --git a/lua/conf/plugins/gitsigns.lua b/lua/conf/plugins/gitsigns.lua index b420746..40e19c1 100644 --- a/lua/conf/plugins/gitsigns.lua +++ b/lua/conf/plugins/gitsigns.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map return { "lewis6991/gitsigns.nvim", disable = not vim.fn.has("nvim-0.9.0"), diff --git a/lua/conf/plugins/harpoon.lua b/lua/conf/plugins/harpoon.lua index 5bb02d0..06a00ff 100644 --- a/lua/conf/plugins/harpoon.lua +++ b/lua/conf/plugins/harpoon.lua @@ -1,5 +1,7 @@ -local misc = require("core.misc") -local map = misc.map +-- TODO: might end up writing my own because I like harpoon, but I hate that it +-- doesn't work properly without being pinned to a specific commit + +local map = core.misc.map return { "ThePrimeagen/harpoon", disable = not vim.fn.has("nvim-0.8.0"), @@ -14,7 +16,7 @@ return { "ThePrimeagen/harpoon", map("n", "<leader>a", function() harpoon:list():add() vim.notify("added "..vim.fn.expand("%:t").." to quickmarks", - vim.log.levels.INFO, { title = misc.appid }) + vim.log.levels.INFO, { title = core.misc.appid }) end, { desc = "add current file to quickmarks" }) map("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) diff --git a/lua/conf/plugins/hml.lua b/lua/conf/plugins/hml.lua deleted file mode 100644 index 8c605c4..0000000 --- a/lua/conf/plugins/hml.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { "mawkler/hml.nvim", - function() - require("hml").setup {} - end -} diff --git a/lua/conf/plugins/leetcode.lua b/lua/conf/plugins/leetcode.lua deleted file mode 100644 index 9276295..0000000 --- a/lua/conf/plugins/leetcode.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { "kawre/leetcode.nvim", - requires = { - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - "MunifTanjim/nui.nvim", - "nvim-treesitter/nvim-treesitter" - }, - config = function() - -- because we"re using treesitter make sure to install the html parser - vim.cmd("TSUpdate html") - end, - function() - require("leetcode").setup { - lang = "java" - } - end -} diff --git a/lua/conf/plugins/lspconfig.lua b/lua/conf/plugins/lspconfig.lua index b7f2cde..f2a3250 100644 --- a/lua/conf/plugins/lspconfig.lua +++ b/lua/conf/plugins/lspconfig.lua @@ -5,7 +5,7 @@ return { "neovim/nvim-lspconfig", "mason-org/mason-lspconfig.nvim" }, function() - require("core.lsp.functions").setup() + core.lsp.setup() require("mason-lspconfig").setup { ensure_added = { "clangd", diff --git a/lua/conf/plugins/luasnip.lua b/lua/conf/plugins/luasnip.lua index 7385af1..fc6b2e4 100644 --- a/lua/conf/plugins/luasnip.lua +++ b/lua/conf/plugins/luasnip.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map, auto = core.misc.map, core.misc.auto return { "L3MON4D3/LuaSnip", branch = "v2.4.0", @@ -55,14 +54,21 @@ return { "L3MON4D3/LuaSnip", end end) - -- load all snippets from snippet directory + -- collect all snippets and add them when in the correct file type for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do local fn = file:gsub("^.*/", ""):gsub("%.lua$", "") - local ret = misc.include("snippets."..fn) - if type(ret) ~= "boolean" then - luasnip.add_snippets(fn, ret, { key = fn }) - end + + auto("FileType", { + pattern = fn, + once = true, + callback = function() + local ret = require("snippets."..fn) + if type(ret) ~= "boolean" then + luasnip.add_snippets(fn, ret, { key = fn }) + end + end + }) end end } diff --git a/lua/conf/plugins/neogen.lua b/lua/conf/plugins/neogen.lua index 1a670df..f7afbcf 100644 --- a/lua/conf/plugins/neogen.lua +++ b/lua/conf/plugins/neogen.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map return { "danymat/neogen", requires = { diff --git a/lua/conf/plugins/oil.lua b/lua/conf/plugins/oil.lua index 62f452b..76c41c5 100644 --- a/lua/conf/plugins/oil.lua +++ b/lua/conf/plugins/oil.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map -- helper function to parse output local function parse_output(proc) diff --git a/lua/conf/plugins/refactoring.lua b/lua/conf/plugins/refactoring.lua new file mode 100644 index 0000000..fb4a9d7 --- /dev/null +++ b/lua/conf/plugins/refactoring.lua @@ -0,0 +1,9 @@ +return { "ThePrimeagen/refactoring.nvim", + requires = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter" + }, + function() + require('refactoring').setup {} + end +} diff --git a/lua/conf/plugins/telescope.lua b/lua/conf/plugins/telescope.lua index b6909b4..1c29d87 100644 --- a/lua/conf/plugins/telescope.lua +++ b/lua/conf/plugins/telescope.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map --- get the root directory for telescope to search ---@return string the root directory diff --git a/lua/conf/plugins/todo-comments.lua b/lua/conf/plugins/todo-comments.lua index 24eccd0..bda84ef 100644 --- a/lua/conf/plugins/todo-comments.lua +++ b/lua/conf/plugins/todo-comments.lua @@ -1,3 +1,6 @@ +-- TODO: gotta rewrite this cause it's actual dogshit, and I don't want to deal +-- with nerd fonts or folke anymore also add support for TODO(name): + return { "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim", disable = not vim.fn.has("nvim-0.8.0"), diff --git a/lua/conf/plugins/treesitter-context.lua b/lua/conf/plugins/treesitter-context.lua new file mode 100644 index 0000000..35452b6 --- /dev/null +++ b/lua/conf/plugins/treesitter-context.lua @@ -0,0 +1,10 @@ +return { "nvim-treesitter/nvim-treesitter-context", + requires = "nvim-treesitter/nvim-treesitter", + function() + require("treesitter-context").setup { + max_lines = 2, + line_numbers = true, + trim_scope = 'inner' + } + end +} diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index 4354953..17893b3 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -1,12 +1,3 @@ -table.contains = function(self, string) - for _, v in pairs(self) do - if v == string then - return true - end - end - return false -end - return { "nvim-treesitter/nvim-treesitter", disable = not vim.fn.has("nvim-0.10.0"), config = function() @@ -47,8 +38,7 @@ return { "nvim-treesitter/nvim-treesitter", end -- disable in big files - -- TODO: update before nvim 1.0 when vim.loop is removed - local ok, stats = pcall(vim.loop.fs_stat, + local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf)) if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then return true diff --git a/lua/conf/plugins/treesj.lua b/lua/conf/plugins/treesj.lua index 424c677..ebd4953 100644 --- a/lua/conf/plugins/treesj.lua +++ b/lua/conf/plugins/treesj.lua @@ -1,12 +1,11 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map return { "Wansmer/treesj", disable = not vim.fn.has("nvim-0.9.0"), requires = "nvim-treesitter/nvim-treesitter", function() require("treesj").setup { - use_default_keymaps = false, + use_default_keymaps = false } map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" }) diff --git a/lua/conf/plugins/undotree.lua b/lua/conf/plugins/undotree.lua index fa57def..cdd0a7c 100644 --- a/lua/conf/plugins/undotree.lua +++ b/lua/conf/plugins/undotree.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map = misc.map +local map = core.misc.map return { "mbbill/undotree", function() |