diff options
author | Squibid <me@zacharyscheiman.com> | 2025-05-08 18:18:34 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2025-05-08 18:18:34 -0500 |
commit | 7430ebed8eab0364452a6cdcaa209f8a7288e44d (patch) | |
tree | cd80b99c41c4af92c7a130fe52ca462062697d22 /lua/conf | |
parent | 7c3289fded1f75f6e060f56bd06edc2a327744d9 (diff) | |
download | nvim-3.0.tar.gz nvim-3.0.tar.bz2 nvim-3.0.zip |
kitchen sink now don't support any version lower than 0.11.0 for lspv3.0
- dap now works for java and c
Diffstat (limited to 'lua/conf')
-rw-r--r-- | lua/conf/opts.lua | 14 | ||||
-rw-r--r-- | lua/conf/plugins/blink.lua | 125 | ||||
-rw-r--r-- | lua/conf/plugins/cmp.lua | 138 | ||||
-rw-r--r-- | lua/conf/plugins/dap-vtxt.lua | 27 | ||||
-rw-r--r-- | lua/conf/plugins/dap.lua | 90 | ||||
-rw-r--r-- | lua/conf/plugins/jdtls.lua | 148 | ||||
-rw-r--r-- | lua/conf/plugins/lspconfig.lua | 17 | ||||
-rw-r--r-- | lua/conf/plugins/luasnip.lua | 2 | ||||
-rw-r--r-- | lua/conf/plugins/mason-lspconfig.lua | 136 | ||||
-rw-r--r-- | lua/conf/plugins/mason.lua | 2 | ||||
-rw-r--r-- | lua/conf/plugins/mellow.lua | 28 | ||||
-rw-r--r-- | lua/conf/plugins/neorg.lua | 146 | ||||
-rw-r--r-- | lua/conf/plugins/treesitter.lua | 4 |
13 files changed, 259 insertions, 618 deletions
diff --git a/lua/conf/opts.lua b/lua/conf/opts.lua index e412389..20e0048 100644 --- a/lua/conf/opts.lua +++ b/lua/conf/opts.lua @@ -102,14 +102,16 @@ auto("FileType", { -- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()" -- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release -require("core.lsp.functions").add_capabilities({ - textDocument = { - foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true +vim.lsp.config['*'] = { + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } } } -}) +} vim.opt.foldlevelstart = 99 vim.opt.foldlevel = 99 diff --git a/lua/conf/plugins/blink.lua b/lua/conf/plugins/blink.lua new file mode 100644 index 0000000..f76d4ee --- /dev/null +++ b/lua/conf/plugins/blink.lua @@ -0,0 +1,125 @@ +return { "Saghen/blink.cmp", + branch = "v1.2.0", + requires = { + "xzbdmw/colorful-menu.nvim", + "L3MON4D3/LuaSnip" + }, + function() + local colormenu = require("colorful-menu") + require("blink.cmp").setup { + keymap = { + preset = "none", -- I don't like the default documentation scroll binds + ["<C-y>"] = { "select_and_accept" }, + ["<C-n>"] = { "select_next", "fallback_to_mappings" }, + ["<C-p>"] = { "select_prev", "fallback_to_mappings" }, + + ["<C-u>"] = { "scroll_documentation_up", "fallback" }, + ["<C-d>"] = { "scroll_documentation_down", "fallback" } + }, + + completion = { + menu = { + scrollbar = false, + border = vim.g.border_style, + draw = { + columns = { + { "kind_icon" }, + { "label", "label_description", gap = 1 }, + { "kind" } + }, + + -- blink.cmp should not take this much damn work to make it look + -- semi-decent + components = { + -- we replace the kind icon with the an icon for the source + kind_icon = { + text = function(ctx) + local menu_icon = { + "?", -- fallback + lsp = "λ", + snippets = "%", + buffer = "@", + path = "#", + cmdline = "$" + } + + local icon = menu_icon[ctx.source_id] + if icon == nil then + icon = menu_icon[1] + end + + return icon + end, + highlight = function(_) + return { { group = "CmpItemMenu" } } + end + }, + label = { + text = function(ctx) + return colormenu.blink_components_text(ctx) + end, + highlight = function(ctx) + return colormenu.blink_components_highlight(ctx) + end + }, + kind = { + -- these highlights are technically for nvim-cmp, but they're + -- built into my colorscheme so I don"t mind using them here + highlight = function(ctx) + return { + { group = "CmpItemKind"..ctx.kind, priority = 20000 } + } + end + } + } + } + }, + + ghost_text = { + enabled = true + }, + + -- documentation should show up immediately + documentation = { + auto_show = true, + auto_show_delay_ms = 0, + window = { + border = vim.g.border_style + } + } + }, + + -- I like the default command line completion + cmdline = { + enabled = false + }, + + -- signature support is necessary + signature = { + enabled = true, + window = { + border = vim.g.border_style + } + }, + + -- TODO: find a way to make my fancy luasnip snippets with multiple + -- triggers not look stupid e.g. "fn\|main" for a function that could + -- be triggered by fn or main + snippets = { + preset = "luasnip" + }, + + sources = { + default = { "lsp", "path", "snippets", "buffer" } + }, + + fuzzy = { + implementation = "prefer_rust_with_warning", + sorts = { + "score", + "sort_text" + } + } + } + end +} diff --git a/lua/conf/plugins/cmp.lua b/lua/conf/plugins/cmp.lua deleted file mode 100644 index c83a2c9..0000000 --- a/lua/conf/plugins/cmp.lua +++ /dev/null @@ -1,138 +0,0 @@ -local lsp = require("core.lsp.functions") - -return { "hrsh7th/nvim-cmp", - requires = { - "nvim-treesitter/nvim-treesitter", - "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", - 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" - } - }, - - function() - local cmp = require("cmp") - local luasnip = require("luasnip") - - -- setup cmp - cmp.setup { - -- disable when in comments - enabled = function() - local context = require("cmp.config.context") - if vim.api.nvim_get_mode().mode == "c" then - return true - else - return not context.in_treesitter_capture("comment") - and not context.in_syntax_group("Comment") - end - end, - - -- completion sources - sources = cmp.config.sources { - { name = "nvim_lsp", priority = 999 }, - { name = "luasnip_choice", priority = 750 }, - { name = "buffer", max_item_count = 3 }, - { name = "async_path", max_item_count = 5 }, - { name = "neorg" }, - { name = "nvim_lsp_signature_help" } - }, - - -- how to sort results - sorting = { - comparators = { - cmp.config.compare.exact, - cmp.config.compare.offset, - cmp.config.compare.score, - require("cmp-under-comparator").under, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - } - }, - - -- appearance of window - window = { - completion = { - scrollbar = false, - border = vim.g.border_style, - winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC", - }, - documentation = { - border = vim.g.border_style, - winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC", - } - }, - - -- position of window - view = { - entries = { - name = "custom", - selection_order = "near_cursor" - } - }, - - -- formatting of content - formatting = { - fields = { "menu", "abbr", "kind" }, - format = function(entry, item) - local hl_info = require("colorful-menu").cmp_highlights(entry) - local menu_icon = { - nvim_lsp = "λ", - 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 - }, - - experimental = { - ghost_text = true - }, - - -- snippet integration - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - - -- mappings - mapping = cmp.mapping.preset.insert { - ["<C-y>"] = cmp.mapping.confirm { - select = true - }, - ["<C-n>"] = cmp.mapping.select_next_item(), - ["<C-p>"] = cmp.mapping.select_prev_item(), - ["<C-u>"] = cmp.mapping.scroll_docs(-4), - ["<C-d>"] = cmp.mapping.scroll_docs(4), - ["<ESC>"] = cmp.mapping.close() - } - } - end -} diff --git a/lua/conf/plugins/dap-vtxt.lua b/lua/conf/plugins/dap-vtxt.lua new file mode 100644 index 0000000..30b2632 --- /dev/null +++ b/lua/conf/plugins/dap-vtxt.lua @@ -0,0 +1,27 @@ +return { "theHamsta/nvim-dap-virtual-text", + requires = { + "nvim-treesitter/nvim-treesitter", + "mfussenegger/nvim-dap" + }, + function() + require("nvim-dap-virtual-text").setup { + virt_text_pos = vim.fn.has("nvim-0.10") == 1 and "inline" or "eol", + + --- A callback that determines how a variable is displayed or whether it should be omitted + --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable + --- @param buf number + --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame + --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) + --- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text + --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed + display_callback = function(variable, buf, stackframe, node, options) + -- by default, strip out new line characters + if options.virt_text_pos == "inline" then + return " = "..variable.value:gsub("%s+", " ") + else + return variable.name.." = "..variable.value:gsub("%s+", " ") + end + end + } + end +} diff --git a/lua/conf/plugins/dap.lua b/lua/conf/plugins/dap.lua index 7cb4903..5abe1b3 100644 --- a/lua/conf/plugins/dap.lua +++ b/lua/conf/plugins/dap.lua @@ -1,50 +1,98 @@ 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 keymap_restore = {} +--- make the default hover binding work for nvim-dap instead of lsp +local function set_hover_bind() + for _, buf in pairs(vim.api.nvim_list_bufs()) do + local keymaps = vim.api.nvim_buf_get_keymap(buf, 'n') + for _, keymap in pairs(keymaps) do + if keymap.lhs == "K" then + table.insert(keymap_restore, keymap) + vim.api.nvim_buf_del_keymap(buf, 'n', 'K') + end + end + end + vim.keymap.set('n', 'K', require("dap.ui.widgets").hover, + { silent = true }) +end + +--- revert the hover bind back to whatever it was +local function unset_hover_bind() + for _, keymap in pairs(keymap_restore) do + if keymap.rhs then + vim.api.nvim_buf_set_keymap(keymap.buffer, keymap.mode, keymap.lhs, + keymap.rhs, { silent = keymap.silent == 1 }) + elseif keymap.callback then + vim.keymap.set(keymap.mode, keymap.lhs, keymap.callback, + { buffer = keymap.buffer, silent = keymap.silent == 1 }) + end + end + keymap_restore = {} +end + return { "mfussenegger/nvim-dap", requires = { - "williamboman/mason.nvim", - "nvim-telescope/telescope.nvim", + "mason-org/mason.nvim", + "nvim-telescope/telescope.nvim" }, - disable = not vim.fn.has("nvim-0.8.0"), - branch = "0.8.0", + disable = not vim.fn.has("nvim-0.9.5"), + branch = "0.10.0", function() - local dap = require("dap") - local codelldb_port = 13000 + -- define codelldb dap.adapters.codelldb = { - type = "server", - host = "127.0.0.1", - port = codelldb_port, - executable = { - command = require("mason-registry").get_package("codelldb"):get_install_path().."/codelldb", - args = { "--port", codelldb_port } - } + type = "executable", + command = "codelldb", } + -- define the c configuration for codelldb dap.configurations.c = { { - name = "LLDB: Launch", + name = "Launch file", type = "codelldb", request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd().."/", "file") - end, + program = select_program, + cwd = "${workspaceFolder}", - stopOnEntry = false, - args = {}, - console = "integratedTerminal" + stopOnEntry = false } } + -- and define them for cpp, zig, and rust + dap.configurations.cpp = dap.configurations.c + dap.configurations.zig = dap.configurations.c + dap.configurations.rust = dap.configurations.c + + -- keybinds map("n", "<Leader>ec", dap.continue, { desc = "dap continue " }) map("n", "<Leader>el", dap.run_last, { desc = "dap run last" }) - map("n", "<Leader>et", dap.terminate, { desc = "dap terminate " }) + map("n", "<Leader>et", function() + dap.terminate() + unset_hover_bind() + end, { desc = "dap terminate " }) map("n", "<Leader>eb", require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" }) map("n", "<Leader>e]", dap.step_over, { desc = "dap step over" }) map("n", "<Leader>e[", dap.step_back, { desc = "dap step back" }) map("n", "<Leader>er", dap.repl.toggle, { desc = "dap repl toggle" }) map("n", "<Leader>eR", dap.restart, { desc = "dap restart" }) + + -- events + dap.listeners.after['event_initialized']['me'] = set_hover_bind + dap.listeners.after['event_terminated']['me'] = unset_hover_bind end } diff --git a/lua/conf/plugins/jdtls.lua b/lua/conf/plugins/jdtls.lua index 463fb23..691e552 100644 --- a/lua/conf/plugins/jdtls.lua +++ b/lua/conf/plugins/jdtls.lua @@ -1,150 +1,4 @@ -local misc = require("core.misc") -local lsp = require("core.lsp.functions") -local map, auto = misc.map, misc.auto - return { "mfussenegger/nvim-jdtls", disable = not vim.fn.has("nvim-0.6.0"), - requires = "mfussenegger/nvim-dap", - function() - auto("FileType", { - pattern = "java", - callback = function() - local jdtls = require("jdtls") - local jdtls_install = require("mason-registry").get_package("jdtls"):get_install_path() - - -- make sure to check if things with 💀 need updating - local config = { - cmd = { - "/usr/lib/jvm/openjdk21/bin/java", -- 💀 - "-jar", vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), -- 💀 - "-configuration", jdtls_install.."/config_linux", - "-data", vim.fn.stdpath("cache").."/nvim-jdtls", - - "--add-modules=ALL-SYSTEM", - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.util=ALL-UNNAMED", - "-Declipse.application=org.eclipse.jdt.ls.core.id1", - "-Declipse.product=org.eclipse.jdt.ls.core.product", - "-Dlog.level=ALL", - "-Dlog.protocol=true", - "-Dosgi.bundles.defaultStartLevel=4", - "-Xmx1G", - }, - root_dir = vim.fs.dirname(vim.fs.find({ - "gradlew", - ".git", - "mvnw", - "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 - handlers = { - ["language/status"] = function() end - }, - - on_attach = function(_, bufnr) - -- add some jdtls specific mappings - local opts = { buffer = bufnr } - map("n", "cri", jdtls.organize_imports, opts) - map("n", "crv", jdtls.extract_variable, opts) - map("n", "crc", jdtls.extract_constant, opts) - map("x", "crv", function() jdtls.extract_variable(true) end, opts) - map("x", "crc", function() jdtls.extract_constant(true) end, opts) - map("x", "crm", function() jdtls.extract_method(true) end, opts) - - pcall(vim.lsp.codelens.refresh) - auto("BufWritePost", { - buffer = bufnr, - desc = "refresh codelens", - callback = function() - pcall(vim.lsp.codelens.refresh) - 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 - local src_path = vim.fs.joinpath(vim.fn.stdpath("config"), "/extras/JavaVersion.java") - - -- if either path is invalid - if not cache_path or not src_path then - return - end - - --- build a cache of the JavaVersion code - local function build_cache() - -- check if we have javac - vim.system({ "javac" }, {}, function(out) - if out.code == 127 then - cache_path = nil - return - end - - -- compile our code - vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache") }, {}, function(out) - if out.code ~= 0 then - cache_path = nil - end - end) - end) - end - - -- check if we have a compiled version of JavaVersion - local f, _ = io.open(cache_path, "r") - if not f then -- if we don"t have a cache - build_cache() - else - io.close(f) - end - - -- check the java version - local buffer = {} - vim.fn.jobstart({ - config.cmd[1], - (cache_path and "JavaVersion") or src_path - }, { - cwd = vim.fn.stdpath("cache"), - stdin = nil, - on_stdout = function(_, data, _) - table.insert(buffer, table.concat(data)) - end, - on_exit = function(_, exit_code, _) - local v = vim.version.parse(table.concat(buffer)) - - -- if there"s an error, no version info, or the java version is - -- less than 17 stop the lsp from starting - if exit_code ~= 0 then - vim.notify(string.format( - "java version check failed: exit code %s", exit_code), - vim.log.levels.ERROR, { title = misc.appid }) - vim.notify(string.format( - "%s", vim.inspect(buffer)), - vim.log.levels.ERROR, { title = misc.appid }) - return - elseif not v then - vim.notify("no java version info found", vim.log.levels.ERROR, - { title = misc.appid }) - return - elseif v.major < 17 then - vim.notify(string.format( - "java version %s < 17.0.0 Cannot run jdtls, bailing out", - v[1].."."..v[2].."."..v[3]), - vim.log.levels.ERROR, { title = misc.appid }) - return - end - - -- start lsp - jdtls.start_or_attach(config) - end - }) - end - }) - end + requires = "mfussenegger/nvim-dap" } diff --git a/lua/conf/plugins/lspconfig.lua b/lua/conf/plugins/lspconfig.lua new file mode 100644 index 0000000..b7f2cde --- /dev/null +++ b/lua/conf/plugins/lspconfig.lua @@ -0,0 +1,17 @@ +return { "neovim/nvim-lspconfig", + disable = not vim.fn.has("nvim-0.10.0"), + requires = { + "mason-org/mason.nvim", + "mason-org/mason-lspconfig.nvim" + }, + function() + require("core.lsp.functions").setup() + require("mason-lspconfig").setup { + ensure_added = { + "clangd", + "lua_ls", + "jdtls" + } + } + end +} diff --git a/lua/conf/plugins/luasnip.lua b/lua/conf/plugins/luasnip.lua index e5d2a0b..6a04ffd 100644 --- a/lua/conf/plugins/luasnip.lua +++ b/lua/conf/plugins/luasnip.lua @@ -2,7 +2,7 @@ local misc = require("core.misc") local map = misc.map return { "L3MON4D3/LuaSnip", - branch = "v2.3.0", + branch = "v2.4.0", disable = not vim.fn.has("nvim-0.7.0"), config = function() vim.cmd("make install_jsregexp") diff --git a/lua/conf/plugins/mason-lspconfig.lua b/lua/conf/plugins/mason-lspconfig.lua deleted file mode 100644 index c4e4684..0000000 --- a/lua/conf/plugins/mason-lspconfig.lua +++ /dev/null @@ -1,136 +0,0 @@ -local misc = require("core.misc") -local lsp = require("core.lsp.functions") -local map = misc.map - -return { "williamboman/mason-lspconfig.nvim", - requires = { - "williamboman/mason.nvim", - { "neovim/nvim-lspconfig", - 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 - require("mason-lspconfig").setup { - ensure_installed = { - "lua_ls", - "clangd", - "jdtls", - "phpactor", - "html", - "cssls", - "bashls", - "zls" - -- "asm-lsp", -- seems to be broken - }, - - -- 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" - } - - -- 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 = util.root_pattern("lua/")(fname) - if root then - return root - end - return util.find_git_ancestor(fname) - end - } - end, - - -- 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", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", 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++ - } - } - } - 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", "<cmd>PyrightOrganizeImports<CR>", 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 78742e9..017fcd8 100644 --- a/lua/conf/plugins/mason.lua +++ b/lua/conf/plugins/mason.lua @@ -1,4 +1,4 @@ -return { "williamboman/mason.nvim", +return { "mason-org/mason.nvim", 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 f0ebf82..a590cf9 100644 --- a/lua/conf/plugins/mellow.lua +++ b/lua/conf/plugins/mellow.lua @@ -13,29 +13,17 @@ return { "mellow-theme/mellow.nvim", ["NormalFloat"] = { fg = c.fg, bg = "#111111" }, ["FloatBorder"] = { link = "NormalFloat" }, - -- neorg headings, looks extra good with lukas-reineke/headlines.nvim - ["@neorg.headings.1.title"] = { fg = c.yellow, bg = "#2a211c" }, - ["@neorg.headings.1.icon"] = { link = "@neorg.headings.1.title" }, - - ["@neorg.headings.2.title"] = { fg = c.blue, bg = "#201e25" }, - ["@neorg.headings.2.icon"] = { link = "@neorg.headings.2.title" }, - - ["@neorg.headings.3.title"] = { fg = c.cyan, bg = "#2b1b20" }, - ["@neorg.headings.3.icon"] = { link = "@neorg.headings.3.title" }, - - ["@neorg.headings.4.title"] = { fg = c.green, bg = "#1d201e" }, - ["@neorg.headings.4.icon"] = { link = "@neorg.headings.4.title" }, - - ["@neorg.headings.5.title"] = { fg = c.magenta, bg = "#251a21" }, - ["@neorg.headings.5.icon"] = { link = "@neorg.headings.5.title" }, - - ["@neorg.headings.6.title"] = { fg = c.white, bg = "#212126" }, - ["@neorg.headings.6.icon"] = { link = "@neorg.headings.6.title" }, + -- make diagnostics have an undercurl + ["DiagnosticUnderlineError"] = { fg = c.red, undercurl = true }, + ["DiagnosticUnderlineWarn"] = { fg = c.yellow, undercurl = true }, + ["DiagnosticUnderlineInfo"] = { fg = c.blue, undercurl = true }, + ["DiagnosticUnderlineHint"] = { fg = c.cyan, undercurl = true }, -- make blink actually look nice - ["BlinkCmpMenu"] = { bg = c.bg_dark }, + ["BlinkCmpMenu"] = { link = "NormalFloat" }, ["BlinkCmpMenuBorder"] = { link = "BlinkCmpMenu" }, - ["BlinkCmpMenuSelection"] = { bg = c.gray02 } + ["BlinkCmpMenuSelection"] = { bg = c.gray01 }, + ["BlinkCmpLabelDeprecated"] = { link = "CmpItemAbbrDeprecated" } } end } diff --git a/lua/conf/plugins/neorg.lua b/lua/conf/plugins/neorg.lua deleted file mode 100644 index 9193a84..0000000 --- a/lua/conf/plugins/neorg.lua +++ /dev/null @@ -1,146 +0,0 @@ --- WARNING: neorg does some pretty stupid stuff when it comes to the plugins it --- wants (using luarocks), in order to get around all that bullshit I"ve --- manually added it"s dependencies. Because I don"t want this to randomly break --- I"ve also pinned neorg to the latest working version that I"ve messed around --- with. --- --- NOTE: for my future self to update this thingy while not breaking --- 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 -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 ----@param cache boolean? if true will re populate the cache from the fs ----@return table workspaces -local function populate_workspaces(path, cache) - local workspaces = {} - cache = cache or false - - if vim.fn.filereadable(workspace_cache) == 1 and not cache then - local ok, ret = pcall(dofile, workspace_cache) - if ok and type(ret) == "table" then - return ret - end - end - - -- loop through all files in path if path is not empty - if vim.fn.empty(vim.fn.glob(path)) == 0 then - for n, t in vim.fs.dir(path) do - if string.sub(n, 1, 1) == "." or (t ~= "directory" and t ~= "link") then - goto continue - end - -- make sure this still works if the last charachter in the path isn"t a "/" - workspaces[n] = (string.sub(path, #path, #path) == "/") and path..n or path.."/"..n - ::continue:: - end - end - - -- write data to cachefile - local f = io.open(workspace_cache, "w+") - if not f then - return workspaces - end - - f:write("return") - local ret = vim.inspect(workspaces) - if type(ret) == "string" then - f:write(ret) - else - f:write("false") - end - - f:close() - - return workspaces -end - -return { "nvim-neorg/neorg", - disable = not vim.fn.has("nvim-0.10.0"), - branch = "v9.3.0", - requires = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - "folke/zen-mode.nvim", - "hrsh7th/nvim-cmp", - { "nvim-neorg/neorg-telescope", - requires = "nvim-telescope/telescope.nvim" - }, - - -- NOTE: these are usually installed by neorg via luarocks, the versions - -- 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" - }, - { "nvim-neorg/lua-utils.nvim", - branch = "v1.0.2" - }, - { "MunifTanjim/nui.nvim", - branch = "0.3.0" - }, - { "pysan3/pathlib.nvim", - branch = "v2.2.2" - } - }, - - function() - local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or - (os.getenv("HOME").."/Documents")).."/notes/" - - require("neorg").setup { - load = { - -- not sure how to sort the modules so ima just put the empty ones first - ["core.defaults"] = {}, - ["core.export"] = {}, - ["core.export.markdown"] = {}, - ["core.integrations.telescope"] = {}, - ["core.summary"] = {}, - ["core.ui.calendar"] = {}, - - ["core.completion"] = { - config = { - engine = "nvim-cmp" - } - }, - ["core.concealer"] = { - config = { - folds = false - } - }, - ["core.dirman"] = { - config = { - -- a list of available workspaces are generated at runtime >:) - workspaces = populate_workspaces(wsphome) - } - }, - ["core.esupports.metagen"] = { - config = { - type = "auto" - } - }, - ["core.presenter"] = { - config = { - zen_mode = "zen-mode" - } - }, - ["core.qol.toc"] = { - config = { - close_after_use = true - } - }, - ["core.tangle"] = { - config = { - tangle_on_write = true - } - } - } - } - end -} diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index d9607e3..e473de4 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -25,7 +25,7 @@ return { "nvim-treesitter/nvim-treesitter", enable = true, disable = function(lang, _) - -- disable indenting in php (it"s more broken with than without) + -- disable indenting in php (it's more broken with than without) return table.contains(({ "php" }), lang) @@ -39,7 +39,7 @@ return { "nvim-treesitter/nvim-treesitter", additional_vim_regex_highlighting = true, disable = function(lang, buf) - -- disable in some files where vim"s builtin highlighting is better + -- disable in some files where vim's builtin highlighting is better if table.contains(({ "diff", "tex" }), lang) then |