diff --git a/README.md b/README.md index a804cec..ca0660d 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,21 @@ This repository contains my NeoVim configs, including some of my snippets. It uses Lazy.nvim as the plugin manager, lspconfig for the language server configuration, none-ls for formatting, telescope, tree-sitter and many other plugins. Partially documented and fairly well organized + +## Update +A new version of these configs is in the works, removing many plugins that are now all consolidated in Snacks +Lazy.nvim might be replaced with NeoVim's native 0.12+ package manager + + ## Linter configs You may find the linter configs and setup-scripts for some linters that require some extra setup [here](https://git.janishutz.com/janishutz/dotfiles/) + # Lua notes To get your luarocks packages to be picked up by the language server, it is currently configured to only look at the `cwd` that nvim is open in. I may expand that in the future to do a proper search for all open buffers, but that would require a language server restart to apply on every buffer add + # Issues with jdtls Ensure you have jdk21-opnejdk or newer installed. On Arch (and derivatives) you can switch the preferred java version using `archlinux-java set ` diff --git a/nvim-install-force.sh b/nvim-install-force.sh index e0421e2..19cf6c4 100755 --- a/nvim-install-force.sh +++ b/nvim-install-force.sh @@ -18,22 +18,22 @@ cp ./lazy-conf-pager.lua ~/.config/nvimpager/lua/lazy-conf.lua cd ~/.config/nvimpager/ rm -rf ./lua/plugins/lsp rm -rf ./lua/plugins/testing -rm -rf ./lua/plugins/nav/telescope +rm -rf ./lua/plugins/snacks rm -rf ./ftplugin # Remove specific plugins -rm -rf ./lua/plugins/nav/neotree.lua -rm -rf ./lua/plugins/nav/toggleterm.lua -rm -rf ./lua/plugins/style/startup.lua -rm -rf ./lua/plugins/util/autotag.lua +rm -rf ./lua/plugins/nav/bufferline.lua +rm -rf ./lua/plugins/nav/gitsigns.lua +rm -rf ./lua/plugins/nav/navbuddy.lua +rm -rf ./lua/plugins/style/navbuddy.lua rm -rf ./lua/plugins/util/autopairs.lua +rm -rf ./lua/plugins/util/autotag.lua +rm -rf ./lua/plugins/util/comment-box.lua +rm -rf ./lua/plugins/util/comment.lua rm -rf ./lua/plugins/util/colour-picker.lua -rm -rf ./lua/plugins/util/indent-blankline.lua +rm -rf ./lua/plugins/util/diffview.lua rm -rf ./lua/plugins/util/markdown-preview.lua -rm -rf ./lua/plugins/util/neogen.lua rm -rf ./lua/plugins/util/move.lua +rm -rf ./lua/plugins/util/neogen.lua rm -rf ./lua/plugins/util/surround.lua -rm -rf ./lua/plugins/util/scratch.lua -rm -rf ./lua/plugins/util/multicrsors.lua -rm -rf ./lua/plugins/util/diff rm -rf ./lua/plugins/util/wakapi.lua diff --git a/nvim/lua/keybinds.lua b/nvim/lua/keybinds.lua index b87a08e..c0f3850 100755 --- a/nvim/lua/keybinds.lua +++ b/nvim/lua/keybinds.lua @@ -124,8 +124,6 @@ keymap.set({ "n", "v" }, "P", '"+P', opts("PASTE from system clipboard") keymap.set({ "n", "v" }, "d", '"+d', opts("yank to system clipboard and delete")) keymap.set({ "n", "v" }, "D", '"+D', opts("YANK to system clipboard and DELETE")) -keymap.set("n", "wk", ":WhichKey", opts("Toggle WhichKey")) - -- Toggle relative line numbers keymap.set( "n", diff --git a/nvim/lua/lazy-conf.lua b/nvim/lua/lazy-conf.lua index 421d24b..554f209 100755 --- a/nvim/lua/lazy-conf.lua +++ b/nvim/lua/lazy-conf.lua @@ -14,10 +14,10 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { import = "plugins.nav" }, + { import = "plugins.snacks" }, { import = "plugins.lsp" }, { import = "plugins.style" }, { import = "plugins.util" }, - { import = "plugins.util.diff" }, { import = "plugins.testing" }, }, change_detection = { diff --git a/nvim/lua/lsp-options.lua b/nvim/lua/lsp-options.lua index 8157af1..979d8ec 100644 --- a/nvim/lua/lsp-options.lua +++ b/nvim/lua/lsp-options.lua @@ -5,67 +5,61 @@ local keymap = vim.keymap local opts = { silent = true, noremap = true } M.on_attach = function(client, bufnr) - opts.buffer = bufnr + opts.buffer = bufnr - -- set keybinds - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) + -- set keybinds + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - opts.desc = "Go to declaration" - keymap.set("n", "gD", ":lua vim.lsp.buf.declaration", opts) + opts.desc = "Format current file" + keymap.set("n", "gf", vim.lsp.buf.format, opts) - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) + opts.desc = "Smart rename" + keymap.set("n", "n", vim.lsp.buf.rename, opts) - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", function() + vim.diagnostic.jump({ + count = -1, + on_jump = function() + vim.diagnostic.open_float() + end, + }) + end, opts) + keymap.set("n", "?", vim.diagnostic.open_float, opts) - opts.desc = "Show LSP type definitions" - keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", function() + vim.diagnostic.jump({ + count = 1, + on_jump = function() + vim.diagnostic.open_float() + end, + }) + end, opts) - opts.desc = "See available code actions" - keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "k", vim.lsp.buf.hover, opts) - opts.desc = "Format current file" - keymap.set("n", "gf", vim.lsp.buf.format, opts) + opts.desc = "Show signature help" + keymap.set("n", "v", vim.lsp.buf.signature_help, opts) - opts.desc = "Smart rename" - keymap.set("n", "n", vim.lsp.buf.rename, opts) + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) - opts.desc = "Show buffer diagnostics" - keymap.set("n", "ga", "Telescope diagnostics bufnr=0", opts) - - opts.desc = "Show line diagnostics" - keymap.set("n", "gA", ":lua vim.diagnostic.open_float()", opts) - - opts.desc = "Go to previous diagnostic" - keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) - - opts.desc = "Go to next diagnostic" - keymap.set("n", "]d", vim.diagnostic.goto_next, opts) - - opts.desc = "Show documentation for what is under cursor" - keymap.set("n", "k", vim.lsp.buf.hover, opts) - - opts.desc = "Show signature help" - keymap.set("n", "v", vim.lsp.buf.signature_help, opts) - - opts.desc = "Restart LSP" - keymap.set("n", "rs", ":LspRestart", opts) - - vim.opt.signcolumn = "yes" -- reserve space for diagnostics + vim.opt.signcolumn = "yes" -- reserve space for diagnostics end M.on_attach_no_formatting = function(client, bufnr) - M.on_attach(client, bufnr) + M.on_attach(client, bufnr) - client.server_capabilities.documentFormattingProvider = false - client.server_capabilities.documentRangeFormattingProvider = false + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false end -- used to enable autocompletion (assign to every lsp server config) -- local capabilities = cmp_nvim_lsp.default_capabilities() -M.capabilities = vim.lsp.protocol.make_client_capabilities() +M.capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) M.capabilities.textDocument.completion.completionItem.snippetSupport = true return M diff --git a/nvim/lua/plugins/lsp/cmp.lua b/nvim/lua/plugins/lsp/cmp.lua deleted file mode 100755 index 4bf2c85..0000000 --- a/nvim/lua/plugins/lsp/cmp.lua +++ /dev/null @@ -1,130 +0,0 @@ -return { - -- competion - "hrsh7th/nvim-cmp", - event = { "InsertEnter", "LspAttach" }, - dependencies = { - { "hrsh7th/cmp-buffer" }, -- source for text in buffer - { "hrsh7th/cmp-path" }, -- source for file system paths - { "L3MON4D3/LuaSnip" }, -- snippet engine - { "saadparwaiz1/cmp_luasnip" }, -- for autocompletion - { "rafamadriz/friendly-snippets" }, -- useful snippets - { "onsails/lspkind.nvim" }, -- icons for cmp - }, - config = function() - local cmp = require("cmp") - local lspkind = require("lspkind") - local luasnip = require("luasnip") - - -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) - require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) - luasnip.setup({}) - - -- luasnip.filetype_extend("htmldjango", { "html" }) - - cmp.setup({ - completion = { - completeopt = "menu,menuone,preview,noselect", - }, - - window = { - documentation = cmp.config.window.bordered({ - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }), - completion = cmp.config.window.bordered({ - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", - }), - }, - - snippet = { -- configure how nvim-cmp interacts with snippet engine - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion - [""] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion - [""] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward - [""] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back - [""] = cmp.mapping.complete(), -- show completion suggestions - [""] = cmp.mapping.abort(), -- close completion window - [""] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected - -- Mapping for Tab key - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }) - else - -- Otherwise, fallback (insert a tab character) - fallback() - end - end, { "i", "s" }), - - -- Mapping for jumping in snippets - [""] = cmp.mapping(function(fallback) - if require("luasnip").jumpable() then - -- Jump backwards if inside a snippet - require("luasnip").jump() - else - -- Otherwise, fallback (insert a tab character) - fallback() - end - end, { "i", "s" }), - - -- Mapping for jumping backwards in snippets - [""] = cmp.mapping(function(fallback) - if require("luasnip").jumpable() then - -- Jump backwards if inside a snippet - require("luasnip").jump() - else - -- Otherwise, fallback (insert a tab character) - fallback() - end - end, { "i", "s" }), - }), - - -- sources for autocompletion - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- lsp - { name = "luasnip" }, -- snippets - { name = "buffer" }, -- text within current buffer - { name = "path" }, -- file system paths - }), - - formatting = { - fields = { "icon", "abbr", "menu" }, - format = lspkind.cmp_format({ - mode = "symbol", -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - -- can also be a function to dynamically calculate max width such as - -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, - ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - show_labelDetails = true, -- show labelDetails in menu. Disabled by default - - -- The function below will be called before any actual modifications from lspkind - -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) - before = function(entry, vim_item) - return vim_item - end, - }), - }, - }) - - local opts = { silent = true } - opts.desc = "next snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(1) - end, opts) - - opts.desc = "previous snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(-1) - end, opts) - - opts.desc = "LuaSnip unlink" - vim.keymap.set({ "i", "n" }, "", function() - luasnip.unlink_current() - end, opts) - end, -} diff --git a/nvim/lua/plugins/lsp/completion.lua b/nvim/lua/plugins/lsp/completion.lua new file mode 100644 index 0000000..8de9e8a --- /dev/null +++ b/nvim/lua/plugins/lsp/completion.lua @@ -0,0 +1,67 @@ +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets", "L3MON4D3/LuaSnip" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "super-tab", + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "show_documentation", "hide_documentation" }, + [""] = { "scroll_documentation_down", "scroll_signature_down" }, + [""] = { "scroll_documentation_up", "scroll_signature_up" }, + [""] = { "snippet_backward", "fallback" }, + [""] = { "snippet_forward", "fallback" }, + [""] = { "show_signature", "hide_signature", "fallback" }, + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + documentation = { auto_show = false }, + list = { + cycle = { from_top = true, from_bottom = true }, + selection = { + auto_insert = false + } + }, + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/nvim/lua/plugins/lsp/ls/qml.lua b/nvim/lua/plugins/lsp/ls/qml.lua index 70054c2..2c5f6d7 100644 --- a/nvim/lua/plugins/lsp/ls/qml.lua +++ b/nvim/lua/plugins/lsp/ls/qml.lua @@ -7,11 +7,11 @@ local capabilities = require("lsp-options").capabilities local on_attach = require("lsp-options").on_attach lsp.config("qmlls", { - capabilities = capabilities, - on_attach = on_attach, + capabilities = capabilities, + on_attach = on_attach, + cmd = { "qmlls6" }, }) - -- ── Enable configs ─────────────────────────────────────────────── local enable = vim.lsp.enable enable("qmlls") diff --git a/nvim/lua/plugins/lsp/ls/sql.lua b/nvim/lua/plugins/lsp/ls/sql.lua index 9a737c3..28505aa 100644 --- a/nvim/lua/plugins/lsp/ls/sql.lua +++ b/nvim/lua/plugins/lsp/ls/sql.lua @@ -6,7 +6,7 @@ local lsp = vim.lsp local capabilities = require("lsp-options").capabilities local on_attach = require("lsp-options").on_attach -lsp.config("sqlls", { +lsp.config("postgres_lsp", { capabilities = capabilities, on_attach = on_attach, }) @@ -14,4 +14,4 @@ lsp.config("sqlls", { -- ── Enable configs ─────────────────────────────────────────────── local enable = vim.lsp.enable -enable("sqlls") +enable("postgres_lsp") diff --git a/nvim/lua/plugins/lsp/lsp-lines.lua b/nvim/lua/plugins/lsp/lsp-lines.lua deleted file mode 100755 index 6b0114b..0000000 --- a/nvim/lua/plugins/lsp/lsp-lines.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - ---------- for lsp diagnostic lines ---------- - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - event = "LspAttach", - config = function() - require("lsp_lines").setup() - vim.diagnostic.config({ virtual_lines = false }) - - local lsplines = false - vim.keymap.set("n", "L", function() - lsplines = not lsplines - vim.diagnostic.config({ virtual_text = not lsplines }) - vim.diagnostic.config({ virtual_lines = lsplines }) - end, { desc = "Toggle lsp_lines" }) - end, -} diff --git a/nvim/lua/plugins/lsp/lspconfig.lua b/nvim/lua/plugins/lsp/lspconfig.lua index 2ec5dad..c2f2c55 100755 --- a/nvim/lua/plugins/lsp/lspconfig.lua +++ b/nvim/lua/plugins/lsp/lspconfig.lua @@ -3,43 +3,50 @@ -- │ LSP Configuration │ -- ╰───────────────────────────────────────────────╯ return { - -- lsp configuration - "neovim/nvim-lspconfig", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - { "antosha417/nvim-lsp-file-operations", config = true }, - "mfussenegger/nvim-jdtls", - }, - config = function() - -- Change the Diagnostic symbols in the sign column (gutter) - local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶", Info = "󰋽 " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) - end + -- lsp configuration + "neovim/nvim-lspconfig", + dependencies = { + { "antosha417/nvim-lsp-file-operations", config = true }, + "mfussenegger/nvim-jdtls", + }, + config = function() + -- Change the Diagnostic symbols in the sign column (gutter) + local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶", Info = "󰋽 " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end - -- ─────────────────────────────────────────────────────────────────── - -- ╭───────────────────────────────────────────────╮ - -- │ Import configs from other files │ - -- ╰───────────────────────────────────────────────╯ - require("plugins.lsp.ls.bashls") - require("plugins.lsp.ls.c") - require("plugins.lsp.ls.dart") - require("plugins.lsp.ls.docker") - require("plugins.lsp.ls.gh-actions") - require("plugins.lsp.ls.go") - require("plugins.lsp.ls.haskell") - require("plugins.lsp.ls.hypr") - require("plugins.lsp.ls.low-level") - require("plugins.lsp.ls.luals") - require("plugins.lsp.ls.pyright") - require("plugins.lsp.ls.rust-analyzer") - require("plugins.lsp.ls.ruby") - require("plugins.lsp.ls.sql") - require("plugins.lsp.ls.text") - require("plugins.lsp.ls.web") - require("plugins.lsp.ls.yaml") - -- ─────────────────────────────────────────────────────────────────── - end, + local luasnip = require("luasnip") + + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) + luasnip.setup({}) + + -- ─────────────────────────────────────────────────────────────────── + -- ╭───────────────────────────────────────────────╮ + -- │ Import configs from other files │ + -- ╰───────────────────────────────────────────────╯ + require("plugins.lsp.ls.bashls") + require("plugins.lsp.ls.c") + require("plugins.lsp.ls.dart") + require("plugins.lsp.ls.docker") + require("plugins.lsp.ls.gh-actions") + require("plugins.lsp.ls.go") + require("plugins.lsp.ls.haskell") + require("plugins.lsp.ls.hypr") + require("plugins.lsp.ls.low-level") + require("plugins.lsp.ls.luals") + require("plugins.lsp.ls.pyright") + require("plugins.lsp.ls.qml") + require("plugins.lsp.ls.rust-analyzer") + require("plugins.lsp.ls.ruby") + require("plugins.lsp.ls.sql") + require("plugins.lsp.ls.text") + require("plugins.lsp.ls.web") + require("plugins.lsp.ls.yaml") + -- ─────────────────────────────────────────────────────────────────── + end, } -- ─────────────────────────────────────────────────────────────────── diff --git a/nvim/lua/plugins/lsp/mason.lua b/nvim/lua/plugins/lsp/mason.lua index eb1f948..ce21962 100755 --- a/nvim/lua/plugins/lsp/mason.lua +++ b/nvim/lua/plugins/lsp/mason.lua @@ -40,10 +40,10 @@ return { "jsonls", "marksman", "lua_ls", + "postgres_lsp", "pyright", "rust_analyzer", "ruby_lsp", - "sqlls", "verible", "vtsls", "vue_ls", diff --git a/nvim/lua/plugins/nav/bufferline.lua b/nvim/lua/plugins/nav/bufferline.lua index c6a3961..f4112bf 100755 --- a/nvim/lua/plugins/nav/bufferline.lua +++ b/nvim/lua/plugins/nav/bufferline.lua @@ -14,7 +14,7 @@ return { indicator = { style = "underline" }, offsets = { { - filetype = "neo-tree", + filetype = "snacks_picker_list", text = " ", text_align = "center", separator = true, diff --git a/nvim/lua/plugins/nav/neotree.lua b/nvim/lua/plugins/nav/neotree.lua deleted file mode 100755 index 8da9b02..0000000 --- a/nvim/lua/plugins/nav/neotree.lua +++ /dev/null @@ -1,333 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information - }, - keys = { - { "e", "Neotree", desc = "Open Neotree" }, - { - "gg", - "Neotree source=git_status position=float", - desc = "Open git view", - }, - }, - opts = { - close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - use_default_mappings = false, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - open_files_using_relative_paths = false, - sort_case_insensitive = false, -- used when sorting files and directories in the tree - -- sort_function = nil, -- use a custom function for sorting files and directories in the tree - sort_function = function(a, b) -- natural sort - if a.type == b.type then - local ap = a.path:lower() - local bp = b.path:lower() - - if ap == bp then - return false - end - - for i = 1, math.max(string.len(ap), string.len(bp)), 1 do - local l = string.sub(ap, i, -1) - local r = string.sub(bp, i, -1) - - if - type(tonumber(string.sub(l, 1, 1))) == "number" - and type(tonumber(string.sub(r, 1, 1))) == "number" - then - local l_number = tonumber(string.match(l, "^[0-9]+")) - local r_number = tonumber(string.match(r, "^[0-9]+")) - - if l_number ~= r_number then - return l_number < r_number - end - elseif string.sub(l, 1, 1) ~= string.sub(r, 1, 1) then - return l < r - end - end - else - return a.type < b.type - end - end, - default_component_configs = { - container = { - enable_character_fade = true, - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "󰜌", - provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available - if node.type == "file" or node.type == "terminal" then - local success, web_devicons = pcall(require, "nvim-web-devicons") - local name = node.type == "terminal" and "terminal" or node.name - if success then - local devicon, hl = web_devicons.get_icon(name) - icon.text = devicon or icon.text - icon.highlight = hl or icon.highlight - end - end - end, - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon", - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = true, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖", -- this can only be used in the git_status source - renamed = "󰁕", -- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - conflict = "", - }, - }, - -- If you don't want to use these columns, you can set `enabled = false` for each of them individually - file_size = { - enabled = true, - width = 12, -- width of the column - required_width = 64, -- min width of window required to show this column - }, - type = { - enabled = true, - width = 10, -- width of the column - required_width = 122, -- min width of window required to show this column - }, - last_modified = { - enabled = true, - width = 20, -- width of the column - required_width = 88, -- min width of window required to show this column - }, - created = { - enabled = true, - width = 20, -- width of the column - required_width = 110, -- min width of window required to show this column - }, - symlink_target = { - enabled = false, - }, - }, - -- A list of functions, each representing a global custom command - -- that will be available in all sources (if not overridden in `opts[source_name].commands`) - -- see `:h neo-tree-custom-commands-global` - commands = {}, - window = { - position = "left", - width = 40, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = { - ["<2-LeftMouse>"] = "open", - [""] = "open", - ["o"] = "open", - [""] = "cancel", -- close preview or floating neo-tree window - ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, - -- Read `# Preview Mode` for more information - ["l"] = "focus_preview", - ["S"] = "open_split", - ["v"] = "open_vsplit", - ["t"] = "open_tabnew", - ["w"] = "open_with_window_picker", - ["C"] = "close_node", - -- ['C'] = 'close_all_subnodes', - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", - ["i"] = "show_file_details", - }, - }, - nesting_rules = {}, - filesystem = { - scan_mode = "deep", - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_ignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - always_show_by_pattern = { -- uses glob style patterns - --".env*", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, - }, - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - ["a"] = { - "add", - -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none", -- "none", "relative", "absolute" - }, - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. - ["d"] = "delete", - ["r"] = "rename", - ["b"] = "rename_basename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["p"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm - -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sg"] = { "order_by_git_status", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - -- [''] = function(state) ... end, - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - [""] = "close", - -- [''] = function(state, scroll_padding) ... end, - }, - }, - - commands = {}, -- Add a custom command or override a global one using the same function name - }, - buffers = { - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { - mappings = { - ["d"] = "buffer_delete", - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - }, - }, - }, - git_status = { - window = { - position = "float", - mappings = { - ["A"] = "git_add_all", - ["u"] = "git_unstage_file", - ["a"] = "git_add_file", - ["r"] = "git_revert_file", - ["c"] = "git_commit", - ["p"] = "git_push", - ["g"] = "git_commit_and_push", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - }, - }, - }, - }, -} diff --git a/nvim/lua/plugins/nav/telescope.lua b/nvim/lua/plugins/nav/telescope.lua deleted file mode 100755 index 8cf09fc..0000000 --- a/nvim/lua/plugins/nav/telescope.lua +++ /dev/null @@ -1,157 +0,0 @@ -return { - -- fuzzy finder - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - { - "nvim-telescope/telescope-live-grep-args.nvim", - -- This will not install any breaking changes. - -- For major updates, this must be adjusted manually. - version = "^1.0.0", - }, - }, - event = { "LspAttach" }, - keys = { - { - "ff", - function() - require("telescope.builtin").find_files() - end, - desc = "Telescope find files", - }, - - { - "fu", - function() - require("telescope.builtin").lsp_references() - end, - desc = "Telescope Usage (references)", - }, - - { - "flg", - function() - require("telescope.builtin").live_grep() - end, - desc = "Telescope live grep", - }, - - { - "fg", - function() - require("telescope").extensions.live_grep_args.live_grep_args() - end, - desc = "Telescope live grep args", - }, - - { - "fb", - function() - require("telescope.builtin").buffers() - end, - desc = "Telescope buffers", - }, - - { - "fh", - function() - require("telescope.builtin").help_tags() - end, - desc = "Telescope nvim functions", - }, - - { "ft", ":TodoTelescope", desc = "Telescope TODOs" }, - - -- Git - { - "fld", - function() - require("telescope.builtin").git_status() - end, - desc = "Telescope git diff", - }, - - { - "flc", - function() - require("telescope.builtin").git_commits() - end, - desc = "Telescope git commits", - }, - - { - "flf", - function() - require("telescope.builtin").git_files() - end, - desc = "Telescope git files", - }, - - -- Recent Commands - { "foc", ":Telescope command_history", desc = "Telescope recent commands" }, - - -- Recent Searches - { "fos", ":Telescope search_history", desc = "Telescope recent searches" }, - - -- Old Files - { - "fr", - function() - require("telescope.builtin").oldfiles() - end, - desc = "Telescope recent files", - }, - - -- Quickfix Items - { "fq", ":Telescope quickfix", desc = "Telescope quickfix items" }, - - -- Spell Suggestions - { "fs", ":Telescope spell_suggest", desc = "Telescope spellsuggestions" }, - - -- Diagnostics - { "fd", ":Telescope diagnostics", desc = "Telescope Diagnostics" }, - - -- Notifications - { "fn", ":Telescope notify", desc = "Telescope Notifications" }, - - -- Implementations - { "fi", ":Telescope lsp_implementations", desc = "Telescope lsp implementations" }, - - -- References - { - "fu", - function() - require("telescope.builtin").lsp_references() - end, - desc = "Telescope Usage (references)", - }, - }, - config = function() - local actions = require("telescope.actions") - local telescope = require("telescope") - local lga_actions = require("telescope-live-grep-args.actions") - - telescope.setup({ - defaults = { - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.smart_add_to_qflist, - [""] = actions.smart_send_to_qflist, - [""] = lga_actions.quote_prompt(), - }, - }, - path_display = { "truncate" }, - }, - extensions = { - frecency = { - db_safe_mode = false, - matcher = "fuzzy", - }, - }, - }) - - telescope.load_extension("live_grep_args") - end, -} diff --git a/nvim/lua/plugins/nav/toggleterm.lua b/nvim/lua/plugins/nav/toggleterm.lua deleted file mode 100755 index da507dd..0000000 --- a/nvim/lua/plugins/nav/toggleterm.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - -- literally the name, quick term toggle - "akinsho/toggleterm.nvim", - version = "*", - opts = { - insert_mappings = false, - terminal_mappings = false, - open_mapping = "t", - direction = "float", - float_opts = { - border = "curved", - }, - }, - keys = { - { "", "ToggleTerm", desc = "Close Terminal", mode = "t" }, -- close terminal wih esc - { "t", "ToggleTerm", desc = "Open Terminal" }, -- close terminal wih esc - }, -} diff --git a/nvim/lua/plugins/nav/whichkey.lua b/nvim/lua/plugins/nav/whichkey.lua index 3aa1ccd..ca50289 100755 --- a/nvim/lua/plugins/nav/whichkey.lua +++ b/nvim/lua/plugins/nav/whichkey.lua @@ -1,10 +1,22 @@ return { - -- keybinds popup - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 500 - end, - opts = {}, + -- keybinds popup + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + preset = "modern" + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Start Which-Key", + mode = "n" + }, + }, } diff --git a/nvim/lua/plugins/snacks/init.lua b/nvim/lua/plugins/snacks/init.lua new file mode 100644 index 0000000..c8d058d --- /dev/null +++ b/nvim/lua/plugins/snacks/init.lua @@ -0,0 +1,33 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + animate = { enabled = true }, + bigfile = { enabled = true }, + bufdelete = { enabled = true }, + dashboard = require("plugins.snacks.modules.dashboard"), + indent = { + enabled = true, + indent = { + enabled = true, + priority = 1, + char = "▎", + }, + animate = { + enabled = false, + }, + scope = { + char = "▎", + }, + }, + terminal = require("plugins.snacks.modules.terminal"), + lazygit = { enabled = true }, + picker = { enabled = true }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + scope = { enabled = true }, + }, + keys = require("plugins.snacks.keys.keys"), +} diff --git a/nvim/lua/plugins/snacks/keys/keys.lua b/nvim/lua/plugins/snacks/keys/keys.lua new file mode 100644 index 0000000..12f2f0f --- /dev/null +++ b/nvim/lua/plugins/snacks/keys/keys.lua @@ -0,0 +1,260 @@ +return { + -- Git + { + "gl", + function() + Snacks.lazygit() + end, + desc = "Open LazyGit", + mode = "n", + }, + { + "gb", + function() + Snacks.git.blame_line() + end, + desc = "Open Git Blame for this line", + mode = "n", + }, + -- Colours + { + "fcs", + function() + Snacks.picker.highlights({ pattern = "hl_group:^Snacks" }) + end, + desc = "Show Snacks highlights", + mode = "n", + }, + { + "fca", + function() + Snacks.picker.highlights() + end, + desc = "Show highlight groups", + mode = "n", + }, + { + "fci", + function() + Snacks.picker.icons() + end, + desc = "Show icons", + mode = "n", + }, + -- Terminal + { + "t", + function() + Snacks.terminal() + end, + desc = "Open terminal", + }, + -- Tree + { + "e", + function() + Snacks.explorer() + end, + desc = "Open File Tree", + mode = "n", + }, + -- Pickers + { + "ff", + function() + Snacks.picker.files() + end, + desc = "Find file", + mode = "n", + }, + { + "fg", + function() + Snacks.picker.grep() + end, + desc = "Find file content using grep", + mode = "n", + }, + { + "fb", + function() + Snacks.picker.buffers() + end, + desc = "Show all buffers", + mode = "n", + }, + { + "fch", + function() + Snacks.picker.command_history() + end, + desc = "Show command history", + mode = "n", + }, + { + "fd", + function() + Snacks.picker.diagnostics() + end, + desc = "Show diagnostics", + mode = "n", + }, + { + "fm", + function() + Snacks.picker.git_diff() + end, + desc = "Show uncommitted diffs", + mode = "n", + }, + { + "fh", + function() + Snacks.picker.help() + end, + desc = "Show nvim help pages", + mode = "n", + }, + { + "fj", + function() + Snacks.picker.jumps() + end, + desc = "Show available jumps", + mode = "n", + }, + { + "fk", + function() + Snacks.picker.keymaps() + end, + desc = "Show keymaps", + mode = "n", + }, + { + "flc", + function() + Snacks.picker.lsp_config() + end, + desc = "Show LSP configs", + mode = "n", + }, + { + "gd", + function() + Snacks.picker.lsp_definitions() + end, + desc = "Goto definitions", + mode = "n", + }, + { + "gi", + function() + Snacks.picker.lsp_implementations() + end, + desc = "Goto implementations", + mode = "n", + }, + { + "gR", + function() + Snacks.picker.lsp_references() + end, + desc = "Goto references", + mode = "n", + }, + { + "gD", + function() + Snacks.picker.lsp_declarations() + end, + desc = "Goto declaration", + mode = "n", + }, + { + "gy", + function() + Snacks.picker.lsp_type_definitions() + end, + desc = "Goto T[y]pe Definition", + }, + { + "gai", + function() + Snacks.picker.lsp_incoming_calls() + end, + desc = "C[a]lls Incoming", + }, + { + "gao", + function() + Snacks.picker.lsp_outgoing_calls() + end, + desc = "C[a]lls Outgoing", + }, + { + "gs", + function() + Snacks.picker.lsp_symbols() + end, + desc = "Show LSP symbols", + mode = "n", + }, + { + "fn", + function() + Snacks.picker.noice() + end, + desc = "Show notifications", + mode = "n", + }, + { + "fp", + function() + Snacks.picker.projects() + end, + desc = "Show recent projects", + mode = "n", + }, + { + "fr", + function() + Snacks.picker.recent() + end, + desc = "Show recent files", + mode = "n", + }, + { + "fs", + function() + Snacks.picker.spelling() + end, + desc = "Show spelling suggestions", + mode = "n", + }, + { + "zs", + function() + Snacks.picker.spelling() + end, + desc = "Show spelling suggestions", + mode = "n", + }, + { + "fo", + function() + Snacks.picker.treesitter() + end, + desc = "Show treesitter details", + mode = "n", + }, + -- Close buffer + { + "", + function() + Snacks.bufdelete() + end, + desc = "Close buffer", + mode = "n", + }, +} diff --git a/nvim/lua/plugins/snacks/modules/dashboard.lua b/nvim/lua/plugins/snacks/modules/dashboard.lua new file mode 100644 index 0000000..e4cf73f --- /dev/null +++ b/nvim/lua/plugins/snacks/modules/dashboard.lua @@ -0,0 +1,48 @@ +return { + enabled = true, + sections = { + { section = "header", hl = "SnacksDashboardHeader" }, + { + pane = 2, + section = "terminal", + cmd = "colorscript -e square", + height = 5, + padding = 1, + }, + { section = "keys", hl = "SnacksDashboardPrimary", gap = 1, padding = 1 }, + { + pane = 2, + icon = " ", + title = "Recent Files (in project)", + section = "recent_files", + indent = 2, + limit = 5, + padding = 1, + cwd = true, + }, + { + pane = 2, + icon = " ", + title = "Projects", + section = "projects", + indent = 2, + padding = 1, + limit = 4, + }, + { + pane = 2, + icon = " ", + title = "Git Status", + section = "terminal", + enabled = function() + return Snacks.git.get_root() ~= nil + end, + cmd = "git status --short --branch --renames", + height = 5, + padding = 1, + ttl = 5 * 60, + indent = 3, + }, + { section = "startup" }, + }, +} diff --git a/nvim/lua/plugins/snacks/modules/picker.lua b/nvim/lua/plugins/snacks/modules/picker.lua new file mode 100644 index 0000000..5f3ff99 --- /dev/null +++ b/nvim/lua/plugins/snacks/modules/picker.lua @@ -0,0 +1,5 @@ +return { + sources = { + explorer = {} + } +} diff --git a/nvim/lua/plugins/snacks/modules/terminal.lua b/nvim/lua/plugins/snacks/modules/terminal.lua new file mode 100644 index 0000000..180e3a6 --- /dev/null +++ b/nvim/lua/plugins/snacks/modules/terminal.lua @@ -0,0 +1,7 @@ +return { + win = { + style = "terminal", + position = "float", + border = "rounded", + }, +} diff --git a/nvim/lua/plugins/style/colors.lua b/nvim/lua/plugins/style/colors.lua index 6d5ef64..ff56616 100755 --- a/nvim/lua/plugins/style/colors.lua +++ b/nvim/lua/plugins/style/colors.lua @@ -44,6 +44,7 @@ return { bg2 = "#1b211e", -- Lighter bg (colorcolm folds) bg3 = "#252b28", -- Lighter bg (cursor line) bg4 = "#303633", -- Conceal, border fg + bgDark = "#0c0c0c", fg0 = "#dee4df", -- Lighter fg fg1 = "#dee4df", -- Default fg @@ -127,6 +128,8 @@ return { SnacksDashboardHeader = { fg = "palette.darkred" }, SnacksDashboardTitle = { fg = "palette.turquoise" }, SnacksIndentScope = { fg = "palette.lightblue" }, + NormalFloat = { bg = "palette.bgDark" }, + Directory = { fg = "palette.cyan" } }, }, }) diff --git a/nvim/lua/plugins/style/lualine.lua b/nvim/lua/plugins/style/lualine.lua index 0402851..36b305f 100755 --- a/nvim/lua/plugins/style/lualine.lua +++ b/nvim/lua/plugins/style/lualine.lua @@ -21,7 +21,7 @@ return { statusline = {}, winbar = {}, }, - ignore_focus = { "neo-tree", "TelescopePrompt", "neo-tree-popup" }, + ignore_focus = { "snacks_picker_list", "snacks_input" }, always_divide_middle = true, globalstatus = false, refresh = { diff --git a/nvim/lua/plugins/style/noice.lua b/nvim/lua/plugins/style/noice.lua index f7b4ad5..f9d6754 100755 --- a/nvim/lua/plugins/style/noice.lua +++ b/nvim/lua/plugins/style/noice.lua @@ -15,11 +15,9 @@ return { }) require("noice").setup({ lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** override = { ["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp }, progress = { format = "lsp_progress", diff --git a/nvim/lua/plugins/style/todo-comments.lua b/nvim/lua/plugins/style/todo-comments.lua index 5e1851e..ff36ac7 100644 --- a/nvim/lua/plugins/style/todo-comments.lua +++ b/nvim/lua/plugins/style/todo-comments.lua @@ -1,71 +1,87 @@ return { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - event = "BufRead", - opts = { - { - signs = true, -- show icons in the signs column - sign_priority = 8, -- sign priority - -- keywords recognized as todo comments - keywords = { - FIX = { - icon = " ", -- icon used for the sign, and in search results - color = "error", -- can be a hex color, or a named color (see below) - alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords - -- signs = false, -- configure signs for some keywords individually - }, - TODO = { icon = " ", color = "todo" }, - HACK = { icon = " ", color = "warning" }, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, - TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - }, - gui_style = { - fg = "NONE", -- The gui style to use for the fg highlight group. - bg = "BOLD", -- The gui style to use for the bg highlight group. - }, - merge_keywords = true, -- when true, custom keywords will be merged with the defaults - -- highlighting of the line containing the todo comment - -- * before: highlights before the keyword (typically comment characters) - -- * keyword: highlights of the keyword - -- * after: highlights after the keyword (todo text) - highlight = { - multiline = true, -- enable multine todo comments - multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword - multiline_context = 10, -- extra lines that will be re-evaluated when changing a line - before = "", -- "fg" or "bg" or empty - keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) - after = "fg", -- "fg" or "bg" or empty - pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) - comments_only = true, -- uses treesitter to match keywords in comments only - max_line_len = 400, -- ignore lines longer than this - exclude = {}, -- list of file types to exclude highlighting - }, - -- list of named colors where we try to extract the guifg from the - -- list of highlight groups or use the hex color if hl not found as a fallback - colors = { - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, - todo = { "DiagnosticInfo", "#2563EB" }, - hint = { "DiagnosticHint", "#10B981" }, - default = { "Identifier", "#7C3AED" }, - test = { "Identifier", "#FF00FF" }, - }, - search = { - command = "rg", - args = { - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - }, - -- regex that will be used to match keywords. - -- don't replace the (KEYWORDS) placeholder - pattern = [[\b(KEYWORDS):]], -- ripgrep regex - -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives - }, - }, - }, + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + event = "BufRead", + opts = { + { + signs = true, -- show icons in the signs column + sign_priority = 8, -- sign priority + -- keywords recognized as todo comments + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "todo" }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + gui_style = { + fg = "NONE", -- The gui style to use for the fg highlight group. + bg = "BOLD", -- The gui style to use for the bg highlight group. + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + -- highlighting of the line containing the todo comment + -- * before: highlights before the keyword (typically comment characters) + -- * keyword: highlights of the keyword + -- * after: highlights after the keyword (todo text) + highlight = { + multiline = true, -- enable multine todo comments + multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = "", -- "fg" or "bg" or empty + keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = "fg", -- "fg" or "bg" or empty + pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting + }, + -- list of named colors where we try to extract the guifg from the + -- list of highlight groups or use the hex color if hl not found as a fallback + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + todo = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" }, + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + -- regex that will be used to match keywords. + -- don't replace the (KEYWORDS) placeholder + pattern = [[\b(KEYWORDS):]], -- ripgrep regex + -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives + }, + }, + }, + keys = { + { + "ft", + function() + Snacks.picker.todo_comments() + end, + desc = "Todo", + }, + { + "fT", + function() + Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) + end, + desc = "Todo/Fix/Fixme", + }, + }, } diff --git a/nvim/lua/plugins/util/context.lua b/nvim/lua/plugins/util/context.lua deleted file mode 100755 index 5d235c2..0000000 --- a/nvim/lua/plugins/util/context.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - -- similar to sticky scroll in vscode - "nvim-treesitter/nvim-treesitter-context", - event = "BufRead", - opts = { - max_lines = 4 - } -} diff --git a/nvim/lua/plugins/util/diff/diffview.lua b/nvim/lua/plugins/util/diff/diffview.lua deleted file mode 100644 index f42022d..0000000 --- a/nvim/lua/plugins/util/diff/diffview.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - -- Diffview - "sindrets/diffview.nvim", - keys = { - { "gd", ":DiffviewOpen", desc = "Open diffview" }, - { "gf", ":DiffviewFileHistory", desc = "View file history" }, - { "gc", ":DiffviewClose", desc = "Close diffview" }, - { "gr", ":DiffviewRefresh", desc = "Refresh diffview" }, - }, -} diff --git a/nvim/lua/plugins/util/diffview.lua b/nvim/lua/plugins/util/diffview.lua new file mode 100644 index 0000000..e9fd802 --- /dev/null +++ b/nvim/lua/plugins/util/diffview.lua @@ -0,0 +1,10 @@ +return { + -- Diffview + "sindrets/diffview.nvim", + keys = { + { "gdd", ":DiffviewOpen", desc = "Open diffview" }, + { "gdh", ":DiffviewFileHistory", desc = "View file history" }, + { "gdc", ":DiffviewClose", desc = "Close diffview" }, + { "gdr", ":DiffviewRefresh", desc = "Refresh diffview" }, + }, +} diff --git a/nvim/lua/plugins/util/multicursors.lua b/nvim/lua/plugins/util/multicursors.lua deleted file mode 100755 index d0682c5..0000000 --- a/nvim/lua/plugins/util/multicursors.lua +++ /dev/null @@ -1,17 +0,0 @@ -local utils = require("utils") -return { - "smoka7/multicursors.nvim", - dependencies = { - "nvimtools/hydra.nvim", - }, - opts = {}, - cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" }, - keys = { - { - mode = { "v", "n" }, - "c", - utils.run_vim_cmd("MCstart"), - desc = "Create a selection for selected text or word under the cursor", - }, - }, -} diff --git a/nvim/lua/plugins/util/snacks.lua b/nvim/lua/plugins/util/snacks.lua deleted file mode 100644 index 34eed4b..0000000 --- a/nvim/lua/plugins/util/snacks.lua +++ /dev/null @@ -1,114 +0,0 @@ -return { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - ---@type snacks.Config - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - animate = { enabled = true }, - bigfile = { enabled = true }, - bufdelete = { enabled = true }, - dashboard = { - enabled = true, - sections = { - { section = "header", hl = "SnacksDashboardHeader" }, - { - pane = 2, - section = "terminal", - cmd = "colorscript -e square", - height = 5, - padding = 1, - }, - { section = "keys", hl = "SnacksDashboardPrimary", gap = 1, padding = 1 }, - { - pane = 2, - icon = " ", - title = "Recent Files (in project)", - section = "recent_files", - indent = 2, - limit = 5, - padding = 1, - cwd = true, - }, - { - pane = 2, - icon = " ", - title = "Projects", - section = "projects", - indent = 2, - padding = 1, - limit = 4, - }, - { - pane = 2, - icon = " ", - title = "Git Status", - section = "terminal", - enabled = function() - return Snacks.git.get_root() ~= nil - end, - cmd = "git status --short --branch --renames", - height = 5, - padding = 1, - ttl = 5 * 60, - indent = 3, - }, - { section = "startup" }, - }, - }, - indent = { - enabled = true, - indent = { - enabled = true, - priority = 1, - char = "▎", - }, - animate = { - enabled = false, - }, - scope = { - char = "▎", - }, - }, - lazygit = { enabled = true }, - picker = { enabled = true }, - quickfile = { enabled = true }, - statuscolumn = { enabled = true }, - }, - keys = { - { - "gl", - function() - Snacks.lazygit() - end, - desc = "Open LazyGit", - mode = "n", - }, - { - "fcs", - function() - Snacks.picker.highlights({ pattern = "hl_group:^Snacks" }) - end, - desc = "Show Snacks highlights", - mode = "n", - }, - { - "fca", - function() - Snacks.picker.highlights() - end, - desc = "Show highlight groups", - mode = "n", - }, - { - "", - function() - Snacks.bufdelete() - end, - desc = "Close buffer", - mode = "n", - }, - }, -} diff --git a/nvim/snippets/snippets/tex.json b/nvim/snippets/snippets/tex.json index 302303b..1e97ae3 100755 --- a/nvim/snippets/snippets/tex.json +++ b/nvim/snippets/snippets/tex.json @@ -95,6 +95,20 @@ ], "description": "Prepares to write a LaTeX CheatSheet" }, + "glossary-entry": { + "prefix": "glossary-entry", + "body": [ + "\\newglossaryentry{$1}{", + "\tname={$2},", + "\tdescription={$3}\n}" + ] + }, + "acronym": { + "prefix": "acronym", + "body": [ + "\\newacronym{$1:id}{$2:abb}{$3:expanded}" + ] + }, "Fancy table": { "prefix": "table", "body": [