From 3094bf2a3983b375f4adeccd25c3b12bbbded2aa Mon Sep 17 00:00:00 2001 From: Squibid Date: Thu, 17 Apr 2025 11:41:32 -0500 Subject: a lot more stuff --- lua/conf/plugins/cmp.lua | 48 +++++---- lua/conf/plugins/dap-virtual-text.lua | 9 -- lua/conf/plugins/dap.lua | 17 ++-- lua/conf/plugins/dressing.lua | 6 +- lua/conf/plugins/fidget.lua | 3 +- lua/conf/plugins/gitsigns.lua | 2 +- lua/conf/plugins/harpoon.lua | 2 +- lua/conf/plugins/headlines.lua | 9 +- lua/conf/plugins/instant.lua | 5 + lua/conf/plugins/jdtls.lua | 14 +-- lua/conf/plugins/leetcode.lua | 2 +- lua/conf/plugins/lsp_lines.lua | 3 +- lua/conf/plugins/luasnip.lua | 4 +- lua/conf/plugins/mason-lspconfig.lua | 177 ++++++++++++++++++---------------- lua/conf/plugins/mason.lua | 2 +- lua/conf/plugins/mellow.lua | 2 +- lua/conf/plugins/mini-clue.lua | 52 ++++++++++ lua/conf/plugins/neorg.lua | 14 ++- lua/conf/plugins/nvim-colorizer.lua | 2 +- lua/conf/plugins/nyooom.lua | 7 ++ lua/conf/plugins/oil.lua | 160 ++++++++++++++++++++++++++++++ lua/conf/plugins/project.lua | 3 +- lua/conf/plugins/smear.lua | 13 --- lua/conf/plugins/telescope.lua | 16 +-- lua/conf/plugins/todo-comments.lua | 7 +- lua/conf/plugins/treesitter.lua | 4 +- lua/conf/plugins/treesj.lua | 2 +- lua/conf/plugins/ts-autotag.lua | 7 +- 28 files changed, 406 insertions(+), 186 deletions(-) delete mode 100644 lua/conf/plugins/dap-virtual-text.lua create mode 100644 lua/conf/plugins/instant.lua create mode 100644 lua/conf/plugins/mini-clue.lua create mode 100644 lua/conf/plugins/nyooom.lua create mode 100644 lua/conf/plugins/oil.lua delete mode 100644 lua/conf/plugins/smear.lua (limited to 'lua/conf/plugins') diff --git a/lua/conf/plugins/cmp.lua b/lua/conf/plugins/cmp.lua index ebca929..d6d7766 100644 --- a/lua/conf/plugins/cmp.lua +++ b/lua/conf/plugins/cmp.lua @@ -1,14 +1,22 @@ +local lsp = require('core.lsp.functions') + return { 'hrsh7th/nvim-cmp', requires = { 'nvim-treesitter/nvim-treesitter', - 'lukas-reineke/cmp-under-comparator' -- better results + 'lukas-reineke/cmp-under-comparator', -- better results + 'xzbdmw/colorful-menu.nvim' -- fancy colors }, -- suppliers for completions (they require nvim-cmp to be loaded before they are) deps = { 'hrsh7th/cmp-buffer', -- buffers 'FelipeLema/cmp-async-path', -- path - 'hrsh7th/cmp-nvim-lsp', -- lsp + { 'hrsh7th/cmp-nvim-lsp', + function() + -- add lsp capabilities + lsp.add_capabilities(require('cmp_nvim_lsp').default_capabilities()) + end + }, -- lsp 'hrsh7th/cmp-nvim-lsp-signature-help', -- completion information { 'L3MON4D3/cmp-luasnip-choice', -- luasnip requires = 'L3MON4D3/LuaSnip' @@ -19,6 +27,7 @@ return { 'hrsh7th/nvim-cmp', local cmp = require('cmp') local luasnip = require('luasnip') + -- setup cmp cmp.setup { -- disable when in comments enabled = function() @@ -44,8 +53,8 @@ return { 'hrsh7th/nvim-cmp', -- how to sort results sorting = { comparators = { - cmp.config.compare.offset, cmp.config.compare.exact, + cmp.config.compare.offset, cmp.config.compare.score, require('cmp-under-comparator').under, cmp.config.compare.kind, @@ -80,16 +89,24 @@ return { 'hrsh7th/nvim-cmp', formatting = { fields = { 'menu', 'abbr', 'kind' }, format = function(entry, item) + local hl_info = require("colorful-menu").cmp_highlights(entry) local menu_icon = { nvim_lsp = 'λ', - nvim_lua = 'v', luasnip = '%', buffer = '@', path = '#', async_path = '#' } + -- add a little icon item.menu = menu_icon[entry.source.name] + + -- add highlights + if hl_info ~= nil then + item.abbr_hl_group = hl_info.highlights + item.abbr = hl_info.text + end + return item end }, @@ -107,25 +124,14 @@ return { 'hrsh7th/nvim-cmp', -- mappings mapping = cmp.mapping.preset.insert { - [""] = cmp.mapping(function() - cmp.confirm({ select = true }) - end, { "i", "c" }), - - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_next_item() - end - end), - - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_prev_item() - end - end), - + [""] = cmp.mapping.confirm { + select = true + }, + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.close() + [""] = cmp.mapping.close() } } end diff --git a/lua/conf/plugins/dap-virtual-text.lua b/lua/conf/plugins/dap-virtual-text.lua deleted file mode 100644 index 9225272..0000000 --- a/lua/conf/plugins/dap-virtual-text.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { 'theHamsta/nvim-dap-virtual-text', - requires = { - 'mfussenegger/nvim-dap', - 'nvim-treesitter/nvim-treesitter' - }, - function() - require("nvim-dap-virtual-text").setup {} - end -} diff --git a/lua/conf/plugins/dap.lua b/lua/conf/plugins/dap.lua index fdcd152..5fafd92 100644 --- a/lua/conf/plugins/dap.lua +++ b/lua/conf/plugins/dap.lua @@ -4,9 +4,9 @@ local map = misc.map return { 'mfussenegger/nvim-dap', requires = { 'williamboman/mason.nvim', - 'nvim-telescope/telescope.nvim' + 'nvim-telescope/telescope.nvim', }, - disable = vim.version().minor < 8, + disable = not vim.fn.has("nvim-0.8.0"), branch = '0.8.0', function() @@ -38,10 +38,13 @@ return { 'mfussenegger/nvim-dap', } } - map('n', 'ec', dap.continue) - map('n', 'eb', require("dap.breakpoints").toggle) - map('n', 'e]', dap.step_over) - map('n', 'e[', dap.step_back) - map('n', 'eR', dap.restart) + map('n', 'ec', dap.continue, { desc = "dap continue " }) + map('n', 'el', dap.run_last, { desc = "dap run last" }) + map('n', 'et', dap.terminate, { desc = "dap terminate " }) + map('n', 'eb', require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" }) + map('n', 'e]', dap.step_over, { desc = "dap step over" }) + map('n', 'e[', dap.step_back, { desc = "dap step back" }) + map('n', 'er', dap.repl.toggle, { desc = "dap repl toggle" }) + map('n', 'eR', dap.restart, { desc = "dap restart" }) end } diff --git a/lua/conf/plugins/dressing.lua b/lua/conf/plugins/dressing.lua index 36622a6..75e4a44 100644 --- a/lua/conf/plugins/dressing.lua +++ b/lua/conf/plugins/dressing.lua @@ -1,12 +1,12 @@ local branch = nil -if vim.version().minor == 7 then +if vim.fn.has("nvim-0.7.0") then branch = 'nvim-0.7' -elseif vim.version().minor == 5 then +elseif vim.fn.has("nvim-0.5.0") then branch = 'nvim-0.5' end return { 'stevearc/dressing.nvim', - disable = vim.version().minor < 5, + disable = true or not vim.fn.has("nvim-0.5.0"), branch = branch, requires = 'nvim-telescope/telescope.nvim', function() diff --git a/lua/conf/plugins/fidget.lua b/lua/conf/plugins/fidget.lua index 667c905..b4bfbac 100644 --- a/lua/conf/plugins/fidget.lua +++ b/lua/conf/plugins/fidget.lua @@ -1,5 +1,5 @@ return { 'j-hui/fidget.nvim', - disable = vim.version().minor < 9, + disable = not vim.fn.has("nvim-0.9.0"), branch = "v1.5.0", function() local notification_defaults = require("fidget.notification").default_config @@ -16,6 +16,7 @@ return { 'j-hui/fidget.nvim', } }, notification = { + filter = vim.log.levels.DEBUG, override_vim_notify = true, configs = { default = notification_defaults diff --git a/lua/conf/plugins/gitsigns.lua b/lua/conf/plugins/gitsigns.lua index f168b93..a92264e 100644 --- a/lua/conf/plugins/gitsigns.lua +++ b/lua/conf/plugins/gitsigns.lua @@ -2,7 +2,7 @@ local misc = require('core.misc') local map = misc.map return { 'lewis6991/gitsigns.nvim', - disable = vim.version().minor < 9, + disable = not vim.fn.has("nvim-0.9.0"), function() local gs = require("gitsigns") diff --git a/lua/conf/plugins/harpoon.lua b/lua/conf/plugins/harpoon.lua index 9cca238..c26964a 100644 --- a/lua/conf/plugins/harpoon.lua +++ b/lua/conf/plugins/harpoon.lua @@ -2,7 +2,7 @@ local misc = require('core.misc') local map = misc.map return { 'ThePrimeagen/harpoon', - disable = vim.version().minor < 8, + disable = not vim.fn.has("nvim-0.8.0"), commit = 'e76cb03', branch = 'harpoon2', requires = 'nvim-lua/plenary.nvim', diff --git a/lua/conf/plugins/headlines.lua b/lua/conf/plugins/headlines.lua index c932d72..e2dedd6 100644 --- a/lua/conf/plugins/headlines.lua +++ b/lua/conf/plugins/headlines.lua @@ -14,14 +14,7 @@ return { 'lukas-reineke/headlines.nvim', bullets = { "", "", "", "" }, }, markdown = { - headline_highlights = { - "@neorg.headings.1.title", - "@neorg.headings.2.title", - "@neorg.headings.3.title", - "@neorg.headings.4.title", - "@neorg.headings.5.title", - "@neorg.headings.6.title" - } + headline_highlights = false } } end diff --git a/lua/conf/plugins/instant.lua b/lua/conf/plugins/instant.lua new file mode 100644 index 0000000..6866e71 --- /dev/null +++ b/lua/conf/plugins/instant.lua @@ -0,0 +1,5 @@ +return { 'jbyuki/instant.nvim', + function() + vim.g.instant_username = "squibid" + end +} diff --git a/lua/conf/plugins/jdtls.lua b/lua/conf/plugins/jdtls.lua index c847e5a..b6dbd72 100644 --- a/lua/conf/plugins/jdtls.lua +++ b/lua/conf/plugins/jdtls.lua @@ -3,7 +3,7 @@ local lsp = require('core.lsp.functions') local map, auto = misc.map, misc.auto return { 'mfussenegger/nvim-jdtls', - disable = vim.version().minor < 6, + disable = not vim.fn.has("nvim-0.6.0"), requires = 'mfussenegger/nvim-dap', function() auto("FileType", { @@ -34,7 +34,10 @@ return { 'mfussenegger/nvim-jdtls', 'gradlew', '.git', 'mvnw', - 'build.xml' + 'settings.gradle', -- Gradle (multi-project) + 'settings.gradle.kts', -- Gradle (multi-project) + 'build.xml', -- Ant + 'pom.xml', -- Maven }, { upward = true })[1]), -- don't print out status messages @@ -42,10 +45,7 @@ return { 'mfussenegger/nvim-jdtls', ['language/status'] = function() end }, - capabilities = lsp.capabilities(), - on_attach = function(client, bufnr) - lsp.attach(client, bufnr) - + on_attach = function(_, bufnr) -- add some jdtls specific mappings local opts = { buffer = bufnr } map('n', 'cri', jdtls.organize_imports, opts) @@ -64,8 +64,10 @@ return { 'mfussenegger/nvim-jdtls', end }) end, + capabilities = lsp.capabilities } + -- generate the path to the java file(s) ---@type string|nil local cache_path = vim.fs.joinpath(vim.fn.stdpath("cache"), "/JavaVersion.class") ---@type string|nil diff --git a/lua/conf/plugins/leetcode.lua b/lua/conf/plugins/leetcode.lua index bda7c08..7619c84 100644 --- a/lua/conf/plugins/leetcode.lua +++ b/lua/conf/plugins/leetcode.lua @@ -7,7 +7,7 @@ return { 'kawre/leetcode.nvim', }, config = function() -- because we're using treesitter make sure to install the html parser - vim.cmd.TSUpdate("html") + vim.cmd("TSUpdate html") end, function() require('leetcode').setup { diff --git a/lua/conf/plugins/lsp_lines.lua b/lua/conf/plugins/lsp_lines.lua index e28aec8..9ccaa73 100644 --- a/lua/conf/plugins/lsp_lines.lua +++ b/lua/conf/plugins/lsp_lines.lua @@ -1,3 +1,4 @@ return { 'whynothugo/lsp_lines', - url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' + url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', + disable = not vim.fn.has("nvim-0.8.0") } diff --git a/lua/conf/plugins/luasnip.lua b/lua/conf/plugins/luasnip.lua index d881a57..169ec5d 100644 --- a/lua/conf/plugins/luasnip.lua +++ b/lua/conf/plugins/luasnip.lua @@ -3,9 +3,9 @@ local map = misc.map return { 'L3MON4D3/LuaSnip', branch = 'v2.3.0', - disable = vim.version().minor < 7, + disable = not vim.fn.has("nvim-0.7.0"), config = function() - vim.cmd.make('install_jsregexp') + vim.cmd('make install_jsregexp') end, function() local luasnip = require('luasnip') diff --git a/lua/conf/plugins/mason-lspconfig.lua b/lua/conf/plugins/mason-lspconfig.lua index 65c5693..ceedb6c 100644 --- a/lua/conf/plugins/mason-lspconfig.lua +++ b/lua/conf/plugins/mason-lspconfig.lua @@ -1,18 +1,23 @@ local misc = require('core.misc') local lsp = require('core.lsp.functions') -local map, auto, augroup = misc.map, misc.auto, misc.augroup +local map = misc.map return { 'williamboman/mason-lspconfig.nvim', requires = { 'williamboman/mason.nvim', { 'neovim/nvim-lspconfig', - disable = vim.version().minor < 8, + disable = not vim.fn.has("nvim-0.8.0"), function() lsp.setup() end - } + }, + + -- these two update some lsp capabilities and therefore must be run first + -- 'hrsh7th/cmp-nvim-lsp', + -- 'kevinhwang91/nvim-ufo' }, function() + local lspconfig = require('lspconfig') local util = require('lspconfig.util') -- setup language servers @@ -27,97 +32,105 @@ return { 'williamboman/mason-lspconfig.nvim', "bashls", "zls" -- "asm-lsp", -- seems to be broken - } - } - require('mason-lspconfig').setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - on_attach = lsp.lsp_attach, - capabilities = lsp.capabilities() - } - end, + }, + + -- setup all handlers + handlers = { + function(server_name) + lspconfig[server_name].setup {} + end, - -- setup luals - ["lua_ls"] = function(server_name) - local root_files = { '.luarc.json', '.luarc.jsonc', '.luacheckrc', - '.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml', - 'README.md' - } + -- setup luals + ["lua_ls"] = function(server_name) + local root_files = { '.luarc.json', '.luarc.jsonc', '.luacheckrc', + '.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml', + 'README.md' + } - -- FIXME: luals seems to start up twice and sends back twice the - -- completions (one configured with the below settings and one without) - require('lspconfig')[server_name].setup { - on_attach = lsp.attach, - capabilities = lsp.capabilities(), - settings = { - Lua = { - diagnostics = { - globals = { "vim", 'mp' } - }, - runtime = { - version = 'LuaJIT' - }, - format = { - enable = false - }, - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME + -- FIXME: luals seems to start up twice and sends back twice the + -- completions (one configured with the below settings and one without) + lspconfig[server_name].setup { + settings = { + Lua = { + diagnostics = { + globals = { "vim", 'mp' } + }, + runtime = { + version = 'LuaJIT' + }, + format = { + enable = false + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + } } } - } - }, + }, - root_dir = function(fname) - local root = util.root_pattern(unpack(root_files))(fname) - if root and root ~= vim.env.HOME then - return root - end + root_dir = function(fname) + local root = util.root_pattern(unpack(root_files))(fname) + if root and root ~= vim.env.HOME then + return root + end - root = util.root_pattern('lua/')(fname) - if root then - return root + root = util.root_pattern('lua/')(fname) + if root then + return root + end + return util.find_git_ancestor(fname) end - return util.find_git_ancestor(fname) - end - } - end, - - -- setup clangd - ["clangd"] = function(server_name) - require('lspconfig')[server_name].setup { - on_attach = function(client, bufnr) - lsp.attach(client, bufnr) + } + end, - -- add some clangd specific mappings - local opts = { buffer = bufnr } - map("n", "o", "ClangdSwitchSourceHeader", opts) - end, - capabilities = lsp.capabilities(), + -- setup clangd + ["clangd"] = function(server_name) + lspconfig[server_name].setup { + on_attach = function(client, bufnr) + -- add some clangd specific mappings + local opts = { buffer = bufnr } + map("n", "o", "ClangdSwitchSourceHeader", opts) + end, - cmd = { - "clangd", - "--background-index", - "--clang-tidy", - "--header-insertion=iwyu", - "--completion-style=detailed", - "--function-arg-placeholders", - "--fallback-style=llvm" - }, - init_options = { - usePlaceholders = true, - clangdFileStatus = true, - fallback_flags = { - "-xc" -- makes clangd think we're using c instead of c++ + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=llvm" + }, + init_options = { + usePlaceholders = true, + clangdFileStatus = true, + fallback_flags = { + "-xc" -- makes clangd think we're using c instead of c++ + } } } - } - end, + end, - -- disable it, we start this using nvim-jdtls - ["jdtls"] = function(_) end - } + -- disable it, we start this using nvim-jdtls + ["jdtls"] = function(_) end, + -- setup basedpyright + ["basedpyright"] = function(server_name) + lspconfig[server_name].setup { + on_attach = function(client, bufnr) + -- add some basedpyright specific mappings + local opts = { buffer = bufnr } + map("n", "cri", "PyrightOrganizeImports", opts) + end, + } + end + }, + + ["openscad_lsp"] = function(server_name) + lspconfig[server_name].setup {} + end + } end } diff --git a/lua/conf/plugins/mason.lua b/lua/conf/plugins/mason.lua index b3eeacf..87e66a9 100644 --- a/lua/conf/plugins/mason.lua +++ b/lua/conf/plugins/mason.lua @@ -1,5 +1,5 @@ return { 'williamboman/mason.nvim', - disable = vim.version().minor < 7, + disable = not vim.fn.has("nvim-0.7.0"), function() local mason = require('mason') diff --git a/lua/conf/plugins/mellow.lua b/lua/conf/plugins/mellow.lua index 11103ae..02bf7fd 100644 --- a/lua/conf/plugins/mellow.lua +++ b/lua/conf/plugins/mellow.lua @@ -1,5 +1,5 @@ return { 'mellow-theme/mellow.nvim', - disable = vim.version().minor < 8, + disable = not vim.fn.has("nvim-0.8.0"), requires = 'nvim-treesitter/nvim-treesitter', function() vim.g.mellow_variant = "dark" diff --git a/lua/conf/plugins/mini-clue.lua b/lua/conf/plugins/mini-clue.lua new file mode 100644 index 0000000..e2c3fa0 --- /dev/null +++ b/lua/conf/plugins/mini-clue.lua @@ -0,0 +1,52 @@ +return { 'echasnovski/mini.clue', + disable = true, + -- disable = not vim.fn.has("nvim-0.9.0"), + branch = "stable", + function() + local miniclue = require('mini.clue') + miniclue.setup({ + triggers = { + -- Leader triggers + { mode = 'n', keys = '' }, + { mode = 'x', keys = '' }, + + -- Built-in completion + { mode = 'i', keys = '' }, + + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'x', keys = 'g' }, + + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'x', keys = "'" }, + { mode = 'x', keys = '`' }, + + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'x', keys = '"' }, + { mode = 'i', keys = '' }, + { mode = 'c', keys = '' }, + + -- Window commands + { mode = 'n', keys = '' }, + + -- `z` key + { mode = 'n', keys = 'z' }, + { mode = 'x', keys = 'z' }, + }, + + clues = { + -- Enhance this by adding descriptions for mapping groups + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, + }) + + end +} diff --git a/lua/conf/plugins/neorg.lua b/lua/conf/plugins/neorg.lua index f0fec2f..84a0b79 100644 --- a/lua/conf/plugins/neorg.lua +++ b/lua/conf/plugins/neorg.lua @@ -8,7 +8,12 @@ -- dependencies take a look at the build.lua for versioning info. Also make sure -- to check the release notes on github for info on breaking changes. -local workspace_cache = vim.fs.joinpath(vim.fn.stdpath("data"), "neorg-workspace-cache.lua") +local workspace_cache +if not vim.fs then + workspace_cache = vim.fn.stdpath("data").."/neorg-workspace-cache.lua" +else + workspace_cache = vim.fs.joinpath(vim.fn.stdpath("data"), "neorg-workspace-cache.lua") +end --- populate neorg workspaces from path or cache ---@param path string path to populate workspaces from @@ -57,8 +62,8 @@ local function populate_workspaces(path, cache) end return { 'nvim-neorg/neorg', - disable = vim.version.lt(vim.version(), { 0, 10, 0 }), - branch = 'v9.1.1', + disable = not vim.fn.has("nvim-0.10.0"), + branch = 'v9.3.0', requires = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter', @@ -69,7 +74,8 @@ return { 'nvim-neorg/neorg', }, -- NOTE: these are usually installed by neorg via luarocks, the versions - -- were picked based on the build.lua found in the root of the neorg repo + -- were picked based on the neorg-scm-1.rockspec found in the root of the + -- neorg repo { 'nvim-neotest/nvim-nio', branch = 'v1.7.0' }, diff --git a/lua/conf/plugins/nvim-colorizer.lua b/lua/conf/plugins/nvim-colorizer.lua index 91cffd1..91fac13 100644 --- a/lua/conf/plugins/nvim-colorizer.lua +++ b/lua/conf/plugins/nvim-colorizer.lua @@ -1,5 +1,5 @@ return { 'norcalli/nvim-colorizer.lua', - disable = vim.version().minor < 4 and not vim.fn.has("termguicolors"), + disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"), function() require('colorizer').setup(nil, { names = false, diff --git a/lua/conf/plugins/nyooom.lua b/lua/conf/plugins/nyooom.lua new file mode 100644 index 0000000..c6da17a --- /dev/null +++ b/lua/conf/plugins/nyooom.lua @@ -0,0 +1,7 @@ +return { 'squibid/nyooom', + url = 'https://git.squi.bid/nyooom', + pin = true, + function() + require('nyooom').setup {} + end +} diff --git a/lua/conf/plugins/oil.lua b/lua/conf/plugins/oil.lua new file mode 100644 index 0000000..5eeac4d --- /dev/null +++ b/lua/conf/plugins/oil.lua @@ -0,0 +1,160 @@ +local misc = require('core.misc') +local map = misc.map + +local permission_hlgroups = { + ['-'] = 'NonText', + ['r'] = 'DiagnosticSignWarn', + ['w'] = 'DiagnosticSignHint', + ['x'] = 'DiagnosticSignOk', +} + +return { 'stevearc/oil.nvim', + disable = not vim.fn.has("nvim-0.8.0"), + function() + require("oil").setup { + -- ID is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + { + "permissions", + highlight = function(permission_str) + local hls = {} + for i = 1, #permission_str do + local char = permission_str:sub(i, i) + table.insert(hls, { permission_hlgroups[char], i - 1, i }) + end + return hls + end, + }, + { "size", highlight = '@number' } + }, + + -- Window-local options to use for oil buffers + win_options = { + number = false, + relativenumber = false, + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic" + }, + + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + lsp_file_methods = { + -- Enable or disable LSP file operations + enabled = true, + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = "unmodified" + }, + + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + + -- Set to true to watch the filesystem for changes and reload oil + watch_for_changes = false, + + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = { "actions.show_help", mode = "n" }, + [""] = "actions.refresh", + [""] = "actions.select", + ["-"] = { "actions.parent", mode = "n" }, + ["_"] = { "actions.open_cwd", mode = "n" }, + ["`"] = { "actions.cd", mode = "n" }, + ["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" }, + ["gs"] = { "actions.change_sort", mode = "n" }, + ["gx"] = "actions.open_external", + ["g."] = { "actions.toggle_hidden", mode = "n" }, + ["g\\"] = { "actions.toggle_trash", mode = "n" } + }, + + view_options = { + -- Show files and directories that start with "." + show_hidden = false, + + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + if name == ".." then -- show previous directory + return false + end + local m = name:match("^%.") + return m ~= nil + end, + + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + + -- Sort file names with numbers in a more intuitive order for humans. + -- Can be "fast", true, or false. "fast" will turn it off for large directories. + natural_order = "fast", + + -- Sort file and directory names case insensitive + case_insensitive = false, + + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + + -- Customize the highlight group for the file name + highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan) + return nil + end, + }, + + -- Configuration for the floating window in oil.open_float + float = { + border = "solid" + }, + + -- Configuration for the floating action confirmation window + confirmation = { + border = "solid" + }, + -- Configuration for the floating progress window + progress = { + border = "solid" + }, + -- Configuration for the floating SSH window + ssh = { + border = "solid" + }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "solid" + } + } + + map('n', '-', 'Oil') + end +} diff --git a/lua/conf/plugins/project.lua b/lua/conf/plugins/project.lua index 5ef820b..1075e4c 100644 --- a/lua/conf/plugins/project.lua +++ b/lua/conf/plugins/project.lua @@ -1,5 +1,6 @@ return { 'ahmedkhalf/project.nvim', - disable = vim.version().minor < 5, + disable = true, + -- disable = vim.fn.has("nvim-0.5.0"), function() require('project_nvim').setup { patterns = { diff --git a/lua/conf/plugins/smear.lua b/lua/conf/plugins/smear.lua deleted file mode 100644 index 4e0e051..0000000 --- a/lua/conf/plugins/smear.lua +++ /dev/null @@ -1,13 +0,0 @@ --- yea it's a bit flashy, but it's genuenly useful to be able to tell where my --- cursor has gone -return { 'sphamba/smear-cursor.nvim', - disable = vim.version.lt(vim.version(), { 0, 10, 2 }) or vim.g.neovide_version, - function() - require('smear_cursor').setup { - stiffness = 0.8, -- 0.6 [0, 1] - trailing_stiffness = 0.5, -- 0.3 [0, 1] - distance_stop_animating = 0.5, -- 0.1 > 0 - hide_target_hack = false -- true boolean - } - end -} diff --git a/lua/conf/plugins/telescope.lua b/lua/conf/plugins/telescope.lua index 597fbe3..b08d65d 100644 --- a/lua/conf/plugins/telescope.lua +++ b/lua/conf/plugins/telescope.lua @@ -2,12 +2,12 @@ local misc = require('core.misc') local map = misc.map return { 'nvim-telescope/telescope.nvim', - disable = vim.version().minor < 9, + disable = not vim.fn.has("nvim-0.9.0"), requires = { 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', config = function() - vim.cmd.make() + vim.cmd("make") end } }, @@ -48,14 +48,8 @@ return { 'nvim-telescope/telescope.nvim', [""] = actions.close, [''] = actions.move_selection_next, [''] = actions.move_selection_previous, - [''] = actions.select_default, [''] = actions.preview_scrolling_up, [''] = actions.preview_scrolling_down, - [""] = action_layout.toggle_preview - }, - n = { - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, } } }, @@ -77,7 +71,7 @@ return { 'nvim-telescope/telescope.nvim', desc = 'Find string in current buffer.', }) map('n', 'i', telebuilt.help_tags, { - desc = 'Fuzzy find over help tags.', + desc = 'find help tags.', }) -- find over specific directories @@ -85,12 +79,12 @@ return { 'nvim-telescope/telescope.nvim', require('telescope.builtin').find_files { cwd = vim.fn.stdpath("config") } - end, { desc = "Fuzzy find over files in my config" }) + end, { desc = "find config files" }) map('n', 'tp', function() require('telescope.builtin').find_files { cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt") } - end, { desc = "Fuzzy find over files in my plugin directory" }) + end, { desc = "find files in plugin directory" }) -- enable previewing in the default colorscheme switcher telebuilt.colorscheme = function() diff --git a/lua/conf/plugins/todo-comments.lua b/lua/conf/plugins/todo-comments.lua index 55ebd32..ebf724d 100644 --- a/lua/conf/plugins/todo-comments.lua +++ b/lua/conf/plugins/todo-comments.lua @@ -1,11 +1,6 @@ -local branch = nil -if vim.version().minor < 8 then - branch = 'neovim-pre-0.8.0' -end - return { 'folke/todo-comments.nvim', requires = 'nvim-lua/plenary.nvim', - branch = branch, + disable = not vim.fn.has("nvim-0.8.0"), function() require('todo-comments').setup { keywords = { diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index 4f010d9..b18ae49 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -8,9 +8,9 @@ table.contains = function(self, string) end return { 'nvim-treesitter/nvim-treesitter', - disable = vim.version().minor < 10, + disable = not vim.fn.has("nvim-0.10.0"), config = function() - vim.cmd.TSUpdate() + vim.cmd("TSUpdate") end, function() require('nvim-treesitter.configs').setup { diff --git a/lua/conf/plugins/treesj.lua b/lua/conf/plugins/treesj.lua index 8ec65d4..4b3bae1 100644 --- a/lua/conf/plugins/treesj.lua +++ b/lua/conf/plugins/treesj.lua @@ -2,7 +2,7 @@ local misc = require('core.misc') local map = misc.map return { 'Wansmer/treesj', - disable = vim.version().minor < 9, + disable = not vim.fn.has("nvim-0.9.0"), requires = 'nvim-treesitter/nvim-treesitter', function() require('treesj').setup { diff --git a/lua/conf/plugins/ts-autotag.lua b/lua/conf/plugins/ts-autotag.lua index 001dd0a..915ddad 100644 --- a/lua/conf/plugins/ts-autotag.lua +++ b/lua/conf/plugins/ts-autotag.lua @@ -1,6 +1,9 @@ return { 'windwp/nvim-ts-autotag', - requires = 'nvim-telescope/telescope.nvim', - disable = vim.version.lt(vim.version(), { 0, 9, 5 }), + requires = { + 'nvim-telescope/telescope.nvim', + 'nvim-treesitter/nvim-treesitter' + }, + disable = not vim.fn.has("nvim-0.9.5"), function() require('nvim-ts-autotag').setup {} -- cgit v1.2.1