diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6c6d398a01..78ee3a7548 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,15 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install Neovim - shell: bash - run: | - mkdir -p /tmp/nvim - wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage - cd /tmp/nvim - chmod a+x ./nvim.appimage - ./nvim.appimage --appimage-extract - echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH + - uses: folke/github/neovim@main - name: Generate docs run: ./scripts/build_docs.sh - name: Push changes diff --git a/docs/configuration/general.md b/docs/configuration/general.md index ca2c8bf0ab..f12de88874 100644 --- a/docs/configuration/general.md +++ b/docs/configuration/general.md @@ -57,12 +57,22 @@ vim.g.maplocalleader = "\\" -- LazyVim auto format vim.g.autoformat = true +-- Snacks animations +-- Set to `false` to globally disable all snacks animations +vim.g.snacks_animate = true + -- LazyVim picker to use. -- Can be one of: telescope, fzf -- Leave it to "auto" to automatically use the picker -- enabled with `:LazyExtras` vim.g.lazyvim_picker = "auto" +-- LazyVim completion engine to use. +-- Can be one of: nvim-cmp, blink.cmp +-- Leave it to "auto" to automatically use the completion engine +-- enabled with `:LazyExtras` +vim.g.lazyvim_cmp = "auto" + -- if the completion engine supports the AI source, -- use that instead of inline suggestions vim.g.ai_cmp = true @@ -95,8 +105,8 @@ local opt = vim.opt opt.autowrite = true -- Enable auto write -- only set clipboard if not in ssh, to make sure the OSC 52 --- integration works automatically. Requires Neovim >= 0.10.0 -opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard +-- integration works automatically. +opt.clipboard = vim.env.SSH_CONNECTION and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions opt.confirm = true -- Confirm to save changes before exiting modified buffer @@ -111,7 +121,9 @@ opt.fillchars = { eob = " ", } opt.foldlevel = 99 -opt.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" +opt.foldmethod = "indent" +opt.foldtext = "" +opt.formatexpr = "v:lua.LazyVim.format.formatexpr()" opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" @@ -137,11 +149,12 @@ opt.sidescrolloff = 8 -- Columns of context opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.smartcase = true -- Don't ignore case with capitals opt.smartindent = true -- Insert indents automatically +opt.smoothscroll = true opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current -opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]] +opt.statuscolumn = [[%!v:lua.LazyVim.statuscolumn()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key @@ -153,16 +166,6 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -if vim.fn.has("nvim-0.10") == 1 then - opt.smoothscroll = true - opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" - opt.foldmethod = "expr" - opt.foldtext = "" -else - opt.foldmethod = "indent" - opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" -end - -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 @@ -234,8 +237,12 @@ map("n", "bo", function() end, { desc = "Delete Other Buffers" }) map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) --- Clear search with -map({ "i", "n" }, "", "noh", { desc = "Escape and Clear hlsearch" }) +-- Clear search and stop snippet on escape +map({ "i", "n", "s" }, "", function() + vim.cmd("noh") + LazyVim.cmp.actions.snippet_stop() + return "" +end, { expr = true, desc = "Escape and Clear hlsearch" }) -- Clear search, diff update and redraw -- taken from runtime/lua/_editor.lua @@ -266,8 +273,8 @@ map({ "i", "x", "n", "s" }, "", "w", { desc = "Save File" }) map("n", "K", "norm! K", { desc = "Keywordprg" }) -- better indenting -map("v", "<", "", ">gv") +map("x", "<", "", ">gv") -- commenting map("n", "gco", "oVcxnormal gccfxa", { desc = "Add Comment Below" }) @@ -279,23 +286,38 @@ map("n", "l", "Lazy", { desc = "Lazy" }) -- new file map("n", "fn", "enew", { desc = "New File" }) -map("n", "xl", "lopen", { desc = "Location List" }) -map("n", "xq", "copen", { desc = "Quickfix List" }) +-- location list +map("n", "xl", function() + local success, err = pcall(vim.fn.getloclist(0, { winid = 0 }).winid ~= 0 and vim.cmd.lclose or vim.cmd.lopen) + if not success and err then + vim.notify(err, vim.log.levels.ERROR) + end +end, { desc = "Location List" }) + +-- quickfix list +map("n", "xq", function() + local success, err = pcall(vim.fn.getqflist({ winid = 0 }).winid ~= 0 and vim.cmd.cclose or vim.cmd.copen) + if not success and err then + vim.notify(err, vim.log.levels.ERROR) + end +end, { desc = "Quickfix List" }) map("n", "[q", vim.cmd.cprev, { desc = "Previous Quickfix" }) map("n", "]q", vim.cmd.cnext, { desc = "Next Quickfix" }) -- formatting -map({ "n", "v" }, "cf", function() +map({ "n", "x" }, "cf", function() LazyVim.format({ force = true }) end, { desc = "Format" }) -- diagnostic local diagnostic_goto = function(next, severity) - local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev - severity = severity and vim.diagnostic.severity[severity] or nil return function() - go({ severity = severity }) + vim.diagnostic.jump({ + count = (next and 1 or -1) * vim.v.count1, + severity = severity and vim.diagnostic.severity[severity] or nil, + float = true, + }) end end map("n", "cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) @@ -311,15 +333,22 @@ map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) -- toggle options LazyVim.format.snacks_toggle():map("uf") LazyVim.format.snacks_toggle(true):map("uF") -Snacks.toggle.option("spell", { name = "Spelling"}):map("us") -Snacks.toggle.option("wrap", {name = "Wrap"}):map("uw") -Snacks.toggle.option("relativenumber", { name = "Relative Number"}):map("uL") +Snacks.toggle.option("spell", { name = "Spelling" }):map("us") +Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") +Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") Snacks.toggle.diagnostics():map("ud") Snacks.toggle.line_number():map("ul") -Snacks.toggle.option("conceallevel", {off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2, name = "Conceal Level"}):map("uc") -Snacks.toggle.option("showtabline", {off = 0, on = vim.o.showtabline > 0 and vim.o.showtabline or 2, name = "Tabline"}):map("uA") +Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2, name = "Conceal Level" }):map("uc") +Snacks.toggle.option("showtabline", { off = 0, on = vim.o.showtabline > 0 and vim.o.showtabline or 2, name = "Tabline" }):map("uA") Snacks.toggle.treesitter():map("uT") -Snacks.toggle.option("background", { off = "light", on = "dark" , name = "Dark Background"}):map("ub") +Snacks.toggle.option("background", { off = "light", on = "dark" , name = "Dark Background" }):map("ub") +Snacks.toggle.dim():map("uD") +Snacks.toggle.animate():map("ua") +Snacks.toggle.indent():map("ug") +Snacks.toggle.scroll():map("uS") +Snacks.toggle.profiler():map("dpp") +Snacks.toggle.profiler_highlights():map("dph") + if vim.lsp.inlay_hint then Snacks.toggle.inlay_hints():map("uh") end @@ -328,12 +357,12 @@ end if vim.fn.executable("lazygit") == 1 then map("n", "gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) map("n", "gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" }) - map("n", "gf", function() Snacks.lazygit.log_file() end, { desc = "Lazygit Current File History" }) - map("n", "gl", function() Snacks.lazygit.log({ cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" }) - map("n", "gL", function() Snacks.lazygit.log() end, { desc = "Lazygit Log (cwd)" }) end -map("n", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) +map("n", "gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" }) +map("n", "gb", function() Snacks.picker.git_log_line() end, { desc = "Git Blame Line" }) +map("n", "gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" }) +map("n", "gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" }) map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" }) map({"n", "x" }, "gY", function() Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false }) @@ -344,7 +373,7 @@ map("n", "qq", "qa", { desc = "Quit All" }) -- highlights under cursor map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) -map("n", "uI", "InspectTree", { desc = "Inspect Tree" }) +map("n", "uI", function() vim.treesitter.inspect_tree() vim.api.nvim_input("I") end, { desc = "Inspect Tree" }) -- LazyVim Changelog map("n", "L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" }) @@ -352,19 +381,15 @@ map("n", "L", function() LazyVim.news.changelog() end, { desc = "LazyVim -- floating terminal map("n", "fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" }) map("n", "ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) - --- Terminal Mappings -map("t", "", "close", { desc = "Hide Terminal" }) -map("t", "", "close", { desc = "which_key_ignore" }) +map({"n","t"}, "",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) +map({"n","t"}, "",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) -- windows -map("n", "w", "", { desc = "Windows", remap = true }) map("n", "-", "s", { desc = "Split Window Below", remap = true }) map("n", "|", "v", { desc = "Split Window Right", remap = true }) map("n", "wd", "c", { desc = "Delete Window", remap = true }) -LazyVim.ui.maximize():map("wm") +Snacks.toggle.zoom():map("wm"):map("uZ") +Snacks.toggle.zen():map("uz") -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) @@ -375,15 +400,8 @@ map("n", "]", "tabnext", { desc = "Next Tab" }) map("n", "d", "tabclose", { desc = "Close Tab" }) map("n", "[", "tabprevious", { desc = "Previous Tab" }) --- native snippets. only needed on < 0.11, as 0.11 creates these by default -if vim.fn.has("nvim-0.11") == 0 then - map("s", "", function() - return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, { expr = true, desc = "Jump Next" }) - map({ "i", "s" }, "", function() - return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, { expr = true, desc = "Jump Previous" }) -end +-- lua +map({"n", "x"}, "r", function() Snacks.debug.run() end, { desc = "Run Lua", ft = "lua" }) ``` @@ -398,7 +416,12 @@ end ```lua title="lua/config/autocmds.lua" -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- -- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") ``` @@ -474,7 +497,6 @@ vim.api.nvim_create_autocmd("FileType", { "neotest-summary", "notify", "qf", - "snacks_win", "spectre_panel", "startuptime", "tsplayground", diff --git a/docs/configuration/index.md b/docs/configuration/index.md index 57db7f7be2..a7309f9f6f 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -67,7 +67,6 @@ return { neovim = false, }, -- icons used by other plugins - -- stylua: ignore icons = { misc = { dots = "󰇘", @@ -124,7 +123,7 @@ return { Package = " ", Property = " ", Reference = " ", - Snippet = " ", + Snippet = "󱄽 ", String = " ", Struct = "󰆼 ", Supermaven = " ", diff --git a/docs/configuration/keymaps.md b/docs/configuration/keymaps.md index 50a40ea461..aff96a700c 100644 --- a/docs/configuration/keymaps.md +++ b/docs/configuration/keymaps.md @@ -20,23 +20,53 @@ For more info on configuring plugin keymaps, see [Adding & Disabling Plugin Keym ## LSP keymaps -These are the default keymaps that will be added when an LSP server is attached to the current buffer. +LSP keymaps are configured using the `keys` option in your LSP server configuration. +You can add global keymaps that apply to all LSP servers using the special `servers['*']` key, +or server-specific keymaps. + For more info see [Customizing LSP Keymaps](/plugins/lsp#%EF%B8%8F-customizing-lsp-keymaps) -### LSP Server keymaps +### Global LSP Keymaps + +Global LSP keymaps apply to all LSP servers: + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + ['*'] = { + keys = { + -- Add or change a keymap + { "K", vim.lsp.buf.hover, desc = "Hover" }, + -- Disable a keymap + { "gd", false }, + -- Capability-based keymap (only set if server supports it) + { "ca", vim.lsp.buf.code_action, desc = "Code Action", has = "codeAction" }, + }, + }, + }, + }, +} +``` + +### Server-Specific Keymaps -Sometimes it may be necessary to add keymaps for a specific LSP server. -Lazyutils provides a `keys` LSP option for this purpose. +Add keymaps for specific LSP servers: ```lua { "neovim/nvim-lspconfig", opts = { servers = { - tsserver = { + vtsls = { keys = { - { "co", "TypescriptOrganizeImports", desc = "Organize Imports" }, - { "cR", "TypescriptRenameFile", desc = "Rename File" }, + { "co", function() + vim.lsp.buf.code_action({ + apply = true, + context = { only = { "source.organizeImports" }, diagnostics = {} }, + }) + end, desc = "Organize Imports" }, }, }, }, diff --git a/docs/extras/ai/avante.md b/docs/extras/ai/avante.md new file mode 100644 index 0000000000..050ccf9539 --- /dev/null +++ b/docs/extras/ai/avante.md @@ -0,0 +1,268 @@ +# `Avante` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nui.nvim](https://github.com/MunifTanjim/nui.nvim) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "MunifTanjim/nui.nvim", lazy = true } +``` + + + + + +## [avante.nvim](https://github.com/yetone/avante.nvim) + + + + + +```lua +opts = { + provider = "copilot", + selection = { + hint_display = "none", + }, + behaviour = { + auto_set_keymaps = false, + }, +} +``` + + + + + + +```lua +{ + "yetone/avante.nvim", + build = vim.fn.has("win32") ~= 0 and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" + or "make", + event = "VeryLazy", + opts = { + provider = "copilot", + selection = { + hint_display = "none", + }, + behaviour = { + auto_set_keymaps = false, + }, + }, + cmd = { + "AvanteAsk", + "AvanteBuild", + "AvanteChat", + "AvanteClear", + "AvanteEdit", + "AvanteFocus", + "AvanteHistory", + "AvanteModels", + "AvanteRefresh", + "AvanteShowRepoMap", + "AvanteStop", + "AvanteSwitchProvider", + "AvanteToggle", + }, + keys = { + { "aa", "AvanteAsk", desc = "Ask Avante" }, + { "ac", "AvanteChat", desc = "Chat with Avante" }, + { "ae", "AvanteEdit", desc = "Edit Avante" }, + { "af", "AvanteFocus", desc = "Focus Avante" }, + { "ah", "AvanteHistory", desc = "Avante History" }, + { "am", "AvanteModels", desc = "Select Avante Model" }, + { "an", "AvanteChatNew", desc = "New Avante Chat" }, + { "ap", "AvanteSwitchProvider", desc = "Switch Avante Provider" }, + { "ar", "AvanteRefresh", desc = "Refresh Avante" }, + { "as", "AvanteStop", desc = "Stop Avante" }, + { "at", "AvanteToggle", desc = "Toggle Avante" }, + }, +} +``` + + + + + +## [blink-cmp-avante](https://github.com/Kaiser-Yang/blink-cmp-avante) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "Kaiser-Yang/blink-cmp-avante" } +``` + + + + + +## [img-clip.nvim](https://github.com/HakonHarnes/img-clip.nvim) _(optional)_ + + support for image pasting + + + + + + +```lua +opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, +} +``` + + + + + + +```lua +{ + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + optional = true, + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, +} +``` + + + + + +## [render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim) _(optional)_ + + Make sure to set this up properly if you have lazy=true + + + + + + +```lua +opts = { + file_types = { "markdown", "Avante" }, +} +``` + + + + + + +```lua +{ + "MeanderingProgrammer/render-markdown.nvim", + optional = true, + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, +} +``` + + + + + +## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ + + blink.cmp source for avante.nvim + + + + + + +```lua +opts = { + sources = { + default = { "avante" }, + providers = { avante = { module = "blink-cmp-avante", name = "Avante" } }, + }, +} +``` + + + + + + +```lua +{ + "saghen/blink.cmp", + optional = true, + specs = { "Kaiser-Yang/blink-cmp-avante" }, + opts = { + sources = { + default = { "avante" }, + providers = { avante = { module = "blink-cmp-avante", name = "Avante" } }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/ai/claudecode.md b/docs/extras/ai/claudecode.md new file mode 100644 index 0000000000..aae4686005 --- /dev/null +++ b/docs/extras/ai/claudecode.md @@ -0,0 +1,64 @@ +# `Claudecode` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [claudecode.nvim](https://github.com/coder/claudecode.nvim) + + + + + +```lua +opts = {} +``` + + + + + + +```lua +{ + "coder/claudecode.nvim", + opts = {}, + keys = { + { "a", "", desc = "+ai", mode = { "n", "v" } }, + { "ac", "ClaudeCode", desc = "Toggle Claude" }, + { "af", "ClaudeCodeFocus", desc = "Focus Claude" }, + { "ar", "ClaudeCode --resume", desc = "Resume Claude" }, + { "aC", "ClaudeCode --continue", desc = "Continue Claude" }, + { "ab", "ClaudeCodeAdd %", desc = "Add current buffer" }, + { "as", "ClaudeCodeSend", mode = "v", desc = "Send to Claude" }, + { + "as", + "ClaudeCodeTreeAdd", + desc = "Add file", + ft = { "NvimTree", "neo-tree", "oil" }, + }, + -- Diff management + { "aa", "ClaudeCodeDiffAccept", desc = "Accept diff" }, + { "ad", "ClaudeCodeDiffDeny", desc = "Deny diff" }, + }, +} +``` + + + + + + diff --git a/docs/extras/ai/codeium.md b/docs/extras/ai/codeium.md index c62a4700d1..18ad5612c9 100644 --- a/docs/extras/ai/codeium.md +++ b/docs/extras/ai/codeium.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ai.codeium" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -64,6 +49,7 @@ opts = { { "Exafunction/codeium.nvim", cmd = "Codeium", + event = "InsertEnter", build = ":Codeium Auth", opts = { enable_cmp_source = vim.g.ai_cmp, @@ -174,29 +160,6 @@ opts = nil -## [blink.compat](https://github.com/saghen/blink.compat) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -"saghen/blink.compat" -``` - - - - - ## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ codeium cmp source @@ -223,7 +186,7 @@ end ```lua { - "nvim-cmp", + "hrsh7th/nvim-cmp", optional = true, dependencies = { "codeium.nvim" }, opts = function(_, opts) @@ -272,42 +235,4 @@ end -## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ - - - - - -```lua -opts = { - sources = { - compat = { "codeium" }, - providers = { codeium = { kind = "Codeium" } }, - }, -} -``` - - - - - - -```lua -{ - "saghen/blink.cmp", - optional = true, - dependencies = { "codeium.nvim", "saghen/blink.compat" }, - opts = { - sources = { - compat = { "codeium" }, - providers = { codeium = { kind = "Codeium" } }, - }, - }, -} -``` - - - - - diff --git a/docs/extras/ai/copilot-chat.md b/docs/extras/ai/copilot-chat.md index c61cf19fd6..8239b0135e 100644 --- a/docs/extras/ai/copilot-chat.md +++ b/docs/extras/ai/copilot-chat.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ai.copilot-chat" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -44,8 +29,11 @@ opts = function() user = user:sub(1, 1):upper() .. user:sub(2) return { auto_insert_mode = true, - question_header = " " .. user .. " ", - answer_header = " Copilot ", + headers = { + user = " " .. user .. " ", + assistant = " Copilot ", + tool = "󰊳 Tool ", + }, window = { width = 0.4, }, @@ -68,8 +56,11 @@ end user = user:sub(1, 1):upper() .. user:sub(2) return { auto_insert_mode = true, - question_header = " " .. user .. " ", - answer_header = " Copilot ", + headers = { + user = " " .. user .. " ", + assistant = " Copilot ", + tool = "󰊳 Tool ", + }, window = { width = 0.4, }, @@ -77,14 +68,14 @@ end end, keys = { { "", "", ft = "copilot-chat", desc = "Submit Prompt", remap = true }, - { "a", "", desc = "+ai", mode = { "n", "v" } }, + { "a", "", desc = "+ai", mode = { "n", "x" } }, { "aa", function() return require("CopilotChat").toggle() end, desc = "Toggle (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, { "ax", @@ -92,21 +83,30 @@ end return require("CopilotChat").reset() end, desc = "Clear (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, { "aq", function() - local input = vim.fn.input("Quick Chat: ") - if input ~= "" then - require("CopilotChat").ask(input) - end + vim.ui.input({ + prompt = "Quick Chat: ", + }, function(input) + if input ~= "" then + require("CopilotChat").ask(input) + end + end) end, desc = "Quick Chat (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, + }, + { + "ap", + function() + require("CopilotChat").select_prompt() + end, + desc = "Prompt Actions (CopilotChat)", + mode = { "n", "x" }, }, - -- Show prompts actions with telescope - { "ap", M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, }, config = function(_, opts) local chat = require("CopilotChat") @@ -172,4 +172,58 @@ end +## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ + + Blink integration + + + + + + +```lua +opts = { + sources = { + providers = { + path = { + -- Path sources triggered by "/" interfere with CopilotChat commands + enabled = function() + return vim.bo.filetype ~= "copilot-chat" + end, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "saghen/blink.cmp", + optional = true, + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + sources = { + providers = { + path = { + -- Path sources triggered by "/" interfere with CopilotChat commands + enabled = function() + return vim.bo.filetype ~= "copilot-chat" + end, + }, + }, + }, + }, +} +``` + + + + + diff --git a/docs/extras/ai/copilot-native.md b/docs/extras/ai/copilot-native.md new file mode 100644 index 0000000000..45bf519e40 --- /dev/null +++ b/docs/extras/ai/copilot-native.md @@ -0,0 +1,207 @@ +# `Copilot-native` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +### Options + +Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: + +```lua title="lua/config/options.lua" +-- Native inline completions don't support being shown as regular completions +vim.g.ai_cmp = false +``` + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + copilot-language-server + + + + + + +```lua +opts = { + servers = { + copilot = { + -- stylua: ignore + keys = { + { + "", + function() vim.lsp.inline_completion.select({ count = 1 }) end, + desc = "Next Copilot Suggestion", + mode = { "i", "n" }, + }, + { + "", + function() vim.lsp.inline_completion.select({ count = -1 }) end, + desc = "Prev Copilot Suggestion", + mode = { "i", "n" }, + }, + }, + }, + }, + setup = { + copilot = function() + vim.schedule(function() + vim.lsp.inline_completion.enable() + end) + -- Accept inline suggestions or next edits + LazyVim.cmp.actions.ai_accept = function() + return vim.lsp.inline_completion.get() + end + + if not LazyVim.has_extra("ai.sidekick") then + vim.lsp.config("copilot", { + handlers = { + didChangeStatus = function(err, res, ctx) + if err then + return + end + status[ctx.client_id] = res.kind ~= "Normal" and "error" or res.busy and "pending" or "ok" + if res.status == "Error" then + LazyVim.error("Please use `:LspCopilotSignIn` to sign in to Copilot") + end + end, + }, + }) + end + end, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + copilot = { + -- stylua: ignore + keys = { + { + "", + function() vim.lsp.inline_completion.select({ count = 1 }) end, + desc = "Next Copilot Suggestion", + mode = { "i", "n" }, + }, + { + "", + function() vim.lsp.inline_completion.select({ count = -1 }) end, + desc = "Prev Copilot Suggestion", + mode = { "i", "n" }, + }, + }, + }, + }, + setup = { + copilot = function() + vim.schedule(function() + vim.lsp.inline_completion.enable() + end) + -- Accept inline suggestions or next edits + LazyVim.cmp.actions.ai_accept = function() + return vim.lsp.inline_completion.get() + end + + if not LazyVim.has_extra("ai.sidekick") then + vim.lsp.config("copilot", { + handlers = { + didChangeStatus = function(err, res, ctx) + if err then + return + end + status[ctx.client_id] = res.kind ~= "Normal" and "error" or res.busy and "pending" or "ok" + if res.status == "Error" then + LazyVim.error("Please use `:LspCopilotSignIn` to sign in to Copilot") + end + end, + }, + }) + end + end, + }, + }, +} +``` + + + + + +## [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) _(optional)_ + + lualine + + + + + + +```lua +opts = function(_, opts) + if LazyVim.has_extra("ai.sidekick") then + return + end + table.insert( + opts.sections.lualine_x, + 2, + LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() + local clients = vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) + return #clients > 0 and status[clients[1].id] or nil + end) + ) +end +``` + + + + + + +```lua +{ + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + if LazyVim.has_extra("ai.sidekick") then + return + end + table.insert( + opts.sections.lualine_x, + 2, + LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() + local clients = vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) + return #clients > 0 and status[clients[1].id] or nil + end) + ) + end, +} +``` + + + + + + diff --git a/docs/extras/ai/copilot.md b/docs/extras/ai/copilot.md index 15cfa5169f..5a1b5a4376 100644 --- a/docs/extras/ai/copilot.md +++ b/docs/extras/ai/copilot.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ai.copilot" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -46,6 +31,7 @@ opts = { suggestion = { enabled = not vim.g.ai_cmp, auto_trigger = true, + hide_during_completion = vim.g.ai_cmp, keymap = { accept = false, -- handled by nvim-cmp / blink.cmp next = "", @@ -70,11 +56,12 @@ opts = { "zbirenbaum/copilot.lua", cmd = "Copilot", build = ":Copilot auth", - event = "InsertEnter", + event = "BufReadPost", opts = { suggestion = { enabled = not vim.g.ai_cmp, auto_trigger = true, + hide_during_completion = vim.g.ai_cmp, keymap = { accept = false, -- handled by nvim-cmp / blink.cmp next = "", @@ -94,9 +81,9 @@ opts = { -## [copilot.lua](https://github.com/zbirenbaum/copilot.lua) +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - add ai_accept action + copilot-language-server @@ -104,15 +91,12 @@ opts = { ```lua -opts = function() - LazyVim.cmp.actions.ai_accept = function() - if require("copilot.suggestion").is_visible() then - LazyVim.create_undo() - require("copilot.suggestion").accept() - return true - end - end -end +opts = { + servers = { + -- copilot.lua only works with its own copilot lsp server + copilot = { enabled = false }, + }, +} ``` @@ -122,16 +106,13 @@ end ```lua { - "zbirenbaum/copilot.lua", - opts = function() - LazyVim.cmp.actions.ai_accept = function() - if require("copilot.suggestion").is_visible() then - LazyVim.create_undo() - require("copilot.suggestion").accept() - return true - end - end - end, + "neovim/nvim-lspconfig", + opts = { + servers = { + -- copilot.lua only works with its own copilot lsp server + copilot = { enabled = false }, + }, + }, } ``` @@ -139,9 +120,9 @@ end -## [copilot-cmp](https://github.com/zbirenbaum/copilot-cmp) +## [copilot.lua](https://github.com/zbirenbaum/copilot.lua) - this will only be evaluated if nvim-cmp is enabled + add ai_accept action @@ -149,7 +130,15 @@ end ```lua -opts = {} +opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("copilot.suggestion").is_visible() then + LazyVim.create_undo() + require("copilot.suggestion").accept() + return true + end + end +end ``` @@ -159,32 +148,16 @@ opts = {} ```lua { - "zbirenbaum/copilot-cmp", - enabled = vim.g.ai_cmp, -- only enable if wanted - opts = {}, - config = function(_, opts) - local copilot_cmp = require("copilot_cmp") - copilot_cmp.setup(opts) - -- attach cmp source whenever copilot attaches - -- fixes lazy-loading issues with the copilot cmp source - LazyVim.lsp.on_attach(function() - copilot_cmp._on_insert_enter({}) - end, "copilot") + "zbirenbaum/copilot.lua", + opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("copilot.suggestion").is_visible() then + LazyVim.create_undo() + require("copilot.suggestion").accept() + return true + end + end end, - specs = { - { - "nvim-cmp", - optional = true, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) - end, - }, - }, } ``` @@ -192,29 +165,6 @@ opts = {} -## [blink-cmp-copilot](https://github.com/giuxtaposition/blink-cmp-copilot) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -{ "giuxtaposition/blink-cmp-copilot" } -``` - - - - - ## [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) _(optional)_ lualine @@ -230,9 +180,9 @@ opts = function(_, opts) opts.sections.lualine_x, 2, LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() - local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} + local clients = package.loaded["copilot"] and vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} if #clients > 0 then - local status = require("copilot.api").status.data.status + local status = require("copilot.status").data.status return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" end end) @@ -255,9 +205,9 @@ end opts.sections.lualine_x, 2, LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() - local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} + local clients = package.loaded["copilot"] and vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} if #clients > 0 then - local status = require("copilot.api").status.data.status + local status = require("copilot.status").data.status return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" end end) @@ -270,157 +220,4 @@ end -## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ - - copilot cmp source - - - - - - -```lua -opts = nil -``` - - - - - - -```lua -{ - "nvim-cmp", - optional = true, - dependencies = { -- this will only be evaluated if nvim-cmp is enabled - { - "zbirenbaum/copilot-cmp", - enabled = vim.g.ai_cmp, -- only enable if wanted - opts = {}, - config = function(_, opts) - local copilot_cmp = require("copilot_cmp") - copilot_cmp.setup(opts) - -- attach cmp source whenever copilot attaches - -- fixes lazy-loading issues with the copilot cmp source - LazyVim.lsp.on_attach(function() - copilot_cmp._on_insert_enter({}) - end, "copilot") - end, - specs = { - { - "nvim-cmp", - optional = true, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) - end, - }, - }, - }, - }, -} -``` - - - - - -## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ - - - - - -```lua -opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) -end -``` - - - - - - -```lua -{ - "nvim-cmp", - optional = true, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) - end, -} -``` - - - - - -## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ - - - - - -```lua -opts = { - sources = { - completion = { - enabled_providers = { "copilot" }, - }, - providers = { - copilot = { - name = "copilot", - module = "blink-cmp-copilot", - kind = "Copilot", - }, - }, - }, -} -``` - - - - - - -```lua -{ - "saghen/blink.cmp", - optional = true, - dependencies = { "giuxtaposition/blink-cmp-copilot" }, - opts = { - sources = { - completion = { - enabled_providers = { "copilot" }, - }, - providers = { - copilot = { - name = "copilot", - module = "blink-cmp-copilot", - kind = "Copilot", - }, - }, - }, - }, -} -``` - - - - - diff --git a/docs/extras/ai/sidekick.md b/docs/extras/ai/sidekick.md new file mode 100644 index 0000000000..5e4a775581 --- /dev/null +++ b/docs/extras/ai/sidekick.md @@ -0,0 +1,335 @@ +# `Sidekick` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + copilot-language-server + + + + + + +```lua +opts = function(_, opts) + local sk = LazyVim.opts("sidekick.nvim") ---@type sidekick.Config|{} + if vim.tbl_get(sk, "nes", "enabled") ~= false then + opts.servers = opts.servers or {} + opts.servers.copilot = opts.servers.copilot or {} + end +end +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = function(_, opts) + local sk = LazyVim.opts("sidekick.nvim") ---@type sidekick.Config|{} + if vim.tbl_get(sk, "nes", "enabled") ~= false then + opts.servers = opts.servers or {} + opts.servers.copilot = opts.servers.copilot or {} + end + end, +} +``` + + + + + +## [sidekick.nvim](https://github.com/folke/sidekick.nvim) + + + + + +```lua +opts = function() + -- Accept inline suggestions or next edits + LazyVim.cmp.actions.ai_nes = function() + local Nes = require("sidekick.nes") + if Nes.have() and (Nes.jump() or Nes.apply()) then + return true + end + end + Snacks.toggle({ + name = "Sidekick NES", + get = function() + return require("sidekick.nes").enabled + end, + set = function(state) + require("sidekick.nes").enable(state) + end, + }):map("uN") +end +``` + + + + + + +```lua +{ + "folke/sidekick.nvim", + opts = function() + -- Accept inline suggestions or next edits + LazyVim.cmp.actions.ai_nes = function() + local Nes = require("sidekick.nes") + if Nes.have() and (Nes.jump() or Nes.apply()) then + return true + end + end + Snacks.toggle({ + name = "Sidekick NES", + get = function() + return require("sidekick.nes").enabled + end, + set = function(state) + require("sidekick.nes").enable(state) + end, + }):map("uN") + end, + -- stylua: ignore + keys = { + -- nes is also useful in normal mode + { "", LazyVim.cmp.map({ "ai_nes" }, ""), mode = { "n" }, expr = true }, + { "a", "", desc = "+ai", mode = { "n", "v" } }, + { + "", + function() require("sidekick.cli").toggle() end, + desc = "Sidekick Toggle", + mode = { "n", "t", "i", "x" }, + }, + { + "aa", + function() require("sidekick.cli").toggle() end, + desc = "Sidekick Toggle CLI", + }, + { + "as", + function() require("sidekick.cli").select() end, + -- Or to select only installed tools: + -- require("sidekick.cli").select({ filter = { installed = true } }) + desc = "Select CLI", + }, + { + "ad", + function() require("sidekick.cli").close() end, + desc = "Detach a CLI Session", + }, + { + "at", + function() require("sidekick.cli").send({ msg = "{this}" }) end, + mode = { "x", "n" }, + desc = "Send This", + }, + { + "af", + function() require("sidekick.cli").send({ msg = "{file}" }) end, + desc = "Send File", + }, + { + "av", + function() require("sidekick.cli").send({ msg = "{selection}" }) end, + mode = { "x" }, + desc = "Send Visual Selection", + }, + { + "ap", + function() require("sidekick.cli").prompt() end, + mode = { "n", "x" }, + desc = "Sidekick Select Prompt", + }, + }, +} +``` + + + + + +## [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) _(optional)_ + + lualine + + + + + + +```lua +opts = function(_, opts) + local icons = { + Error = { " ", "DiagnosticError" }, + Inactive = { " ", "MsgArea" }, + Warning = { " ", "DiagnosticWarn" }, + Normal = { LazyVim.config.icons.kinds.Copilot, "Special" }, + } + table.insert(opts.sections.lualine_x, 2, { + function() + local status = require("sidekick.status").get() + return status and vim.tbl_get(icons, status.kind, 1) + end, + cond = function() + return require("sidekick.status").get() ~= nil + end, + color = function() + local status = require("sidekick.status").get() + local hl = status and (status.busy and "DiagnosticWarn" or vim.tbl_get(icons, status.kind, 2)) + return { fg = Snacks.util.color(hl) } + end, + }) + + table.insert(opts.sections.lualine_x, 2, { + function() + local status = require("sidekick.status").cli() + return " " .. (#status > 1 and #status or "") + end, + cond = function() + return #require("sidekick.status").cli() > 0 + end, + color = function() + return { fg = Snacks.util.color("Special") } + end, + }) +end +``` + + + + + + +```lua +{ + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + local icons = { + Error = { " ", "DiagnosticError" }, + Inactive = { " ", "MsgArea" }, + Warning = { " ", "DiagnosticWarn" }, + Normal = { LazyVim.config.icons.kinds.Copilot, "Special" }, + } + table.insert(opts.sections.lualine_x, 2, { + function() + local status = require("sidekick.status").get() + return status and vim.tbl_get(icons, status.kind, 1) + end, + cond = function() + return require("sidekick.status").get() ~= nil + end, + color = function() + local status = require("sidekick.status").get() + local hl = status and (status.busy and "DiagnosticWarn" or vim.tbl_get(icons, status.kind, 2)) + return { fg = Snacks.util.color(hl) } + end, + }) + + table.insert(opts.sections.lualine_x, 2, { + function() + local status = require("sidekick.status").cli() + return " " .. (#status > 1 and #status or "") + end, + cond = function() + return #require("sidekick.status").cli() > 0 + end, + color = function() + return { fg = Snacks.util.color("Special") } + end, + }) + end, +} +``` + + + + + +## [snacks.nvim](https://github.com/folke/snacks.nvim) _(optional)_ + + + + + +```lua +opts = { + picker = { + actions = { + sidekick_send = function(...) + return require("sidekick.cli.picker.snacks").send(...) + end, + }, + win = { + input = { + keys = { + [""] = { + "sidekick_send", + mode = { "n", "i" }, + }, + }, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + optional = true, + opts = { + picker = { + actions = { + sidekick_send = function(...) + return require("sidekick.cli.picker.snacks").send(...) + end, + }, + win = { + input = { + keys = { + [""] = { + "sidekick_send", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/ai/supermaven.md b/docs/extras/ai/supermaven.md index 8ae1908487..d609f68140 100644 --- a/docs/extras/ai/supermaven.md +++ b/docs/extras/ai/supermaven.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ai.supermaven" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -44,6 +29,7 @@ opts = { accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp }, disable_inline_completion = vim.g.ai_cmp, + ignore_filetypes = { "bigfile", "snacks_input", "snacks_notif" }, } ``` @@ -55,11 +41,17 @@ opts = { ```lua { "supermaven-inc/supermaven-nvim", + event = "InsertEnter", + cmd = { + "SupermavenUseFree", + "SupermavenUsePro", + }, opts = { keymaps = { accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp }, disable_inline_completion = vim.g.ai_cmp, + ignore_filetypes = { "bigfile", "snacks_input", "snacks_notif" }, }, } ``` @@ -167,29 +159,6 @@ opts = nil -## [blink.compat](https://github.com/saghen/blink.compat) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -"saghen/blink.compat" -``` - - - - - ## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ cmp integration @@ -237,127 +206,4 @@ end -## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ - - - - - -```lua -opts = { - sources = { - compat = { "supermaven" }, - providers = { supermaven = { kind = "Supermaven" } }, - }, -} -``` - - - - - - -```lua -{ - "saghen/blink.cmp", - optional = true, - dependencies = { "supermaven-nvim", "saghen/blink.compat" }, - opts = { - sources = { - compat = { "supermaven" }, - providers = { supermaven = { kind = "Supermaven" } }, - }, - }, -} -``` - - - - - -## [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) _(optional)_ - - - - - -```lua -opts = function(_, opts) - table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("supermaven")) -end -``` - - - - - - -```lua -{ - "nvim-lualine/lualine.nvim", - optional = true, - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("supermaven")) - end, -} -``` - - - - - -## [noice.nvim](https://github.com/folke/noice.nvim) _(optional)_ - - - - - -```lua -opts = function(_, opts) - vim.list_extend(opts.routes, { - { - filter = { - event = "msg_show", - any = { - { find = "Starting Supermaven" }, - { find = "Supermaven Free Tier" }, - }, - }, - skip = true, - }, - }) -end -``` - - - - - - -```lua -{ - "folke/noice.nvim", - optional = true, - opts = function(_, opts) - vim.list_extend(opts.routes, { - { - filter = { - event = "msg_show", - any = { - { find = "Starting Supermaven" }, - { find = "Supermaven Free Tier" }, - }, - }, - skip = true, - }, - }) - end, -} -``` - - - - - diff --git a/docs/extras/ai/tabnine.md b/docs/extras/ai/tabnine.md index f2470d060c..871fe61db5 100644 --- a/docs/extras/ai/tabnine.md +++ b/docs/extras/ai/tabnine.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ai.tabnine" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -172,7 +157,7 @@ end ```lua { - "nvim-cmp", + "hrsh7th/nvim-cmp", optional = true, dependencies = { "tzachar/cmp-tabnine" }, ---@param opts cmp.ConfigSchema @@ -207,7 +192,13 @@ end opts = { sources = { compat = { "cmp_tabnine" }, - providers = { cmp_tabnine = { kind = "TabNine" } }, + providers = { + cmp_tabnine = { + kind = "TabNine", + score_offset = 100, + async = true, + }, + }, }, } ``` @@ -225,7 +216,13 @@ opts = { opts = { sources = { compat = { "cmp_tabnine" }, - providers = { cmp_tabnine = { kind = "TabNine" } }, + providers = { + cmp_tabnine = { + kind = "TabNine", + score_offset = 100, + async = true, + }, + }, }, }, } diff --git a/docs/extras/coding/blink.md b/docs/extras/coding/blink.md index eeff7ae384..b0c234dc25 100644 --- a/docs/extras/coding/blink.md +++ b/docs/extras/coding/blink.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.blink" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -51,6 +36,10 @@ import TabItem from '@theme/TabItem'; ```lua opts = { + snippets = { + preset = "default", + }, + appearance = { -- sets the fallback highlight groups to nvim-cmp's highlight groups -- useful for when your theme doesn't support blink.cmp @@ -60,6 +49,7 @@ opts = { -- adjusts spacing to ensure icons are aligned nerd_font_variant = "mono", }, + completion = { accept = { -- experimental auto-brackets support @@ -69,7 +59,7 @@ opts = { }, menu = { draw = { - treesitter = true, + treesitter = { "lsp" }, }, }, documentation = { @@ -88,18 +78,30 @@ opts = { -- adding any nvim-cmp sources here will enable them -- with blink.compat compat = {}, + default = { "lsp", "path", "snippets", "buffer" }, + }, + + cmdline = { + enabled = true, + keymap = { + preset = "cmdline", + [""] = false, + [""] = false, + }, completion = { - -- remember to enable your providers here - enabled_providers = { "lsp", "path", "snippets", "buffer" }, + list = { selection = { preselect = false } }, + menu = { + auto_show = function(ctx) + return vim.fn.getcmdtype() == ":" + end, + }, + ghost_text = { enabled = true }, }, }, keymap = { preset = "enter", - [""] = { - LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), - "fallback", - }, + [""] = { "select_and_accept" }, }, } ``` @@ -117,6 +119,7 @@ opts = { opts_extend = { "sources.completion.enabled_providers", "sources.compat", + "sources.default", }, dependencies = { "rafamadriz/friendly-snippets", @@ -128,11 +131,15 @@ opts = { version = not vim.g.lazyvim_blink_main and "*", }, }, - event = "InsertEnter", + event = { "InsertEnter", "CmdlineEnter" }, ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { + snippets = { + preset = "default", + }, + appearance = { -- sets the fallback highlight groups to nvim-cmp's highlight groups -- useful for when your theme doesn't support blink.cmp @@ -142,6 +149,7 @@ opts = { -- adjusts spacing to ensure icons are aligned nerd_font_variant = "mono", }, + completion = { accept = { -- experimental auto-brackets support @@ -151,7 +159,7 @@ opts = { }, menu = { draw = { - treesitter = true, + treesitter = { "lsp" }, }, }, documentation = { @@ -170,24 +178,39 @@ opts = { -- adding any nvim-cmp sources here will enable them -- with blink.compat compat = {}, + default = { "lsp", "path", "snippets", "buffer" }, + }, + + cmdline = { + enabled = true, + keymap = { + preset = "cmdline", + [""] = false, + [""] = false, + }, completion = { - -- remember to enable your providers here - enabled_providers = { "lsp", "path", "snippets", "buffer" }, + list = { selection = { preselect = false } }, + menu = { + auto_show = function(ctx) + return vim.fn.getcmdtype() == ":" + end, + }, + ghost_text = { enabled = true }, }, }, keymap = { preset = "enter", - [""] = { - LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), - "fallback", - }, + [""] = { "select_and_accept" }, }, }, ---@param opts blink.cmp.Config | { sources: { compat: string[] } } config = function(_, opts) + if opts.snippets and opts.snippets.preset == "default" then + opts.snippets.expand = LazyVim.cmp.expand + end -- setup compat sources - local enabled = opts.sources.completion.enabled_providers + local enabled = opts.sources.default for _, source in ipairs(opts.sources.compat or {}) do opts.sources.providers[source] = vim.tbl_deep_extend( "force", @@ -199,11 +222,36 @@ opts = { end end + -- add ai_accept to key + if not opts.keymap[""] then + if opts.keymap.preset == "super-tab" then -- super-tab + opts.keymap[""] = { + require("blink.cmp.keymap.presets").get("super-tab")[""][1], + LazyVim.cmp.map({ "snippet_forward", "ai_nes", "ai_accept" }), + "fallback", + } + else -- other presets + opts.keymap[""] = { + LazyVim.cmp.map({ "snippet_forward", "ai_nes", "ai_accept" }), + "fallback", + } + end + end + + -- Unset custom prop to pass blink.cmp validation + opts.sources.compat = nil + -- check if we need to override symbol kinds for _, provider in pairs(opts.sources.providers or {}) do ---@cast provider blink.cmp.SourceProviderConfig|{kind?:string} if provider.kind then - require("blink.cmp.types").CompletionItemKind[provider.kind] = provider.kind + local CompletionItemKind = require("blink.cmp.types").CompletionItemKind + local kind_idx = #CompletionItemKind + 1 + + CompletionItemKind[kind_idx] = provider.kind + ---@diagnostic disable-next-line: no-unknown + CompletionItemKind[provider.kind] = kind_idx + ---@type fun(ctx: blink.cmp.Context, items: blink.cmp.CompletionItem[]): blink.cmp.CompletionItem[] local transform_items = provider.transform_items ---@param ctx blink.cmp.Context @@ -211,10 +259,14 @@ opts = { provider.transform_items = function(ctx, items) items = transform_items and transform_items(ctx, items) or items for _, item in ipairs(items) do - item.kind = provider.kind or item.kind + item.kind = kind_idx or item.kind + item.kind_icon = LazyVim.config.icons.kinds[item.kind_name] or item.kind_icon or nil end return items end + + -- Unset custom prop to pass blink.cmp validation + provider.kind = nil end end @@ -271,7 +323,7 @@ opts = nil ```lua opts = function(_, opts) opts.appearance = opts.appearance or {} - opts.appearance.kind_icons = LazyVim.config.icons.kinds + opts.appearance.kind_icons = vim.tbl_extend("force", opts.appearance.kind_icons or {}, LazyVim.config.icons.kinds) end ``` @@ -285,7 +337,7 @@ end "saghen/blink.cmp", opts = function(_, opts) opts.appearance = opts.appearance or {} - opts.appearance.kind_icons = LazyVim.config.icons.kinds + opts.appearance.kind_icons = vim.tbl_extend("force", opts.appearance.kind_icons or {}, LazyVim.config.icons.kinds) end, } ``` @@ -306,18 +358,14 @@ end ```lua opts = { sources = { - completion = { - -- add lazydev to your completion providers - enabled_providers = { "lazydev" }, + per_filetype = { + lua = { inherit_defaults = true, "lazydev" }, }, providers = { - lsp = { - -- dont show LuaLS require statements when lazydev has items - fallback_for = { "lazydev" }, - }, lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", + score_offset = 100, -- show at a higher priority than lsp }, }, }, @@ -334,18 +382,14 @@ opts = { "saghen/blink.cmp", opts = { sources = { - completion = { - -- add lazydev to your completion providers - enabled_providers = { "lazydev" }, + per_filetype = { + lua = { inherit_defaults = true, "lazydev" }, }, providers = { - lsp = { - -- dont show LuaLS require statements when lazydev has items - fallback_for = { "lazydev" }, - }, lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", + score_offset = 100, -- show at a higher priority than lsp }, }, }, diff --git a/docs/extras/coding/luasnip.md b/docs/extras/coding/luasnip.md index d1cba40817..5c009f50e9 100644 --- a/docs/extras/coding/luasnip.md +++ b/docs/extras/coding/luasnip.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.luasnip" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -65,6 +50,7 @@ opts = { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load({ paths = { vim.fn.stdpath("config") .. "/snippets" } }) end, }, }, @@ -99,6 +85,7 @@ opts = {} "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load({ paths = { vim.fn.stdpath("config") .. "/snippets" } }) end, } ``` @@ -120,7 +107,15 @@ opts = {} opts = function() LazyVim.cmp.actions.snippet_forward = function() if require("luasnip").jumpable(1) then - require("luasnip").jump(1) + vim.schedule(function() + require("luasnip").jump(1) + end) + return true + end + end + LazyVim.cmp.actions.snippet_stop = function() + if require("luasnip").expand_or_jumpable() then -- or just jumpable(1) is fine? + require("luasnip").unlink_current() return true end end @@ -138,7 +133,15 @@ end opts = function() LazyVim.cmp.actions.snippet_forward = function() if require("luasnip").jumpable(1) then - require("luasnip").jump(1) + vim.schedule(function() + require("luasnip").jump(1) + end) + return true + end + end + LazyVim.cmp.actions.snippet_stop = function() + if require("luasnip").expand_or_jumpable() then -- or just jumpable(1) is fine? + require("luasnip").unlink_current() return true end end @@ -163,52 +166,6 @@ opts = nil - - -```lua -{ "saadparwaiz1/cmp_luasnip" } -``` - - - - - -## [blink.compat](https://github.com/saghen/blink.compat) - - - - - -```lua -opts = { impersonate_nvim_cmp = true } -``` - - - - - - -```lua -{ "saghen/blink.compat", opts = { impersonate_nvim_cmp = true } } -``` - - - - - -## [cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip) - - - - - -```lua -opts = nil -``` - - - - ```lua @@ -246,7 +203,7 @@ end ```lua { - "nvim-cmp", + "hrsh7th/nvim-cmp", optional = true, dependencies = { "saadparwaiz1/cmp_luasnip" }, opts = function(_, opts) @@ -280,20 +237,8 @@ end ```lua opts = { - sources = { compat = { "luasnip" } }, snippets = { - expand = function(snippet) - require("luasnip").lsp_expand(snippet) - end, - active = function(filter) - if filter and filter.direction then - return require("luasnip").jumpable(filter.direction) - end - return require("luasnip").in_snippet() - end, - jump = function(direction) - require("luasnip").jump(direction) - end, + preset = "luasnip", }, } ``` @@ -307,25 +252,9 @@ opts = { { "saghen/blink.cmp", optional = true, - dependencies = { - { "saghen/blink.compat", opts = { impersonate_nvim_cmp = true } }, - { "saadparwaiz1/cmp_luasnip" }, - }, opts = { - sources = { compat = { "luasnip" } }, snippets = { - expand = function(snippet) - require("luasnip").lsp_expand(snippet) - end, - active = function(filter) - if filter and filter.direction then - return require("luasnip").jumpable(filter.direction) - end - return require("luasnip").in_snippet() - end, - jump = function(direction) - require("luasnip").jump(direction) - end, + preset = "luasnip", }, }, } diff --git a/docs/extras/coding/mini-comment.md b/docs/extras/coding/mini-comment.md index 3fb490b80d..1affa0afeb 100644 --- a/docs/extras/coding/mini-comment.md +++ b/docs/extras/coding/mini-comment.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.mini-comment" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.comment](https://github.com/echasnovski/mini.comment) +## [mini.comment](https://github.com/nvim-mini/mini.comment) @@ -55,7 +40,7 @@ opts = { ```lua { - "echasnovski/mini.comment", + "nvim-mini/mini.comment", event = "VeryLazy", opts = { options = { diff --git a/docs/extras/coding/mini-snippets.md b/docs/extras/coding/mini-snippets.md new file mode 100644 index 0000000000..5a5c70d48b --- /dev/null +++ b/docs/extras/coding/mini-snippets.md @@ -0,0 +1,340 @@ +# `Mini-snippets` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +### Options + +Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: + +```lua title="lua/config/options.lua" +-- Set to `false` to prevent "non-lsp snippets"" from appearing inside completion windows +-- Motivation: Less clutter in completion windows and a more direct usage of snippets +vim.g.lazyvim_mini_snippets_in_completion = true + +-- NOTE: Please also read: +-- https://github.com/nvim-mini/mini.nvim/blob/main/readmes/mini-snippets.md#expand +-- :h MiniSnippets-session + +-- Example override for your own config: +--[[ +return { +{ +"nvim-mini/mini.snippets", +opts = function(_, opts) +-- By default, for opts.snippets, the extra for mini.snippets only adds gen_loader.from_lang() +-- This provides a sensible quickstart, integrating with friendly-snippets +-- and your own language-specific snippets +-- +-- In order to change opts.snippets, replace the entire table inside your own opts + +local snippets, config_path = require("mini.snippets"), vim.fn.stdpath("config") + +opts.snippets = { -- override opts.snippets provided by extra... +-- Load custom file with global snippets first (order matters) +snippets.gen_loader.from_file(config_path .. "/snippets/global.json"), + +-- Load snippets based on current language by reading files from +-- "snippets/" subdirectories from 'runtimepath' directories. +snippets.gen_loader.from_lang(), -- this is the default in the extra... +} +end, +}, +} +--]] +``` + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [mini.snippets](https://github.com/nvim-mini/mini.snippets) + + + + + +```lua +opts = function() + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_stop = function() end -- by design, should not stop the session! + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_forward = function() + return jump("next") + end + + local mini_snippets = require("mini.snippets") + return { + snippets = { mini_snippets.gen_loader.from_lang() }, + + -- Following the behavior of vim.snippets, + -- the intended usage of is to be able to temporarily exit into normal mode for quick edits. + -- + -- If you'd rather stop the snippet on , activate the line below in your own config: + -- mappings = { stop = "" }, -- by default, see :h MiniSnippets-session + + expand = { + select = function(snippets, insert) + -- Close completion window on snippet select - vim.ui.select + -- Needed to remove virtual text for fzf-lua and telescope, but not for mini.pick... + local select = expand_select_override or MiniSnippets.default_select + select(snippets, insert) + end, + }, + } +end +``` + + + + + + +```lua +{ + "nvim-mini/mini.snippets", + event = "InsertEnter", -- don't depend on other plugins to load... + dependencies = "rafamadriz/friendly-snippets", + opts = function() + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_stop = function() end -- by design, should not stop the session! + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_forward = function() + return jump("next") + end + + local mini_snippets = require("mini.snippets") + return { + snippets = { mini_snippets.gen_loader.from_lang() }, + + -- Following the behavior of vim.snippets, + -- the intended usage of is to be able to temporarily exit into normal mode for quick edits. + -- + -- If you'd rather stop the snippet on , activate the line below in your own config: + -- mappings = { stop = "" }, -- by default, see :h MiniSnippets-session + + expand = { + select = function(snippets, insert) + -- Close completion window on snippet select - vim.ui.select + -- Needed to remove virtual text for fzf-lua and telescope, but not for mini.pick... + local select = expand_select_override or MiniSnippets.default_select + select(snippets, insert) + end, + }, + } + end, +} +``` + + + + + +## [cmp-mini-snippets](https://github.com/abeldekat/cmp-mini-snippets) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "abeldekat/cmp-mini-snippets" } +``` + + + + + +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ + + nvim-cmp integration + + + + + + +```lua +opts = function(_, opts) + local cmp = require("cmp") + local cmp_config = require("cmp.config") + + opts.snippet = { + expand = function(args) + expand_from_lsp(args.body) + cmp.resubscribe({ "TextChangedI", "TextChangedP" }) + cmp_config.set_onetime({ sources = {} }) + end, + } + + if include_in_completion then + table.insert(opts.sources, { name = "mini_snippets" }) + else + expand_select_override = function(snippets, insert) + -- stylua: ignore + if cmp.visible() then cmp.close() end + MiniSnippets.default_select(snippets, insert) + end + end +end +``` + + + + + + +```lua +{ + "hrsh7th/nvim-cmp", + optional = true, + dependencies = include_in_completion and { "abeldekat/cmp-mini-snippets" } or nil, + opts = function(_, opts) + local cmp = require("cmp") + local cmp_config = require("cmp.config") + + opts.snippet = { + expand = function(args) + expand_from_lsp(args.body) + cmp.resubscribe({ "TextChangedI", "TextChangedP" }) + cmp_config.set_onetime({ sources = {} }) + end, + } + + if include_in_completion then + table.insert(opts.sources, { name = "mini_snippets" }) + else + expand_select_override = function(snippets, insert) + -- stylua: ignore + if cmp.visible() then cmp.close() end + MiniSnippets.default_select(snippets, insert) + end + end + end, + -- stylua: ignore + -- counterpart to defined in cmp.mappings + keys = include_in_completion and { { "", function() jump("prev") end, mode = "i" } } or nil, +} +``` + + + + + +## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ + + blink.cmp integration + + + + + + +```lua +opts = function(_, opts) + -- Return early + if include_in_completion then + opts.snippets = { preset = "mini_snippets" } + return + end + + -- Standalone -- + local blink = require("blink.cmp") + expand_select_override = function(snippets, insert) + -- Schedule, otherwise blink's virtual text is not removed on vim.ui.select + blink.cancel() + vim.schedule(function() + MiniSnippets.default_select(snippets, insert) + end) + end + -- + -- Blink performs a require on blink.cmp.sources.snippets.default + -- By removing the source, that default engine will not be used + opts.sources.default = vim.tbl_filter(function(source) + return source ~= "snippets" + end, opts.sources.default) + opts.snippets = { -- need to repeat blink's preset here + expand = function(snippet) + expand_from_lsp(snippet) + blink.resubscribe() + end, + active = function() + return MiniSnippets.session.get(false) ~= nil + end, + jump = function(direction) + jump(direction == -1 and "prev" or "next") + end, + } +end +``` + + + + + + +```lua +{ + "saghen/blink.cmp", + optional = true, + opts = function(_, opts) + -- Return early + if include_in_completion then + opts.snippets = { preset = "mini_snippets" } + return + end + + -- Standalone -- + local blink = require("blink.cmp") + expand_select_override = function(snippets, insert) + -- Schedule, otherwise blink's virtual text is not removed on vim.ui.select + blink.cancel() + vim.schedule(function() + MiniSnippets.default_select(snippets, insert) + end) + end + -- + -- Blink performs a require on blink.cmp.sources.snippets.default + -- By removing the source, that default engine will not be used + opts.sources.default = vim.tbl_filter(function(source) + return source ~= "snippets" + end, opts.sources.default) + opts.snippets = { -- need to repeat blink's preset here + expand = function(snippet) + expand_from_lsp(snippet) + blink.resubscribe() + end, + active = function() + return MiniSnippets.session.get(false) ~= nil + end, + jump = function(direction) + jump(direction == -1 and "prev" or "next") + end, + } + end, +} +``` + + + + + + diff --git a/docs/extras/coding/mini-surround.md b/docs/extras/coding/mini-surround.md index 46b8803cda..18936e944b 100644 --- a/docs/extras/coding/mini-surround.md +++ b/docs/extras/coding/mini-surround.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.mini-surround" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.surround](https://github.com/echasnovski/mini.surround) +## [mini.surround](https://github.com/nvim-mini/mini.surround) @@ -59,13 +44,12 @@ opts = { ```lua { - "echasnovski/mini.surround", - recommended = true, + "nvim-mini/mini.surround", keys = function(_, keys) -- Populate the keys based on the user's options local opts = LazyVim.opts("mini.surround") local mappings = { - { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, + { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "x" } }, { opts.mappings.delete, desc = "Delete Surrounding" }, { opts.mappings.find, desc = "Find Right Surrounding" }, { opts.mappings.find_left, desc = "Find Left Surrounding" }, diff --git a/docs/extras/coding/neogen.md b/docs/extras/coding/neogen.md index f7c9e860f6..d3270a726e 100644 --- a/docs/extras/coding/neogen.md +++ b/docs/extras/coding/neogen.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.neogen" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -46,6 +31,7 @@ opts = function(_, opts) local map = { ["LuaSnip"] = "luasnip", + ["mini.snippets"] = "mini", ["nvim-snippy"] = "snippy", ["vim-vsnip"] = "vsnip", } @@ -71,6 +57,7 @@ end ```lua { "danymat/neogen", + dependencies = LazyVim.has("mini.snippets") and { "mini.snippets" } or {}, cmd = "Neogen", keys = { { @@ -88,6 +75,7 @@ end local map = { ["LuaSnip"] = "luasnip", + ["mini.snippets"] = "mini", ["nvim-snippy"] = "snippy", ["vim-vsnip"] = "vsnip", } diff --git a/docs/extras/coding/nvim-cmp.md b/docs/extras/coding/nvim-cmp.md new file mode 100644 index 0000000000..162e0be8da --- /dev/null +++ b/docs/extras/coding/nvim-cmp.md @@ -0,0 +1,383 @@ +# `Nvim-cmp` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) + + Setup nvim-cmp + + + + + + +```lua +opts = function() + -- Register nvim-cmp lsp capabilities + vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() }) + + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + local auto_select = true + return { + auto_brackets = {}, -- configure any filetype to auto add brackets + completion = { + completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), + }, + preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.complete(), + [""] = LazyVim.cmp.confirm({ select = auto_select }), + [""] = LazyVim.cmp.confirm({ select = true }), + [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + cmp.abort() + fallback() + end, + [""] = function(fallback) + return LazyVim.cmp.map({ "snippet_forward", "ai_nes", "ai_accept" }, fallback)() + end, + }), + sources = cmp.config.sources({ + { name = "lazydev" }, + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + formatting = { + format = function(entry, item) + local icons = LazyVim.config.icons.kinds + if icons[item.kind] then + item.kind = icons[item.kind] .. item.kind + end + + local widths = { + abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, + menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, + } + + for key, width in pairs(widths) do + if item[key] and vim.fn.strdisplaywidth(item[key]) > width then + item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" + end + end + + return item + end, + }, + experimental = { + -- only show ghost text when we show ai completions + ghost_text = vim.g.ai_cmp and { + hl_group = "CmpGhostText", + } or false, + }, + sorting = defaults.sorting, + } +end +``` + + + + + + +```lua +{ + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + -- Not all LSP servers add brackets when completing a function. + -- To better deal with this, LazyVim adds a custom option to cmp, + -- that you can configure. For example: + -- + -- ```lua + -- opts = { + -- auto_brackets = { "python" } + -- } + -- ``` + opts = function() + -- Register nvim-cmp lsp capabilities + vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() }) + + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + local auto_select = true + return { + auto_brackets = {}, -- configure any filetype to auto add brackets + completion = { + completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), + }, + preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.complete(), + [""] = LazyVim.cmp.confirm({ select = auto_select }), + [""] = LazyVim.cmp.confirm({ select = true }), + [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + cmp.abort() + fallback() + end, + [""] = function(fallback) + return LazyVim.cmp.map({ "snippet_forward", "ai_nes", "ai_accept" }, fallback)() + end, + }), + sources = cmp.config.sources({ + { name = "lazydev" }, + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + formatting = { + format = function(entry, item) + local icons = LazyVim.config.icons.kinds + if icons[item.kind] then + item.kind = icons[item.kind] .. item.kind + end + + local widths = { + abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, + menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, + } + + for key, width in pairs(widths) do + if item[key] and vim.fn.strdisplaywidth(item[key]) > width then + item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" + end + end + + return item + end, + }, + experimental = { + -- only show ghost text when we show ai completions + ghost_text = vim.g.ai_cmp and { + hl_group = "CmpGhostText", + } or false, + }, + sorting = defaults.sorting, + } + end, + main = "lazyvim.util.cmp", +} +``` + + + + + +## [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", +} +``` + + + + + +## [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +"hrsh7th/cmp-buffer" +``` + + + + + +## [cmp-path](https://github.com/hrsh7th/cmp-path) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +"hrsh7th/cmp-path" +``` + + + + + +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) + + snippets + + + + + + +```lua +opts = function(_, opts) + opts.snippet = { + expand = function(item) + return LazyVim.cmp.expand(item.body) + end, + } + if LazyVim.has("nvim-snippets") then + table.insert(opts.sources, { name = "snippets" }) + end +end +``` + + + + + + +```lua +{ + "hrsh7th/nvim-cmp", + dependencies = { + { + "garymjr/nvim-snippets", + opts = { + friendly_snippets = true, + }, + dependencies = { "rafamadriz/friendly-snippets" }, + }, + }, + opts = function(_, opts) + opts.snippet = { + expand = function(item) + return LazyVim.cmp.expand(item.body) + end, + } + if LazyVim.has("nvim-snippets") then + table.insert(opts.sources, { name = "snippets" }) + end + end, +} +``` + + + + + +## [nvim-snippets](https://github.com/garymjr/nvim-snippets) + + + + + +```lua +opts = { + friendly_snippets = true, +} +``` + + + + + + +```lua +{ + "garymjr/nvim-snippets", + opts = { + friendly_snippets = true, + }, + dependencies = { "rafamadriz/friendly-snippets" }, +} +``` + + + + + +## [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "rafamadriz/friendly-snippets" } +``` + + + + + + diff --git a/docs/extras/coding/yanky.md b/docs/extras/coding/yanky.md index d59d2ac426..4ae853c7c1 100644 --- a/docs/extras/coding/yanky.md +++ b/docs/extras/coding/yanky.md @@ -9,21 +9,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.coding.yanky" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -42,6 +27,9 @@ import TabItem from '@theme/TabItem'; ```lua opts = { + system_clipboard = { + sync_with_ring = not vim.env.SSH_CONNECTION, + }, highlight = { timer = 150 }, } ``` @@ -58,6 +46,9 @@ opts = { desc = "Better Yank/Paste", event = "LazyFile", opts = { + system_clipboard = { + sync_with_ring = not vim.env.SSH_CONNECTION, + }, highlight = { timer = 150 }, }, keys = { @@ -66,6 +57,8 @@ opts = { function() if LazyVim.pick.picker.name == "telescope" then require("telescope").extensions.yank_history.yank_history({}) + elseif LazyVim.pick.picker.name == "snacks" then + Snacks.picker.yanky() else vim.cmd([[YankyRingHistory]]) end diff --git a/docs/extras/dap/core.md b/docs/extras/dap/core.md index a097e1a5d4..b3a46c7e6f 100644 --- a/docs/extras/dap/core.md +++ b/docs/extras/dap/core.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.dap.core" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -64,7 +49,6 @@ opts = {} -- stylua: ignore keys = { - { "d", "", desc = "+debug", mode = {"n", "v"} }, { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, { "dc", function() require("dap").continue() end, desc = "Run/Continue" }, @@ -77,7 +61,7 @@ opts = {} { "dl", function() require("dap").run_last() end, desc = "Run Last" }, { "do", function() require("dap").step_out() end, desc = "Step Out" }, { "dO", function() require("dap").step_over() end, desc = "Step Over" }, - { "dp", function() require("dap").pause() end, desc = "Pause" }, + { "dP", function() require("dap").pause() end, desc = "Pause" }, { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, { "ds", function() require("dap").session() end, desc = "Session" }, { "dt", function() require("dap").terminate() end, desc = "Terminate" }, @@ -198,7 +182,7 @@ opts = {} -- stylua: ignore keys = { { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, - { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "x"} }, }, opts = {}, config = function(_, opts) diff --git a/docs/extras/dap/nlua.md b/docs/extras/dap/nlua.md index 2ac503de08..297966cc8b 100644 --- a/docs/extras/dap/nlua.md +++ b/docs/extras/dap/nlua.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.dap.nlua" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/editor/aerial.md b/docs/extras/editor/aerial.md index c992153478..59d0f6e840 100644 --- a/docs/extras/editor/aerial.md +++ b/docs/extras/editor/aerial.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.aerial" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/editor/dial.md b/docs/extras/editor/dial.md index a2237c8f5a..0cbf7d4c33 100644 --- a/docs/extras/editor/dial.md +++ b/docs/extras/editor/dial.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.dial" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -157,6 +142,11 @@ opts = function() }), }, markdown = { + augend.constant.new({ + elements = { "[ ]", "[x]" }, + word = false, + cyclic = true, + }), augend.misc.alias.markdown_header, }, json = { @@ -193,8 +183,8 @@ end keys = { { "", function() return M.dial(true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, { "", function() return M.dial(false) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, - { "g", function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, - { "g", function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, + { "g", function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "x"} }, + { "g", function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "x"} }, }, opts = function() local augend = require("dial.augend") @@ -314,6 +304,11 @@ end }), }, markdown = { + augend.constant.new({ + elements = { "[ ]", "[x]" }, + word = false, + cyclic = true, + }), augend.misc.alias.markdown_header, }, json = { diff --git a/docs/extras/editor/fzf.md b/docs/extras/editor/fzf.md index a2d04a60d8..b62fbb20d9 100644 --- a/docs/extras/editor/fzf.md +++ b/docs/extras/editor/fzf.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.fzf" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -50,8 +35,9 @@ import TabItem from '@theme/TabItem'; ```lua opts = function(_, opts) - local config = require("fzf-lua.config") - local actions = require("fzf-lua.actions") + local fzf = require("fzf-lua") + local config = fzf.config + local actions = fzf.actions -- Quickfix config.defaults.keymap.fzf["ctrl-q"] = "select-all+accept" @@ -125,9 +111,9 @@ opts = function(_, opts) winopts = { layout = "vertical", -- height is number of items minus 15 lines for the preview, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16, + height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 4) + 0.5) + 16, width = 0.5, - preview = not vim.tbl_isempty(LazyVim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { + preview = not vim.tbl_isempty(vim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { layout = "vertical", vertical = "down:15,border-top", hidden = "hidden", @@ -140,7 +126,7 @@ opts = function(_, opts) winopts = { width = 0.5, -- height is number of items, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5), + height = math.floor(math.min(vim.o.lines * 0.8, #items + 4) + 0.5), }, }) end, @@ -194,8 +180,9 @@ end "ibhagwan/fzf-lua", cmd = "FzfLua", opts = function(_, opts) - local config = require("fzf-lua.config") - local actions = require("fzf-lua.actions") + local fzf = require("fzf-lua") + local config = fzf.config + local actions = fzf.actions -- Quickfix config.defaults.keymap.fzf["ctrl-q"] = "select-all+accept" @@ -269,9 +256,9 @@ end winopts = { layout = "vertical", -- height is number of items minus 15 lines for the preview, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16, + height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 4) + 0.5) + 16, width = 0.5, - preview = not vim.tbl_isempty(LazyVim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { + preview = not vim.tbl_isempty(vim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { layout = "vertical", vertical = "down:15,border-top", hidden = "hidden", @@ -284,7 +271,7 @@ end winopts = { width = 0.5, -- height is number of items, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5), + height = math.floor(math.min(vim.o.lines * 0.8, #items + 4) + 0.5), }, }) end, @@ -367,6 +354,7 @@ end { "", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, -- find { "fb", "FzfLua buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, + { "fB", "FzfLua buffers", desc = "Buffers (all)" }, { "fc", LazyVim.pick.config_files(), desc = "Find Config File" }, { "ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, { "fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, @@ -375,15 +363,19 @@ end { "fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, -- git { "gc", "FzfLua git_commits", desc = "Commits" }, + { "gd", "FzfLua git_diff", desc = "Git Diff (hunks)" }, + { "gl", "FzfLua git_commits", desc = "Commits" }, { "gs", "FzfLua git_status", desc = "Status" }, + { "gS", "FzfLua git_stash", desc = "Git Stash" }, -- search { 's"', "FzfLua registers", desc = "Registers" }, + { "s/", "FzfLua search_history", desc = "Search History" }, { "sa", "FzfLua autocmds", desc = "Auto Commands" }, - { "sb", "FzfLua grep_curbuf", desc = "Buffer" }, + { "sb", "FzfLua lines", desc = "Buffer Lines" }, { "sc", "FzfLua command_history", desc = "Command History" }, { "sC", "FzfLua commands", desc = "Commands" }, - { "sd", "FzfLua diagnostics_document", desc = "Document Diagnostics" }, - { "sD", "FzfLua diagnostics_workspace", desc = "Workspace Diagnostics" }, + { "sd", "FzfLua diagnostics_workspace", desc = "Diagnostics" }, + { "sD", "FzfLua diagnostics_document", desc = "Buffer Diagnostics" }, { "sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, { "sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, { "sh", "FzfLua help_tags", desc = "Help Pages" }, @@ -397,8 +389,8 @@ end { "sq", "FzfLua quickfix", desc = "Quickfix List" }, { "sw", LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" }, { "sW", LazyVim.pick("grep_cword", { root = false }), desc = "Word (cwd)" }, - { "sw", LazyVim.pick("grep_visual"), mode = "v", desc = "Selection (Root Dir)" }, - { "sW", LazyVim.pick("grep_visual", { root = false }), mode = "v", desc = "Selection (cwd)" }, + { "sw", LazyVim.pick("grep_visual"), mode = "x", desc = "Selection (Root Dir)" }, + { "sW", LazyVim.pick("grep_visual", { root = false }), mode = "x", desc = "Selection (cwd)" }, { "uC", LazyVim.pick("colorschemes"), desc = "Colorscheme with Preview" }, { "ss", @@ -456,16 +448,19 @@ opts = nil ```lua -opts = function() - local Keys = require("lazyvim.plugins.lsp.keymaps").get() - -- stylua: ignore - vim.list_extend(Keys, { - { "gd", "FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, - { "gr", "FzfLua lsp_references jump_to_single_result=true ignore_current_line=true", desc = "References", nowait = true }, - { "gI", "FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true", desc = "Goto Implementation" }, - { "gy", "FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, - }) -end +opts = { + servers = { + -- stylua: ignore + ["*"] = { + keys = { + { "gd", "FzfLua lsp_definitions jump1=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, + { "gr", "FzfLua lsp_references jump1=true ignore_current_line=true", desc = "References", nowait = true }, + { "gI", "FzfLua lsp_implementations jump1=true ignore_current_line=true", desc = "Goto Implementation" }, + { "gy", "FzfLua lsp_typedefs jump1=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, + } + }, + }, +} ``` @@ -476,16 +471,19 @@ end ```lua { "neovim/nvim-lspconfig", - opts = function() - local Keys = require("lazyvim.plugins.lsp.keymaps").get() - -- stylua: ignore - vim.list_extend(Keys, { - { "gd", "FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, - { "gr", "FzfLua lsp_references jump_to_single_result=true ignore_current_line=true", desc = "References", nowait = true }, - { "gI", "FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true", desc = "Goto Implementation" }, - { "gy", "FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, - }) - end, + opts = { + servers = { + -- stylua: ignore + ["*"] = { + keys = { + { "gd", "FzfLua lsp_definitions jump1=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, + { "gr", "FzfLua lsp_references jump1=true ignore_current_line=true", desc = "References", nowait = true }, + { "gI", "FzfLua lsp_implementations jump1=true ignore_current_line=true", desc = "Goto Implementation" }, + { "gy", "FzfLua lsp_typedefs jump1=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, + } + }, + }, + }, } ``` diff --git a/docs/extras/editor/harpoon2.md b/docs/extras/editor/harpoon2.md index 69e65c1c75..6f751e77c2 100644 --- a/docs/extras/editor/harpoon2.md +++ b/docs/extras/editor/harpoon2.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.harpoon2" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -85,7 +70,7 @@ opts = { }, } - for i = 1, 5 do + for i = 1, 9 do table.insert(keys, { "" .. i, function() diff --git a/docs/extras/editor/illuminate.md b/docs/extras/editor/illuminate.md index e8d7b96f31..af10eba063 100644 --- a/docs/extras/editor/illuminate.md +++ b/docs/extras/editor/illuminate.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.illuminate" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,6 +17,32 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + disable snacks words + + + + + + +```lua +opts = { words = { enabled = false } } +``` + + + + + + +```lua +{ "snacks.nvim", opts = { words = { enabled = false } } } +``` + + + + + ## [vim-illuminate](https://github.com/RRethy/vim-illuminate) @@ -111,30 +122,4 @@ opts = { -## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - - - - - -```lua -opts = { document_highlight = { enabled = false } } -``` - - - - - - -```lua -{ - "neovim/nvim-lspconfig", - opts = { document_highlight = { enabled = false } }, -} -``` - - - - - diff --git a/docs/extras/editor/inc-rename.md b/docs/extras/editor/inc-rename.md index 1d3d268c36..87e4036a17 100644 --- a/docs/extras/editor/inc-rename.md +++ b/docs/extras/editor/inc-rename.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.inc-rename" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -69,19 +54,24 @@ opts = {} ```lua -opts = function() - local keys = require("lazyvim.plugins.lsp.keymaps").get() - keys[#keys + 1] = { - "cr", - function() - local inc_rename = require("inc_rename") - return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") - end, - expr = true, - desc = "Rename (inc-rename.nvim)", - has = "rename", - } -end +opts = { + servers = { + ["*"] = { + keys = { + { + "cr", + function() + local inc_rename = require("inc_rename") + return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") + end, + expr = true, + desc = "Rename (inc-rename.nvim)", + has = "rename", + }, + }, + }, + }, +} ``` @@ -92,19 +82,24 @@ end ```lua { "neovim/nvim-lspconfig", - opts = function() - local keys = require("lazyvim.plugins.lsp.keymaps").get() - keys[#keys + 1] = { - "cr", - function() - local inc_rename = require("inc_rename") - return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") - end, - expr = true, - desc = "Rename (inc-rename.nvim)", - has = "rename", - } - end, + opts = { + servers = { + ["*"] = { + keys = { + { + "cr", + function() + local inc_rename = require("inc_rename") + return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") + end, + expr = true, + desc = "Rename (inc-rename.nvim)", + has = "rename", + }, + }, + }, + }, + }, } ``` diff --git a/docs/extras/editor/leap.md b/docs/extras/editor/leap.md index e6e6b8fa7a..f4fbd8542b 100644 --- a/docs/extras/editor/leap.md +++ b/docs/extras/editor/leap.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.leap" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -136,7 +121,7 @@ opts = nil
-## [mini.surround](https://github.com/echasnovski/mini.surround) _(optional)_ +## [mini.surround](https://github.com/nvim-mini/mini.surround) _(optional)_ rename surround mappings from gs to gz to prevent conflict with leap @@ -166,7 +151,7 @@ opts = { ```lua { - "echasnovski/mini.surround", + "nvim-mini/mini.surround", optional = true, opts = { mappings = { diff --git a/docs/extras/editor/mini-diff.md b/docs/extras/editor/mini-diff.md index ff33921305..68ed550696 100644 --- a/docs/extras/editor/mini-diff.md +++ b/docs/extras/editor/mini-diff.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.mini-diff" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.diff](https://github.com/echasnovski/mini.diff) +## [mini.diff](https://github.com/nvim-mini/mini.diff) setup mini.diff @@ -61,7 +46,7 @@ opts = { ```lua { - "echasnovski/mini.diff", + "nvim-mini/mini.diff", event = "VeryLazy", keys = { { @@ -89,7 +74,7 @@ opts = {
-## [mini.diff](https://github.com/echasnovski/mini.diff) +## [mini.diff](https://github.com/nvim-mini/mini.diff) diff --git a/docs/extras/editor/mini-files.md b/docs/extras/editor/mini-files.md index 0c5a95b0dd..cc8aa5f9f3 100644 --- a/docs/extras/editor/mini-files.md +++ b/docs/extras/editor/mini-files.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.mini-files" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.files](https://github.com/echasnovski/mini.files) +## [mini.files](https://github.com/nvim-mini/mini.files) @@ -60,7 +45,7 @@ opts = { ```lua { - "echasnovski/mini.files", + "nvim-mini/mini.files", opts = { windows = { preview = true, diff --git a/docs/extras/editor/mini-move.md b/docs/extras/editor/mini-move.md index 12c03e75f2..e9038ffb60 100644 --- a/docs/extras/editor/mini-move.md +++ b/docs/extras/editor/mini-move.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.mini-move" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.move](https://github.com/echasnovski/mini.move) +## [mini.move](https://github.com/nvim-mini/mini.move) @@ -49,7 +34,7 @@ opts = {} ```lua { - "echasnovski/mini.move", + "nvim-mini/mini.move", event = "VeryLazy", opts = {}, } diff --git a/docs/extras/editor/navic.md b/docs/extras/editor/navic.md index 0b4bd48c18..7e5f82a1f4 100644 --- a/docs/extras/editor/navic.md +++ b/docs/extras/editor/navic.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.navic" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -45,6 +30,9 @@ import TabItem from '@theme/TabItem'; ```lua opts = function() + Snacks.util.lsp.on({ method = "textDocument/documentSymbol" }, function(buffer, client) + require("nvim-navic").attach(client, buffer) + end) return { separator = " ", highlight = true, @@ -66,13 +54,11 @@ end lazy = true, init = function() vim.g.navic_silence = true - LazyVim.lsp.on_attach(function(client, buffer) - if client.supports_method("textDocument/documentSymbol") then - require("nvim-navic").attach(client, buffer) - end - end) end, opts = function() + Snacks.util.lsp.on({ method = "textDocument/documentSymbol" }, function(buffer, client) + require("nvim-navic").attach(client, buffer) + end) return { separator = " ", highlight = true, diff --git a/docs/extras/editor/neo-tree.md b/docs/extras/editor/neo-tree.md new file mode 100644 index 0000000000..5d036ff1f8 --- /dev/null +++ b/docs/extras/editor/neo-tree.md @@ -0,0 +1,213 @@ +# `Neo-tree` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) + + file explorer + + + + + + +```lua +opts = { + sources = { "filesystem", "buffers", "git_status" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = true }, + use_libuv_file_watcher = true, + }, + window = { + mappings = { + ["l"] = "open", + ["h"] = "close_node", + [""] = "none", + ["Y"] = { + function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + desc = "Copy Path to Clipboard", + }, + ["O"] = { + function(state) + require("lazy.util").open(state.tree:get_node().path, { system = true }) + end, + desc = "Open with System Application", + }, + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + default_component_configs = { + indent = { + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + git_status = { + symbols = { + unstaged = "󰄱", + staged = "󰱒", + }, + }, + }, +} +``` + + + + + + +```lua +{ + "nvim-neo-tree/neo-tree.nvim", + cmd = "Neotree", + keys = { + { + "fe", + function() + require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) + end, + desc = "Explorer NeoTree (Root Dir)", + }, + { + "fE", + function() + require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) + end, + desc = "Explorer NeoTree (cwd)", + }, + { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, + { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, + { + "ge", + function() + require("neo-tree.command").execute({ source = "git_status", toggle = true }) + end, + desc = "Git Explorer", + }, + { + "be", + function() + require("neo-tree.command").execute({ source = "buffers", toggle = true }) + end, + desc = "Buffer Explorer", + }, + }, + deactivate = function() + vim.cmd([[Neotree close]]) + end, + init = function() + -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, + -- because `cwd` is not set up properly. + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), + desc = "Start Neo-tree with directory", + once = true, + callback = function() + if package.loaded["neo-tree"] then + return + else + local stats = vim.uv.fs_stat(vim.fn.argv(0)) + if stats and stats.type == "directory" then + require("neo-tree") + end + end + end, + }) + end, + opts = { + sources = { "filesystem", "buffers", "git_status" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = true }, + use_libuv_file_watcher = true, + }, + window = { + mappings = { + ["l"] = "open", + ["h"] = "close_node", + [""] = "none", + ["Y"] = { + function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + desc = "Copy Path to Clipboard", + }, + ["O"] = { + function(state) + require("lazy.util").open(state.tree:get_node().path, { system = true }) + end, + desc = "Open with System Application", + }, + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + default_component_configs = { + indent = { + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + git_status = { + symbols = { + unstaged = "󰄱", + staged = "󰱒", + }, + }, + }, + }, + config = function(_, opts) + local function on_move(data) + Snacks.rename.on_rename_file(data.source, data.destination) + end + + local events = require("neo-tree.events") + opts.event_handlers = opts.event_handlers or {} + vim.list_extend(opts.event_handlers, { + { event = events.FILE_MOVED, handler = on_move }, + { event = events.FILE_RENAMED, handler = on_move }, + }) + require("neo-tree").setup(opts) + vim.api.nvim_create_autocmd("TermClose", { + pattern = "*lazygit", + callback = function() + if package.loaded["neo-tree.sources.git_status"] then + require("neo-tree.sources.git_status").refresh() + end + end, + }) + end, +} +``` + + + + + + diff --git a/docs/extras/editor/outline.md b/docs/extras/editor/outline.md index 65a4d82435..0c81a00348 100644 --- a/docs/extras/editor/outline.md +++ b/docs/extras/editor/outline.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.outline" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/editor/overseer.md b/docs/extras/editor/overseer.md index 0228fbaa7b..bb6560bc60 100644 --- a/docs/extras/editor/overseer.md +++ b/docs/extras/editor/overseer.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.overseer" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/editor/refactoring.md b/docs/extras/editor/refactoring.md index 785d90ca7f..1ba0f7415a 100644 --- a/docs/extras/editor/refactoring.md +++ b/docs/extras/editor/refactoring.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.refactoring" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -79,34 +64,39 @@ opts = { "nvim-treesitter/nvim-treesitter", }, keys = { - { "r", "", desc = "+refactor", mode = { "n", "v" } }, + { "r", "", desc = "+refactor", mode = { "n", "x" } }, { "rs", pick, - mode = "v", + mode = { "n", "x" }, desc = "Refactor", }, { "ri", function() - require("refactoring").refactor("Inline Variable") + return require("refactoring").refactor("Inline Variable") end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Inline Variable", + expr = true, }, { "rb", function() - require("refactoring").refactor("Extract Block") + return require("refactoring").refactor("Extract Block") end, + mode = { "n", "x" }, desc = "Extract Block", + expr = true, }, { "rf", function() - require("refactoring").refactor("Extract Block To File") + return require("refactoring").refactor("Extract Block To File") end, + mode = { "n", "x" }, desc = "Extract Block To File", + expr = true, }, { "rP", @@ -120,6 +110,7 @@ opts = { function() require("refactoring").debug.print_var({ normal = true }) end, + mode = { "n", "x" }, desc = "Debug Print Variable", }, { @@ -132,33 +123,36 @@ opts = { { "rf", function() - require("refactoring").refactor("Extract Function") + return require("refactoring").refactor("Extract Function") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Function", + expr = true, }, { "rF", function() - require("refactoring").refactor("Extract Function To File") + return require("refactoring").refactor("Extract Function To File") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Function To File", + expr = true, }, { "rx", function() - require("refactoring").refactor("Extract Variable") + return require("refactoring").refactor("Extract Variable") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Variable", + expr = true, }, { "rp", function() require("refactoring").debug.print_var() end, - mode = "v", + mode = { "n", "x" }, desc = "Debug Print Variable", }, }, diff --git a/docs/extras/editor/snacks_explorer.md b/docs/extras/editor/snacks_explorer.md new file mode 100644 index 0000000000..9f75636083 --- /dev/null +++ b/docs/extras/editor/snacks_explorer.md @@ -0,0 +1,43 @@ +# `Snacks_explorer` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +"folke/snacks.nvim" +``` + + + + + + diff --git a/docs/extras/editor/snacks_picker.md b/docs/extras/editor/snacks_picker.md new file mode 100644 index 0000000000..52429748b8 --- /dev/null +++ b/docs/extras/editor/snacks_picker.md @@ -0,0 +1,643 @@ +# `Snacks_picker` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +### Options + +Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: + +```lua title="lua/config/options.lua" +-- In case you don't want to use `:LazyExtras`, +-- then you need to set the option below. +vim.g.lazyvim_picker = "snacks" +``` + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + +```lua +opts = { + picker = { + win = { + input = { + keys = { + [""] = { + "toggle_cwd", + mode = { "n", "i" }, + }, + }, + }, + }, + actions = { + ---@param p snacks.Picker + toggle_cwd = function(p) + local root = LazyVim.root({ buf = p.input.filter.current_buf, normalize = true }) + local cwd = vim.fs.normalize((vim.uv or vim.loop).cwd() or ".") + local current = p:cwd() + p:set_cwd(current == root and cwd or root) + p:find() + end, + }, + }, +} +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + opts = { + picker = { + win = { + input = { + keys = { + [""] = { + "toggle_cwd", + mode = { "n", "i" }, + }, + }, + }, + }, + actions = { + ---@param p snacks.Picker + toggle_cwd = function(p) + local root = LazyVim.root({ buf = p.input.filter.current_buf, normalize = true }) + local cwd = vim.fs.normalize((vim.uv or vim.loop).cwd() or ".") + local current = p:cwd() + p:set_cwd(current == root and cwd or root) + p:find() + end, + }, + }, + }, + -- stylua: ignore + keys = { + { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "/", LazyVim.pick("grep"), desc = "Grep (Root Dir)" }, + { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, + { "", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, + -- find + { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "fB", function() Snacks.picker.buffers({ hidden = true, nofile = true }) end, desc = "Buffers (all)" }, + { "fc", LazyVim.pick.config_files(), desc = "Find Config File" }, + { "ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { "fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, + { "fg", function() Snacks.picker.git_files() end, desc = "Find Files (git-files)" }, + { "fr", LazyVim.pick("oldfiles"), desc = "Recent" }, + { "fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" }, + { "fp", function() Snacks.picker.projects() end, desc = "Projects" }, + -- git + { "gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" }, + { "gD", function() Snacks.picker.git_diff({ base = "origin" }) end, desc = "Git Diff (origin)" }, + { "gs", function() Snacks.picker.git_status() end, desc = "Git Status" }, + { "gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" }, + -- Grep + { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, + { "sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" }, + { "sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { "sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, + { "sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" }, + { "sw", LazyVim.pick("grep_word"), desc = "Visual selection or word (Root Dir)", mode = { "n", "x" } }, + { "sW", LazyVim.pick("grep_word", { root = false }), desc = "Visual selection or word (cwd)", mode = { "n", "x" } }, + -- search + { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, + { 's/', function() Snacks.picker.search_history() end, desc = "Search History" }, + { "sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" }, + { "sc", function() Snacks.picker.command_history() end, desc = "Command History" }, + { "sC", function() Snacks.picker.commands() end, desc = "Commands" }, + { "sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, + { "sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" }, + { "sh", function() Snacks.picker.help() end, desc = "Help Pages" }, + { "sH", function() Snacks.picker.highlights() end, desc = "Highlights" }, + { "si", function() Snacks.picker.icons() end, desc = "Icons" }, + { "sj", function() Snacks.picker.jumps() end, desc = "Jumps" }, + { "sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, + { "sl", function() Snacks.picker.loclist() end, desc = "Location List" }, + { "sM", function() Snacks.picker.man() end, desc = "Man Pages" }, + { "sm", function() Snacks.picker.marks() end, desc = "Marks" }, + { "sR", function() Snacks.picker.resume() end, desc = "Resume" }, + { "sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" }, + { "su", function() Snacks.picker.undo() end, desc = "Undotree" }, + -- ui + { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, + }, +} +``` + + + + + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + +```lua +opts = function(_, opts) + if LazyVim.has("trouble.nvim") then + return vim.tbl_deep_extend("force", opts or {}, { + picker = { + actions = { + trouble_open = function(...) + return require("trouble.sources.snacks").actions.trouble_open.action(...) + end, + }, + win = { + input = { + keys = { + [""] = { + "trouble_open", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + }) + end +end +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + opts = function(_, opts) + if LazyVim.has("trouble.nvim") then + return vim.tbl_deep_extend("force", opts or {}, { + picker = { + actions = { + trouble_open = function(...) + return require("trouble.sources.snacks").actions.trouble_open.action(...) + end, + }, + win = { + input = { + keys = { + [""] = { + "trouble_open", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + }) + end + end, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + ["*"] = { + -- stylua: ignore + keys = { + { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", has = "definition" }, + { "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" }, + { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" }, + { "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" }, + { "ss", function() Snacks.picker.lsp_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Symbols", has = "documentSymbol" }, + { "sS", function() Snacks.picker.lsp_workspace_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Workspace Symbols", has = "workspace/symbols" }, + { "gai", function() Snacks.picker.lsp_incoming_calls() end, desc = "C[a]lls Incoming", has = "callHierarchy/incomingCalls" }, + { "gao", function() Snacks.picker.lsp_outgoing_calls() end, desc = "C[a]lls Outgoing", has = "callHierarchy/outgoingCalls" }, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + ["*"] = { + -- stylua: ignore + keys = { + { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", has = "definition" }, + { "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" }, + { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" }, + { "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" }, + { "ss", function() Snacks.picker.lsp_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Symbols", has = "documentSymbol" }, + { "sS", function() Snacks.picker.lsp_workspace_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Workspace Symbols", has = "workspace/symbols" }, + { "gai", function() Snacks.picker.lsp_incoming_calls() end, desc = "C[a]lls Incoming", has = "callHierarchy/incomingCalls" }, + { "gao", function() Snacks.picker.lsp_outgoing_calls() end, desc = "C[a]lls Outgoing", has = "callHierarchy/outgoingCalls" }, + }, + }, + }, + }, +} +``` + + + + + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + +```lua +opts = function(_, opts) + table.insert(opts.dashboard.preset.keys, 3, { + icon = " ", + key = "p", + desc = "Projects", + action = ":lua Snacks.picker.projects()", + }) +end +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + opts = function(_, opts) + table.insert(opts.dashboard.preset.keys, 3, { + icon = " ", + key = "p", + desc = "Projects", + action = ":lua Snacks.picker.projects()", + }) + end, +} +``` + + + + + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + +```lua +opts = { + picker = { + win = { + input = { + keys = { + [""] = { "flash", mode = { "n", "i" } }, + ["s"] = { "flash" }, + }, + }, + }, + actions = { + flash = function(picker) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list" + end, + }, + }, + action = function(match) + local idx = picker.list:row2idx(match.pos[1]) + picker.list:_move(idx, true, true) + end, + }) + end, + }, + }, +} +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + opts = { + picker = { + win = { + input = { + keys = { + [""] = { "flash", mode = { "n", "i" } }, + ["s"] = { "flash" }, + }, + }, + }, + actions = { + flash = function(picker) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list" + end, + }, + }, + action = function(match) + local idx = picker.list:row2idx(match.pos[1]) + picker.list:_move(idx, true, true) + end, + }) + end, + }, + }, + }, +} +``` + + + + + +## [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) _(optional)_ + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "folke/todo-comments.nvim", + optional = true, + -- stylua: ignore + keys = { + { "st", function() Snacks.picker.todo_comments() end, desc = "Todo" }, + { "sT", function () Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" }, + }, +} +``` + + + + + +## [alpha-nvim](https://github.com/goolord/alpha-nvim) _(optional)_ + + + + + +```lua +opts = function(_, dashboard) + local button = dashboard.button("p", " " .. " Projects", [[ lua Snacks.picker.projects() ]]) + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + table.insert(dashboard.section.buttons.val, 4, button) +end +``` + + + + + + +```lua +{ + "goolord/alpha-nvim", + optional = true, + opts = function(_, dashboard) + local button = dashboard.button("p", " " .. " Projects", [[ lua Snacks.picker.projects() ]]) + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + table.insert(dashboard.section.buttons.val, 4, button) + end, +} +``` + + + + + +## [mini.starter](https://github.com/nvim-mini/mini.starter) _(optional)_ + + + + + +```lua +opts = function(_, opts) + local items = { + { + name = "Projects", + action = [[lua Snacks.picker.projects()]], + section = string.rep(" ", 22) .. "Telescope", + }, + } + vim.list_extend(opts.items, items) +end +``` + + + + + + +```lua +{ + "nvim-mini/mini.starter", + optional = true, + opts = function(_, opts) + local items = { + { + name = "Projects", + action = [[lua Snacks.picker.projects()]], + section = string.rep(" ", 22) .. "Telescope", + }, + } + vim.list_extend(opts.items, items) + end, +} +``` + + + + + +## [dashboard-nvim](https://github.com/nvimdev/dashboard-nvim) _(optional)_ + + + + + +```lua +opts = function(_, opts) + if not vim.tbl_get(opts, "config", "center") then + return + end + local projects = { + action = "lua Snacks.picker.projects()", + desc = " Projects", + icon = " ", + key = "p", + } + + projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) + projects.key_format = " %s" + + table.insert(opts.config.center, 3, projects) +end +``` + + + + + + +```lua +{ + "nvimdev/dashboard-nvim", + optional = true, + opts = function(_, opts) + if not vim.tbl_get(opts, "config", "center") then + return + end + local projects = { + action = "lua Snacks.picker.projects()", + desc = " Projects", + icon = " ", + key = "p", + } + + projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) + projects.key_format = " %s" + + table.insert(opts.config.center, 3, projects) + end, +} +``` + + + + + +## [flash.nvim](https://github.com/folke/flash.nvim) _(optional)_ + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "folke/flash.nvim", + optional = true, + specs = { + { + "folke/snacks.nvim", + opts = { + picker = { + win = { + input = { + keys = { + [""] = { "flash", mode = { "n", "i" } }, + ["s"] = { "flash" }, + }, + }, + }, + actions = { + flash = function(picker) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list" + end, + }, + }, + action = function(match) + local idx = picker.list:row2idx(match.pos[1]) + picker.list:_move(idx, true, true) + end, + }) + end, + }, + }, + }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/editor/telescope.md b/docs/extras/editor/telescope.md index 521c60cfa4..8841edfeb7 100644 --- a/docs/extras/editor/telescope.md +++ b/docs/extras/editor/telescope.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.editor.telescope" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -138,9 +123,6 @@ end { "nvim-telescope/telescope.nvim", cmd = "Telescope", - enabled = function() - return LazyVim.pick.want() == "telescope" - end, version = false, -- telescope did only one release, so use HEAD for now dependencies = { { @@ -181,6 +163,7 @@ end "Telescope buffers sort_mru=true sort_lastused=true ignore_current_buffer=true", desc = "Buffers", }, + { "fB", "Telescope buffers", desc = "Buffers (all)" }, { "fc", LazyVim.pick.config_files(), desc = "Find Config File" }, { "ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, { "fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, @@ -189,15 +172,18 @@ end { "fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, -- git { "gc", "Telescope git_commits", desc = "Commits" }, + { "gl", "Telescope git_commits", desc = "Commits" }, { "gs", "Telescope git_status", desc = "Status" }, + { "gS", "Telescope git_stash", desc = "Git Stash" }, -- search { 's"', "Telescope registers", desc = "Registers" }, + { "s/", "Telescope search_history", desc = "Search History" }, { "sa", "Telescope autocommands", desc = "Auto Commands" }, - { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer Lines" }, { "sc", "Telescope command_history", desc = "Command History" }, { "sC", "Telescope commands", desc = "Commands" }, - { "sd", "Telescope diagnostics bufnr=0", desc = "Document Diagnostics" }, - { "sD", "Telescope diagnostics", desc = "Workspace Diagnostics" }, + { "sd", "Telescope diagnostics", desc = "Diagnostics" }, + { "sD", "Telescope diagnostics bufnr=0", desc = "Buffer Diagnostics" }, { "sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, { "sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, { "sh", "Telescope help_tags", desc = "Help Pages" }, @@ -212,8 +198,8 @@ end { "sq", "Telescope quickfix", desc = "Quickfix List" }, { "sw", LazyVim.pick("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" }, { "sW", LazyVim.pick("grep_string", { root = false, word_match = "-w" }), desc = "Word (cwd)" }, - { "sw", LazyVim.pick("grep_string"), mode = "v", desc = "Selection (Root Dir)" }, - { "sW", LazyVim.pick("grep_string", { root = false }), mode = "v", desc = "Selection (cwd)" }, + { "sw", LazyVim.pick("grep_string"), mode = "x", desc = "Selection (Root Dir)" }, + { "sW", LazyVim.pick("grep_string", { root = false }), mode = "x", desc = "Selection (cwd)" }, { "uC", LazyVim.pick("colorscheme", { enable_preview = true }), desc = "Colorscheme with Preview" }, { "ss", @@ -335,9 +321,6 @@ opts = nil { "stevearc/dressing.nvim", lazy = true, - enabled = function() - return LazyVim.pick.want() == "telescope" - end, init = function() ---@diagnostic disable-next-line: duplicate-set-field vim.ui.select = function(...) @@ -488,19 +471,19 @@ opts = {} ```lua -opts = function() - if LazyVim.pick.want() ~= "telescope" then - return - end - local Keys = require("lazyvim.plugins.lsp.keymaps").get() - -- stylua: ignore - vim.list_extend(Keys, { - { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, - { "gr", "Telescope lsp_references", desc = "References", nowait = true }, - { "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, - { "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, - }) -end +opts = { + servers = { + ["*"] = { + -- stylua: ignore + keys = { + { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, + { "gr", "Telescope lsp_references", desc = "References", nowait = true }, + { "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, + { "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, + }, + }, + }, +} ``` @@ -511,19 +494,19 @@ end ```lua { "neovim/nvim-lspconfig", - opts = function() - if LazyVim.pick.want() ~= "telescope" then - return - end - local Keys = require("lazyvim.plugins.lsp.keymaps").get() - -- stylua: ignore - vim.list_extend(Keys, { - { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, - { "gr", "Telescope lsp_references", desc = "References", nowait = true }, - { "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, - { "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, - }) - end, + opts = { + servers = { + ["*"] = { + -- stylua: ignore + keys = { + { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, + { "gr", "Telescope lsp_references", desc = "References", nowait = true }, + { "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, + { "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, + }, + }, + }, + }, } ``` diff --git a/docs/extras/formatting/biome.md b/docs/extras/formatting/biome.md index 9238c2f995..7779155c9a 100644 --- a/docs/extras/formatting/biome.md +++ b/docs/extras/formatting/biome.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.formatting.biome" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -41,7 +26,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -58,7 +43,7 @@ opts = { ensure_installed = { "biome" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "biome" } }, } ``` diff --git a/docs/extras/formatting/black.md b/docs/extras/formatting/black.md index 59adc170c2..cee7a9e135 100644 --- a/docs/extras/formatting/black.md +++ b/docs/extras/formatting/black.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.formatting.black" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -51,7 +36,7 @@ end ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = function(_, opts) table.insert(opts.ensure_installed, "black") end, diff --git a/docs/extras/formatting/prettier.md b/docs/extras/formatting/prettier.md index 7a24a9ab17..b9f931d023 100644 --- a/docs/extras/formatting/prettier.md +++ b/docs/extras/formatting/prettier.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.formatting.prettier" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -42,7 +27,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -59,7 +44,7 @@ opts = { ensure_installed = { "prettier" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "prettier" } }, } ``` diff --git a/docs/extras/lang/angular.md b/docs/extras/lang/angular.md index 4a29b491e4..d8a71c66f5 100644 --- a/docs/extras/lang/angular.md +++ b/docs/extras/lang/angular.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.angular" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -98,10 +83,10 @@ opts = { }, setup = { angularls = function() - LazyVim.lsp.on_attach(function(client) + Snacks.util.lsp.on({ name = "angularls" }, function(_, client) --HACK: disable angular renaming capability due to duplicate rename popping up client.server_capabilities.renameProvider = false - end, "angularls") + end) end, }, } @@ -121,10 +106,10 @@ opts = { }, setup = { angularls = function() - LazyVim.lsp.on_attach(function(client) + Snacks.util.lsp.on({ name = "angularls" }, function(_, client) --HACK: disable angular renaming capability due to duplicate rename popping up client.server_capabilities.renameProvider = false - end, "angularls") + end) end, }, }, diff --git a/docs/extras/lang/ansible.md b/docs/extras/lang/ansible.md index 798f7765a0..d892f6c118 100644 --- a/docs/extras/lang/ansible.md +++ b/docs/extras/lang/ansible.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.ansible" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -49,7 +34,7 @@ opts = { ensure_installed = { "ansible-lint" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "ansible-lint" } }, } ``` @@ -110,13 +95,14 @@ opts = nil ```lua { "mfussenegger/nvim-ansible", - ft = {}, + ft = { "yaml" }, keys = { { "ta", function() require("ansible").run() end, + ft = "yaml.ansible", desc = "Ansible Run Playbook/Role", silent = true, }, diff --git a/docs/extras/lang/astro.md b/docs/extras/lang/astro.md index 83e938ca21..43f20394df 100644 --- a/docs/extras/lang/astro.md +++ b/docs/extras/lang/astro.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.astro" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/clangd.md b/docs/extras/lang/clangd.md index 924cf599f5..65014a9ce8 100644 --- a/docs/extras/lang/clangd.md +++ b/docs/extras/lang/clangd.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.clangd" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -152,21 +137,21 @@ opts = { -- Ensure mason installs the server clangd = { keys = { - { "ch", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + { "ch", "LspClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + }, + root_markers = { + "compile_commands.json", + "compile_flags.txt", + "configure.ac", -- AutoTools + "Makefile", + "configure.ac", + "configure.in", + "config.h.in", + "meson.build", + "meson_options.txt", + "build.ninja", + ".git", }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "Makefile", - "configure.ac", - "configure.in", - "config.h.in", - "meson.build", - "meson_options.txt", - "build.ninja" - )(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")( - fname - ) or require("lspconfig.util").find_git_ancestor(fname) - end, capabilities = { offsetEncoding = { "utf-16" }, }, @@ -209,21 +194,21 @@ opts = { -- Ensure mason installs the server clangd = { keys = { - { "ch", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + { "ch", "LspClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + }, + root_markers = { + "compile_commands.json", + "compile_flags.txt", + "configure.ac", -- AutoTools + "Makefile", + "configure.ac", + "configure.in", + "config.h.in", + "meson.build", + "meson_options.txt", + "build.ninja", + ".git", }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "Makefile", - "configure.ac", - "configure.in", - "config.h.in", - "meson.build", - "meson_options.txt", - "build.ninja" - )(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")( - fname - ) or require("lspconfig.util").find_git_ancestor(fname) - end, capabilities = { offsetEncoding = { "utf-16" }, }, @@ -258,7 +243,7 @@ opts = {
-## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ @@ -266,6 +251,8 @@ opts = { ```lua opts = function(_, opts) + opts.sorting = opts.sorting or {} + opts.sorting.comparators = opts.sorting.comparators or {} table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores")) end ``` @@ -277,8 +264,11 @@ end ```lua { - "nvim-cmp", + "hrsh7th/nvim-cmp", + optional = true, opts = function(_, opts) + opts.sorting = opts.sorting or {} + opts.sorting.comparators = opts.sorting.comparators or {} table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores")) end, } @@ -345,7 +335,7 @@ end optional = true, dependencies = { -- Ensure C/C++ debugger is installed - "williamboman/mason.nvim", + "mason-org/mason.nvim", optional = true, opts = { ensure_installed = { "codelldb" } }, }, @@ -393,7 +383,7 @@ end -## [mason.nvim](https://github.com/williamboman/mason.nvim) _(optional)_ +## [mason.nvim](https://github.com/mason-org/mason.nvim) _(optional)_ @@ -411,7 +401,7 @@ opts = { ensure_installed = { "codelldb" } } ```lua { -- Ensure C/C++ debugger is installed - "williamboman/mason.nvim", + "mason-org/mason.nvim", optional = true, opts = { ensure_installed = { "codelldb" } }, } diff --git a/docs/extras/lang/clojure.md b/docs/extras/lang/clojure.md index d7401d7e6a..d29859fc10 100644 --- a/docs/extras/lang/clojure.md +++ b/docs/extras/lang/clojure.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.clojure" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -86,7 +71,7 @@ opts = nil
-## [nvim-treesitter-sexp](https://github.com/PaterJason/nvim-treesitter-sexp) +## [nvim-paredit](https://github.com/julienvincent/nvim-paredit) Add s-exp mappings @@ -105,7 +90,7 @@ opts = {} ```lua -{ "PaterJason/nvim-treesitter-sexp", opts = {}, event = "LazyFile" } +{ "julienvincent/nvim-paredit", opts = {}, event = "LazyFile" } ``` @@ -202,13 +187,13 @@ opts = {} end vim.keymap.set( - { "n", "v" }, + { "n", "x" }, "[c", "call search('^; -\\+$', 'bw')", { silent = true, buffer = true, desc = "Jumps to the begining of previous evaluation output." } ) vim.keymap.set( - { "n", "v" }, + { "n", "x" }, "]c", "call search('^; -\\+$', 'w')", { silent = true, buffer = true, desc = "Jumps to the begining of next evaluation output." } @@ -240,7 +225,7 @@ opts = {} ```lua opts = function(_, opts) if type(opts.sources) == "table" then - vim.list_extend(opts.sources, { name = "clojure" }) + vim.list_extend(opts.sources, { name = "conjure" }) end end ``` @@ -259,7 +244,7 @@ end }, opts = function(_, opts) if type(opts.sources) == "table" then - vim.list_extend(opts.sources, { name = "clojure" }) + vim.list_extend(opts.sources, { name = "conjure" }) end end, } diff --git a/docs/extras/lang/cmake.md b/docs/extras/lang/cmake.md index d1ad6e2f71..5afda47776 100644 --- a/docs/extras/lang/cmake.md +++ b/docs/extras/lang/cmake.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.cmake" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -58,7 +43,7 @@ opts = { ensure_installed = { "cmake" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) diff --git a/docs/extras/lang/dart.md b/docs/extras/lang/dart.md new file mode 100644 index 0000000000..867830d2c6 --- /dev/null +++ b/docs/extras/lang/dart.md @@ -0,0 +1,177 @@ +# `Dart` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + dartls = {}, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + dartls = {}, + }, + }, +} +``` + + + + + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + + + + +```lua +opts = { ensure_installed = { "dart" } } +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "dart" } }, +} +``` + + + + + +## [conform.nvim](https://github.com/stevearc/conform.nvim) + + + + + +```lua +opts = { + formatters_by_ft = { + dart = { "dart_format" }, + }, +} +``` + + + + + + +```lua +{ + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + dart = { "dart_format" }, + }, + }, +} +``` + + + + + +## [neotest-dart](https://github.com/sidlatau/neotest-dart) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "sidlatau/neotest-dart", +} +``` + + + + + +## [neotest](https://github.com/nvim-neotest/neotest) _(optional)_ + + + + + +```lua +opts = { + adapters = { + ["neotest-dart"] = {}, + }, +} +``` + + + + + + +```lua +{ + "nvim-neotest/neotest", + optional = true, + dependencies = { + "sidlatau/neotest-dart", + }, + opts = { + adapters = { + ["neotest-dart"] = {}, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/lang/docker.md b/docs/extras/lang/docker.md index bb2f7d0b61..edf1590581 100644 --- a/docs/extras/lang/docker.md +++ b/docs/extras/lang/docker.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.docker" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -58,7 +43,7 @@ opts = { ensure_installed = { "dockerfile" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) diff --git a/docs/extras/lang/omnisharp.md b/docs/extras/lang/dotnet.md similarity index 84% rename from docs/extras/lang/omnisharp.md rename to docs/extras/lang/dotnet.md index 795bbd1464..912637076f 100644 --- a/docs/extras/lang/omnisharp.md +++ b/docs/extras/lang/dotnet.md @@ -1,4 +1,4 @@ -# `Omnisharp` +# `Dotnet` @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.omnisharp" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -62,7 +47,7 @@ opts = nil ```lua -opts = { ensure_installed = { "c_sharp" } } +opts = { ensure_installed = { "c_sharp", "fsharp" } } ``` @@ -73,7 +58,7 @@ opts = { ensure_installed = { "c_sharp" } } ```lua { "nvim-treesitter/nvim-treesitter", - opts = { ensure_installed = { "c_sharp" } }, + opts = { ensure_installed = { "c_sharp", "fsharp" } }, } ``` @@ -81,14 +66,14 @@ opts = { ensure_installed = { "c_sharp" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) ```lua -opts = { ensure_installed = { "csharpier", "netcoredbg" } } +opts = { ensure_installed = { "csharpier", "netcoredbg", "fantomas" } } ``` @@ -98,8 +83,8 @@ opts = { ensure_installed = { "csharpier", "netcoredbg" } } ```lua { - "williamboman/mason.nvim", - opts = { ensure_installed = { "csharpier", "netcoredbg" } }, + "mason-org/mason.nvim", + opts = { ensure_installed = { "csharpier", "netcoredbg", "fantomas" } }, } ``` @@ -116,6 +101,7 @@ opts = { ensure_installed = { "csharpier", "netcoredbg" } } ```lua opts = { servers = { + fsautocomplete = {}, omnisharp = { handlers = { ["textDocument/definition"] = function(...) @@ -151,6 +137,7 @@ opts = { "neovim/nvim-lspconfig", opts = { servers = { + fsautocomplete = {}, omnisharp = { handlers = { ["textDocument/definition"] = function(...) @@ -181,7 +168,7 @@ opts = { -## [neotest-dotnet](https://github.com/Issafalcon/neotest-dotnet) +## [neotest-vstest](https://github.com/Nsidorenco/neotest-vstest) @@ -198,7 +185,7 @@ opts = nil ```lua { - "Issafalcon/neotest-dotnet", + "Nsidorenco/neotest-vstest", } ``` @@ -217,6 +204,7 @@ opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.csharpier) + table.insert(opts.sources, nls.builtins.formatting.fantomas) end ``` @@ -233,6 +221,7 @@ end local nls = require("null-ls") opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.csharpier) + table.insert(opts.sources, nls.builtins.formatting.fantomas) end, } ``` @@ -251,12 +240,7 @@ end opts = { formatters_by_ft = { cs = { "csharpier" }, - }, - formatters = { - csharpier = { - command = "dotnet-csharpier", - args = { "--write-stdout" }, - }, + fsharp = { "fantomas" }, }, } ``` @@ -273,12 +257,7 @@ opts = { opts = { formatters_by_ft = { cs = { "csharpier" }, - }, - formatters = { - csharpier = { - command = "dotnet-csharpier", - args = { "--write-stdout" }, - }, + fsharp = { "fantomas" }, }, }, } @@ -380,8 +359,8 @@ end ```lua opts = { adapters = { - ["neotest-dotnet"] = { - -- Here we can set options for neotest-dotnet + ["neotest-vstest"] = { + -- Here we can set options for neotest-vstest }, }, } @@ -397,12 +376,12 @@ opts = { "nvim-neotest/neotest", optional = true, dependencies = { - "Issafalcon/neotest-dotnet", + "Nsidorenco/neotest-vstest", }, opts = { adapters = { - ["neotest-dotnet"] = { - -- Here we can set options for neotest-dotnet + ["neotest-vstest"] = { + -- Here we can set options for neotest-vstest }, }, }, diff --git a/docs/extras/lang/elixir.md b/docs/extras/lang/elixir.md index f60730c841..8e5d395fbe 100644 --- a/docs/extras/lang/elixir.md +++ b/docs/extras/lang/elixir.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.elixir" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/elm.md b/docs/extras/lang/elm.md index 9d37ebea3b..938920e05a 100644 --- a/docs/extras/lang/elm.md +++ b/docs/extras/lang/elm.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.elm" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -58,7 +43,7 @@ opts = { ensure_installed = { "elm" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -75,7 +60,7 @@ opts = { ensure_installed = { "elm-format" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "elm-format" } }, } ``` diff --git a/docs/extras/lang/ember.md b/docs/extras/lang/ember.md new file mode 100644 index 0000000000..3b17d7cf0b --- /dev/null +++ b/docs/extras/lang/ember.md @@ -0,0 +1,116 @@ +# `Ember` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + + + + +```lua +opts = { ensure_installed = { "css", "glimmer", "glimmer_javascript", "glimmer_typescript" } } +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "css", "glimmer", "glimmer_javascript", "glimmer_typescript" } }, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + ember = {}, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + ember = {}, + }, + }, +} +``` + + + + + +## [conform.nvim](https://github.com/stevearc/conform.nvim) + + + + + +```lua +opts = function(_, opts) + if LazyVim.has_extra("formatting.prettier") then + opts.formatters_by_ft = opts.formatters_by_ft or {} + opts.formatters_by_ft.glimmer = { "prettier" } + end +end +``` + + + + + + +```lua +{ + "conform.nvim", + opts = function(_, opts) + if LazyVim.has_extra("formatting.prettier") then + opts.formatters_by_ft = opts.formatters_by_ft or {} + opts.formatters_by_ft.glimmer = { "prettier" } + end + end, +} +``` + + + + + + diff --git a/docs/extras/lang/erlang.md b/docs/extras/lang/erlang.md index 464cc9a018..846b48d0ab 100644 --- a/docs/extras/lang/erlang.md +++ b/docs/extras/lang/erlang.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.erlang" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/git.md b/docs/extras/lang/git.md index f7b97b718a..a347610219 100644 --- a/docs/extras/lang/git.md +++ b/docs/extras/lang/git.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.git" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -61,16 +46,14 @@ opts = { ensure_installed = { "git_config", "gitcommit", "git_rebase", "gitignor
-## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +## [cmp-git](https://github.com/petertriho/cmp-git) ```lua -opts = function(_, opts) - table.insert(opts.sources, { name = "git" }) -end +opts = {} ``` @@ -79,31 +62,23 @@ end ```lua -{ - "nvim-cmp", - dependencies = { - { "petertriho/cmp-git", opts = {} }, - }, - ---@module 'cmp' - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, { name = "git" }) - end, -} +{ "petertriho/cmp-git", opts = {} } ``` -## [cmp-git](https://github.com/petertriho/cmp-git) +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ ```lua -opts = {} +opts = function(_, opts) + table.insert(opts.sources, { name = "git" }) +end ``` @@ -112,7 +87,18 @@ opts = {} ```lua -{ "petertriho/cmp-git", opts = {} } +{ + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { + { "petertriho/cmp-git", opts = {} }, + }, + ---@module 'cmp' + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "git" }) + end, +} ``` diff --git a/docs/extras/lang/gleam.md b/docs/extras/lang/gleam.md index 705f768afd..ed1b62cb5f 100644 --- a/docs/extras/lang/gleam.md +++ b/docs/extras/lang/gleam.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.gleam" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -92,4 +77,39 @@ opts = {
+## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ + + + + + +```lua +opts = { + formatters_by_ft = { + gleam = { "gleam" }, + }, +} +``` + + + + + + +```lua +{ + "conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + gleam = { "gleam" }, + }, + }, +} +``` + + + + + diff --git a/docs/extras/lang/go.md b/docs/extras/lang/go.md index 8c06a72708..b1496ba158 100644 --- a/docs/extras/lang/go.md +++ b/docs/extras/lang/go.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.go" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -91,7 +76,6 @@ opts = { rangeVariableTypes = true, }, analyses = { - fieldalignment = true, nilness = true, unusedparams = true, unusedwrite = true, @@ -110,7 +94,7 @@ opts = { gopls = function(_, opts) -- workaround for gopls not supporting semanticTokensProvider -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 - LazyVim.lsp.on_attach(function(client, _) + Snacks.util.lsp.on({ name = "gopls" }, function(_, client) if not client.server_capabilities.semanticTokensProvider then local semantic = client.config.capabilities.textDocument.semanticTokens client.server_capabilities.semanticTokensProvider = { @@ -122,7 +106,7 @@ opts = { range = true, } end - end, "gopls") + end) -- end workaround end, }, @@ -163,7 +147,6 @@ opts = { rangeVariableTypes = true, }, analyses = { - fieldalignment = true, nilness = true, unusedparams = true, unusedwrite = true, @@ -182,7 +165,7 @@ opts = { gopls = function(_, opts) -- workaround for gopls not supporting semanticTokensProvider -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 - LazyVim.lsp.on_attach(function(client, _) + Snacks.util.lsp.on({ name = "gopls" }, function(_, client) if not client.server_capabilities.semanticTokensProvider then local semantic = client.config.capabilities.textDocument.semanticTokens client.server_capabilities.semanticTokensProvider = { @@ -194,7 +177,7 @@ opts = { range = true, } end - end, "gopls") + end) -- end workaround end, }, @@ -206,7 +189,7 @@ opts = {
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) Ensure Go tools are installed @@ -226,7 +209,7 @@ opts = { ensure_installed = { "goimports", "gofumpt" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "goimports", "gofumpt" } }, } ``` @@ -235,7 +218,7 @@ opts = { ensure_installed = { "goimports", "gofumpt" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -252,7 +235,7 @@ opts = { ensure_installed = { "gomodifytags", "impl" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "gomodifytags", "impl" } }, } ``` @@ -261,7 +244,33 @@ opts = { ensure_installed = { "gomodifytags", "impl" } } -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) + + + + + +```lua +opts = { ensure_installed = { "golangci-lint" } } +``` + + + + + + +```lua +{ + "mason-org/mason.nvim", + opts = { ensure_installed = { "golangci-lint" } }, +} +``` + + + + + +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -278,7 +287,7 @@ opts = { ensure_installed = { "delve" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "delve" } }, } ``` @@ -338,7 +347,7 @@ opts = nil -## [mini.icons](https://github.com/echasnovski/mini.icons) +## [mini.icons](https://github.com/nvim-mini/mini.icons) Filetype icons @@ -365,7 +374,7 @@ opts = { ```lua { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".go-version"] = { glyph = "", hl = "MiniIconsBlue" }, @@ -410,7 +419,7 @@ end optional = true, dependencies = { { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "gomodifytags", "impl" } }, }, }, @@ -430,6 +439,50 @@ end
+## [nvim-lint](https://github.com/mfussenegger/nvim-lint) _(optional)_ + + Add linting + + + + + + +```lua +opts = { + linters_by_ft = { + go = { "golangcilint" }, + }, +} +``` + + + + + + +```lua +{ + "mfussenegger/nvim-lint", + optional = true, + dependencies = { + { + "mason-org/mason.nvim", + opts = { ensure_installed = { "golangci-lint" } }, + }, + }, + opts = { + linters_by_ft = { + go = { "golangcilint" }, + }, + }, +} +``` + + + + + ## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ @@ -486,7 +539,7 @@ opts = nil optional = true, dependencies = { { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "delve" } }, }, { diff --git a/docs/extras/lang/haskell.md b/docs/extras/lang/haskell.md index 0c38698abb..1c78c7d4e8 100644 --- a/docs/extras/lang/haskell.md +++ b/docs/extras/lang/haskell.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.haskell" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -68,7 +53,7 @@ opts = { ensure_installed = { "haskell" } } ```lua -opts = {} +opts = nil ``` @@ -79,17 +64,40 @@ opts = {} ```lua { "mrcjkb/haskell-tools.nvim", - version = "^3", + version = false, ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, - dependencies = { - { "nvim-telescope/telescope.nvim", optional = true }, + keys = { + { + "e", + "HlsEvalAll", + ft = "haskell", + desc = "Evaluate All", + }, + { + "h", + function() + require("haskell-tools").hoogle.hoogle_signature() + end, + ft = "haskell", + desc = "Hoogle Signature", + }, + { + "r", + function() + require("haskell-tools").repl.toggle() + end, + ft = "haskell", + desc = "REPL (Package)", + }, + { + "R", + function() + require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0)) + end, + ft = "haskell", + desc = "REPL (Buffer)", + }, }, - config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("ht") - end - end, } ``` @@ -97,7 +105,7 @@ opts = {}
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -114,7 +122,7 @@ opts = { ensure_installed = { "haskell-language-server" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "haskell-language-server" } }, } ``` @@ -123,7 +131,7 @@ opts = { ensure_installed = { "haskell-language-server" } } -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -140,7 +148,7 @@ opts = { ensure_installed = { "haskell-debug-adapter" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "haskell-debug-adapter" } }, } ``` @@ -233,7 +241,11 @@ opts = nil ```lua -opts = {} +opts = function() + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("ht") + end) +end ``` @@ -245,15 +257,19 @@ opts = {} { "luc-tielen/telescope_hoogle", ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, - dependencies = { - { "nvim-telescope/telescope.nvim" }, - }, - config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("hoogle") - end + opts = function() + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("ht") + end) end, + keys = { + { + "H", + "Telescope hoogle", + ft = "haskell", + desc = "Hoogle", + }, + }, } ``` @@ -303,7 +319,7 @@ opts = { -## [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) +## [nvim-dap](https://github.com/mfussenegger/nvim-dap) _(optional)_ @@ -319,21 +335,34 @@ opts = nil ```lua -{ "nvim-telescope/telescope.nvim", optional = true } +{ + "mfussenegger/nvim-dap", + optional = true, + dependencies = { + { + "mason-org/mason.nvim", + opts = { ensure_installed = { "haskell-debug-adapter" } }, + }, + }, +} ``` -## [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) +## [neotest](https://github.com/nvim-neotest/neotest) _(optional)_ ```lua -opts = nil +opts = { + adapters = { + ["neotest-haskell"] = {}, + }, +} ``` @@ -342,14 +371,25 @@ opts = nil ```lua -{ "nvim-telescope/telescope.nvim" } +{ + "nvim-neotest/neotest", + optional = true, + dependencies = { + { "mrcjkb/neotest-haskell" }, + }, + opts = { + adapters = { + ["neotest-haskell"] = {}, + }, + }, +} ``` -## [nvim-dap](https://github.com/mfussenegger/nvim-dap) _(optional)_ +## [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) _(optional)_ @@ -366,12 +406,25 @@ opts = nil ```lua { - "mfussenegger/nvim-dap", + "nvim-telescope/telescope.nvim", optional = true, - dependencies = { + specs = { { - "williamboman/mason.nvim", - opts = { ensure_installed = { "haskell-debug-adapter" } }, + "luc-tielen/telescope_hoogle", + ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, + opts = function() + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("ht") + end) + end, + keys = { + { + "H", + "Telescope hoogle", + ft = "haskell", + desc = "Hoogle", + }, + }, }, }, } @@ -381,7 +434,7 @@ opts = nil -## [neotest](https://github.com/nvim-neotest/neotest) _(optional)_ +## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ @@ -389,8 +442,9 @@ opts = nil ```lua opts = { - adapters = { - ["neotest-haskell"] = {}, + formatters_by_ft = { + haskell = { "fourmolu" }, + cabal = { "cabal_fmt" }, }, } ``` @@ -402,14 +456,47 @@ opts = { ```lua { - "nvim-neotest/neotest", + "stevearc/conform.nvim", optional = true, - dependencies = { - { "mrcjkb/neotest-haskell" }, + opts = { + formatters_by_ft = { + haskell = { "fourmolu" }, + cabal = { "cabal_fmt" }, + }, + }, +} +``` + +
+ +
+ +## [nvim-lint](https://github.com/mfussenegger/nvim-lint) _(optional)_ + + + + + +```lua +opts = { + linters_by_ft = { + haskell = { "hlint" }, }, +} +``` + + + + + + +```lua +{ + "mfussenegger/nvim-lint", + optional = true, opts = { - adapters = { - ["neotest-haskell"] = {}, + linters_by_ft = { + haskell = { "hlint" }, }, }, } diff --git a/docs/extras/lang/helm.md b/docs/extras/lang/helm.md index 878afb8af6..f9bf6312cf 100644 --- a/docs/extras/lang/helm.md +++ b/docs/extras/lang/helm.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.helm" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [vim-helm](https://github.com/towolf/vim-helm) +## [helm-ls.nvim](https://github.com/qvalentin/helm-ls.nvim) @@ -48,7 +33,7 @@ opts = nil ```lua -{ "towolf/vim-helm", ft = "helm" } +{ "qvalentin/helm-ls.nvim", ft = "helm" } ``` @@ -92,17 +77,6 @@ opts = { servers = { helm_ls = {}, }, - setup = { - yamlls = function() - LazyVim.lsp.on_attach(function(client, buffer) - if vim.bo[buffer].filetype == "helm" then - vim.schedule(function() - vim.cmd("LspStop ++force yamlls") - end) - end - end, "yamlls") - end, - }, } ``` @@ -118,17 +92,6 @@ opts = { servers = { helm_ls = {}, }, - setup = { - yamlls = function() - LazyVim.lsp.on_attach(function(client, buffer) - if vim.bo[buffer].filetype == "helm" then - vim.schedule(function() - vim.cmd("LspStop ++force yamlls") - end) - end - end, "yamlls") - end, - }, }, } ``` diff --git a/docs/extras/lang/java.md b/docs/extras/lang/java.md index 4cb7b58dbe..b0bd8966df 100644 --- a/docs/extras/lang/java.md +++ b/docs/extras/lang/java.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.java" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -61,7 +46,7 @@ opts = { ensure_installed = { "java" } }
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -78,7 +63,7 @@ opts = { ensure_installed = { "java-debug-adapter", "java-test" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "java-debug-adapter", "java-test" } }, } ``` @@ -148,12 +133,15 @@ opts = { ```lua opts = function() - local mason_registry = require("mason-registry") - local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar" + local cmd = { vim.fn.exepath("jdtls") } + if LazyVim.has("mason.nvim") then + local lombok_jar = vim.fn.expand("$MASON/share/jdtls/lombok.jar") + table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar)) + end return { - -- How to find the root dir for a given filename. The default comes from - -- lspconfig which provides a function specifically for java projects. - root_dir = LazyVim.lsp.get_raw_config("jdtls").default_config.root_dir, + root_dir = function(path) + return vim.fs.root(path, vim.lsp.config.jdtls.root_markers) + end, -- How to find the project name for a given root dir. project_name = function(root_dir) @@ -170,10 +158,7 @@ opts = function() -- How to run jdtls. This can be overridden to a full java command-line -- if the Python wrapper script doesn't suffice. - cmd = { - vim.fn.exepath("jdtls"), - string.format("--jvm-arg=-javaagent:%s", lombok_jar), - }, + cmd = cmd, full_cmd = function(opts) local fname = vim.api.nvim_buf_get_name(0) local root_dir = opts.root_dir(fname) @@ -192,6 +177,7 @@ opts = function() -- These depend on nvim-dap, but can additionally be disabled by setting false here. dap = { hotcodereplace = "auto", config_overrides = {} }, + -- Can set this to false to disable main class scan, which is a performance killer for large project dap_main = {}, test = true, settings = { @@ -218,12 +204,15 @@ end dependencies = { "folke/which-key.nvim" }, ft = java_filetypes, opts = function() - local mason_registry = require("mason-registry") - local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar" + local cmd = { vim.fn.exepath("jdtls") } + if LazyVim.has("mason.nvim") then + local lombok_jar = vim.fn.expand("$MASON/share/jdtls/lombok.jar") + table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar)) + end return { - -- How to find the root dir for a given filename. The default comes from - -- lspconfig which provides a function specifically for java projects. - root_dir = LazyVim.lsp.get_raw_config("jdtls").default_config.root_dir, + root_dir = function(path) + return vim.fs.root(path, vim.lsp.config.jdtls.root_markers) + end, -- How to find the project name for a given root dir. project_name = function(root_dir) @@ -240,10 +229,7 @@ end -- How to run jdtls. This can be overridden to a full java command-line -- if the Python wrapper script doesn't suffice. - cmd = { - vim.fn.exepath("jdtls"), - string.format("--jvm-arg=-javaagent:%s", lombok_jar), - }, + cmd = cmd, full_cmd = function(opts) local fname = vim.api.nvim_buf_get_name(0) local root_dir = opts.root_dir(fname) @@ -262,6 +248,7 @@ end -- These depend on nvim-dap, but can additionally be disabled by setting false here. dap = { hotcodereplace = "auto", config_overrides = {} }, + -- Can set this to false to disable main class scan, which is a performance killer for large project dap_main = {}, test = true, settings = { @@ -278,29 +265,17 @@ end config = function(_, opts) -- Find the extra bundles that should be passed on the jdtls command-line -- if nvim-dap is enabled with java debug/test. - local mason_registry = require("mason-registry") local bundles = {} ---@type string[] - if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then - local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") - local java_dbg_path = java_dbg_pkg:get_install_path() - local jar_patterns = { - java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", - } - -- java-test also depends on java-debug-adapter. - if opts.test and mason_registry.is_installed("java-test") then - local java_test_pkg = mason_registry.get_package("java-test") - local java_test_path = java_test_pkg:get_install_path() - vim.list_extend(jar_patterns, { - java_test_path .. "/extension/server/*.jar", - }) - end - for _, jar_pattern in ipairs(jar_patterns) do - for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do - table.insert(bundles, bundle) + if LazyVim.has("mason.nvim") then + local mason_registry = require("mason-registry") + if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + bundles = vim.fn.glob("$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin-*jar", false, true) + -- java-test also depends on java-debug-adapter. + if opts.test and mason_registry.is_installed("java-test") then + vim.list_extend(bundles, vim.fn.glob("$MASON/share/java-test/*.jar", false, true)) end end end - local function attach_jdtls() local fname = vim.api.nvim_buf_get_name(0) @@ -313,7 +288,9 @@ end }, settings = opts.settings, -- enable CMP capabilities - capabilities = LazyVim.has("cmp-nvim-lsp") and require("cmp_nvim_lsp").default_capabilities() or nil, + capabilities = LazyVim.has("blink.cmp") and require("blink.cmp").get_lsp_capabilities() or LazyVim.has( + "cmp-nvim-lsp" + ) and require("cmp_nvim_lsp").default_capabilities() or nil, }, opts.jdtls) -- Existing server will be reused if the root_dir matches. @@ -351,7 +328,7 @@ end }) wk.add({ { - mode = "v", + mode = "x", buffer = args.buf, { "cx", group = "extract" }, { @@ -372,40 +349,45 @@ end }, }) - if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap(opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) - - -- Java Test require Java debugger to work - if opts.test and mason_registry.is_installed("java-test") then - -- custom keymaps for Java test runner (not yet compatible with neotest) - wk.add({ - { - mode = "n", - buffer = args.buf, - { "t", group = "test" }, - { - "tt", - function() - require("jdtls.dap").test_class({ - config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, - }) - end, - desc = "Run All Test", - }, + if LazyVim.has("mason.nvim") then + local mason_registry = require("mason-registry") + if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + if opts.dap_main then + require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + end + + -- Java Test require Java debugger to work + if opts.test and mason_registry.is_installed("java-test") then + -- custom keymaps for Java test runner (not yet compatible with neotest) + wk.add({ { - "tr", - function() - require("jdtls.dap").test_nearest_method({ - config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, - }) - end, - desc = "Run Nearest Test", + mode = "n", + buffer = args.buf, + { "t", group = "test" }, + { + "tt", + function() + require("jdtls.dap").test_class({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) + end, + desc = "Run All Test", + }, + { + "tr", + function() + require("jdtls.dap").test_nearest_method({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) + end, + desc = "Run Nearest Test", + }, + { "tT", require("jdtls.dap").pick_test, desc = "Run Test" }, }, - { "tT", require("jdtls.dap").pick_test, desc = "Run Test" }, - }, - }) + }) + end end end @@ -501,7 +483,7 @@ end end, dependencies = { { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "java-debug-adapter", "java-test" } }, }, }, diff --git a/docs/extras/lang/json.md b/docs/extras/lang/json.md index a1112aa6f1..d46b14e072 100644 --- a/docs/extras/lang/json.md +++ b/docs/extras/lang/json.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.json" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -106,7 +91,7 @@ opts = { servers = { jsonls = { -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.json.schemas = new_config.settings.json.schemas or {} vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) end, @@ -136,7 +121,7 @@ opts = { servers = { jsonls = { -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.json.schemas = new_config.settings.json.schemas or {} vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) end, diff --git a/docs/extras/lang/julia.md b/docs/extras/lang/julia.md new file mode 100644 index 0000000000..90f979cbb6 --- /dev/null +++ b/docs/extras/lang/julia.md @@ -0,0 +1,267 @@ +# `Julia` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + + + + +```lua +opts = { ensure_installed = { "julia" } } +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "julia" } }, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + julials = { + settings = { + -- use the same default settings as the Julia VS Code extension + julia = { + completionmode = "qualify", + lint = { missingrefs = "none" }, + }, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + julials = { + settings = { + -- use the same default settings as the Julia VS Code extension + julia = { + completionmode = "qualify", + lint = { missingrefs = "none" }, + }, + }, + }, + }, + }, +} +``` + + + + + +## [cmp-latex-symbols](https://github.com/kdheepak/cmp-latex-symbols) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "kdheepak/cmp-latex-symbols" } +``` + + + + + +## [cmp-latex-symbols](https://github.com/kdheepak/cmp-latex-symbols) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "kdheepak/cmp-latex-symbols", "saghen/blink.compat" } +``` + + + + + +## [blink.compat](https://github.com/saghen/blink.compat) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +"saghen/blink.compat" +``` + + + + + +## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) _(optional)_ + + cmp integration + + + + + + +```lua +opts = function(_, opts) + table.insert(opts.sources, { + name = "latex_symbols", + option = { + strategy = 0, -- mixed + }, + }) +end +``` + + + + + + +```lua +{ + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "kdheepak/cmp-latex-symbols" }, + opts = function(_, opts) + table.insert(opts.sources, { + name = "latex_symbols", + option = { + strategy = 0, -- mixed + }, + }) + end, +} +``` + + + + + +## [blink.cmp](https://github.com/saghen/blink.cmp) _(optional)_ + + blink.cmp integration + + + + + + +```lua +opts = { + sources = { + compat = { "latex_symbols" }, + providers = { + latex_symbols = { + kind = "LatexSymbols", + async = true, + opts = { + strategy = 0, -- mixed + }, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "saghen/blink.cmp", + optional = true, + dependencies = { "kdheepak/cmp-latex-symbols", "saghen/blink.compat" }, + opts = { + sources = { + compat = { "latex_symbols" }, + providers = { + latex_symbols = { + kind = "LatexSymbols", + async = true, + opts = { + strategy = 0, -- mixed + }, + }, + }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/lang/kotlin.md b/docs/extras/lang/kotlin.md index 98dff3611c..a926807297 100644 --- a/docs/extras/lang/kotlin.md +++ b/docs/extras/lang/kotlin.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.kotlin" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) Add packages(linting, debug adapter) @@ -52,7 +37,7 @@ opts = { ensure_installed = { "ktlint" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "ktlint" } }, } ``` @@ -151,7 +136,7 @@ opts = { { "mfussenegger/nvim-lint", optional = true, - dependencies = "williamboman/mason.nvim", + dependencies = "mason-org/mason.nvim", opts = { linters_by_ft = { kotlin = { "ktlint" } }, }, @@ -303,7 +288,7 @@ end { "mfussenegger/nvim-dap", optional = true, - dependencies = "williamboman/mason.nvim", + dependencies = "mason-org/mason.nvim", opts = function() local dap = require("dap") if not dap.adapters.kotlin then diff --git a/docs/extras/lang/lean.md b/docs/extras/lang/lean.md index 1475e1400c..e26f513b5f 100644 --- a/docs/extras/lang/lean.md +++ b/docs/extras/lang/lean.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.lean" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/markdown.md b/docs/extras/lang/markdown.md index 3106ee4578..0eb0b66deb 100644 --- a/docs/extras/lang/markdown.md +++ b/docs/extras/lang/markdown.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.markdown" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -49,7 +34,7 @@ opts = { ensure_installed = { "markdownlint-cli2", "markdown-toc" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "markdownlint-cli2", "markdown-toc" } }, } ``` @@ -176,6 +161,9 @@ opts = { sign = false, icons = {}, }, + checkbox = { + enabled = false, + }, } ``` @@ -197,23 +185,17 @@ opts = { sign = false, icons = {}, }, + checkbox = { + enabled = false, + }, }, - ft = { "markdown", "norg", "rmd", "org" }, + ft = { "markdown", "norg", "rmd", "org", "codecompanion" }, config = function(_, opts) require("render-markdown").setup(opts) Snacks.toggle({ name = "Render Markdown", - get = function() - return require("render-markdown.state").enabled - end, - set = function(enabled) - local m = require("render-markdown") - if enabled then - m.enable() - else - m.disable() - end - end, + get = require("render-markdown").get, + set = require("render-markdown").set, }):map("um") end, } diff --git a/docs/extras/lang/nix.md b/docs/extras/lang/nix.md index 85b1ec4260..672c4053d5 100644 --- a/docs/extras/lang/nix.md +++ b/docs/extras/lang/nix.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.nix" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -127,4 +112,39 @@ opts = {
+## [nvim-lint](https://github.com/mfussenegger/nvim-lint) _(optional)_ + + + + + +```lua +opts = { + linters_by_ft = { + nix = { "statix" }, + }, +} +``` + + + + + + +```lua +{ + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + nix = { "statix" }, + }, + }, +} +``` + + + + + diff --git a/docs/extras/lang/nushell.md b/docs/extras/lang/nushell.md index 5e42108889..38ef76d96d 100644 --- a/docs/extras/lang/nushell.md +++ b/docs/extras/lang/nushell.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.nushell" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/ocaml.md b/docs/extras/lang/ocaml.md index 04ccaf4348..4174ad4412 100644 --- a/docs/extras/lang/ocaml.md +++ b/docs/extras/lang/ocaml.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.ocaml" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -84,17 +69,19 @@ opts = { "reason", "dune", }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "*.opam", - "esy.json", - "package.json", - ".git", - "dune-project", - "dune-workspace", - "*.ml" - )(fname) - end, + root_markers = { + function(name) + return name:match(".*%.opam$") + end, + "esy.json", + "package.json", + ".git", + "dune-project", + "dune-workspace", + function(name) + return name:match(".*%.ml$") + end, + }, }, }, } @@ -119,17 +106,19 @@ opts = { "reason", "dune", }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "*.opam", - "esy.json", - "package.json", - ".git", - "dune-project", - "dune-workspace", - "*.ml" - )(fname) - end, + root_markers = { + function(name) + return name:match(".*%.opam$") + end, + "esy.json", + "package.json", + ".git", + "dune-project", + "dune-workspace", + function(name) + return name:match(".*%.ml$") + end, + }, }, }, }, diff --git a/docs/extras/lang/php.md b/docs/extras/lang/php.md index e1e38a91d9..075a37f7bd 100644 --- a/docs/extras/lang/php.md +++ b/docs/extras/lang/php.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.php" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -118,7 +103,7 @@ opts = {
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -140,7 +125,7 @@ opts = { ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "phpcs", @@ -154,6 +139,83 @@ opts = { +## [neotest-pest](https://github.com/V13Axel/neotest-pest) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "V13Axel/neotest-pest", + "olimorris/neotest-phpunit", +} +``` + + + + + +## [neotest-phpunit](https://github.com/olimorris/neotest-phpunit) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +"olimorris/neotest-phpunit" +``` + + + + + +## [neotest-pest](https://github.com/V13Axel/neotest-pest) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ + "neotest-pest", + ["neotest-phpunit"] = { + root_ignore_files = { "tests/Pest.php" }, + }, +} +``` + + + + + ## [nvim-dap](https://github.com/mfussenegger/nvim-dap) _(optional)_ @@ -163,11 +225,10 @@ opts = { ```lua opts = function() local dap = require("dap") - local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path() dap.adapters.php = { type = "executable", - command = "node", - args = { path .. "/extension/out/phpDebug.js" }, + command = "php-debug-adapter", + args = {}, } end ``` @@ -183,11 +244,10 @@ end optional = true, opts = function() local dap = require("dap") - local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path() dap.adapters.php = { type = "executable", - command = "node", - args = { path .. "/extension/out/phpDebug.js" }, + command = "php-debug-adapter", + args = {}, } end, } @@ -304,4 +364,49 @@ opts = { +## [neotest](https://github.com/nvim-neotest/neotest) _(optional)_ + + + + + +```lua +opts = { + adapters = { + "neotest-pest", + ["neotest-phpunit"] = { + root_ignore_files = { "tests/Pest.php" }, + }, + }, +} +``` + + + + + + +```lua +{ + "nvim-neotest/neotest", + optional = true, + dependencies = { + "V13Axel/neotest-pest", + "olimorris/neotest-phpunit", + }, + opts = { + adapters = { + "neotest-pest", + ["neotest-phpunit"] = { + root_ignore_files = { "tests/Pest.php" }, + }, + }, + }, +} +``` + + + + + diff --git a/docs/extras/lang/prisma.md b/docs/extras/lang/prisma.md index eead6c0eaf..3c222765a8 100644 --- a/docs/extras/lang/prisma.md +++ b/docs/extras/lang/prisma.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.prisma" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/python.md b/docs/extras/lang/python.md index 7f611d75ba..a97a583143 100644 --- a/docs/extras/lang/python.md +++ b/docs/extras/lang/python.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.python" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -106,10 +91,10 @@ opts = { }, setup = { [ruff] = function() - LazyVim.lsp.on_attach(function(client, _) + Snacks.util.lsp.on({ name = ruff }, function(_, client) -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false - end, ruff) + end) end, }, } @@ -152,10 +137,10 @@ opts = { }, setup = { [ruff] = function() - LazyVim.lsp.on_attach(function(client, _) + Snacks.util.lsp.on({ name = ruff }, function(_, client) -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false - end, ruff) + end) end, }, }, @@ -253,11 +238,7 @@ opts = {} { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() - if vim.fn.has("win32") == 1 then - require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe")) - else - require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python")) - end + require("dap-python").setup("debugpy-adapter") end, } ``` @@ -274,10 +255,8 @@ opts = {} ```lua opts = { - settings = { - options = { - notify_user_on_venv_activation = true, - }, + options = { + notify_user_on_venv_activation = true, }, } ``` @@ -290,19 +269,13 @@ opts = { ```lua { "linux-cultist/venv-selector.nvim", - branch = "regexp", -- Use this branch for the new version cmd = "VenvSelect", - enabled = function() - return LazyVim.has("telescope.nvim") - end, opts = { - settings = { - options = { - notify_user_on_venv_activation = true, - }, + options = { + notify_user_on_venv_activation = true, }, }, - -- Call config for python files and load the cached venv automatically + -- Call config for Python files and load the cached venv automatically ft = "python", keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, } @@ -385,11 +358,7 @@ opts = nil { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() - if vim.fn.has("win32") == 1 then - require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe")) - else - require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python")) - end + require("dap-python").setup("debugpy-adapter") end, }, } diff --git a/docs/extras/lang/r.md b/docs/extras/lang/r.md index 8e668f38c2..ac20fae443 100644 --- a/docs/extras/lang/r.md +++ b/docs/extras/lang/r.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.r" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -48,12 +33,12 @@ opts = { -- of files supported by R.nvim. This is an -- opportunity to create mappings local to buffers. vim.keymap.set("n", "", "RDSendLine", { buffer = true }) - vim.keymap.set("v", "", "RSendSelection", { buffer = true }) + vim.keymap.set("x", "", "RSendSelection", { buffer = true }) local wk = require("which-key") wk.add({ buffer = true, - mode = { "n", "v" }, + mode = { "n", "x" }, { "a", group = "all" }, { "b", group = "between marks" }, { "c", group = "chunks" }, @@ -92,12 +77,12 @@ opts = { -- of files supported by R.nvim. This is an -- opportunity to create mappings local to buffers. vim.keymap.set("n", "", "RDSendLine", { buffer = true }) - vim.keymap.set("v", "", "RSendSelection", { buffer = true }) + vim.keymap.set("x", "", "RSendSelection", { buffer = true }) local wk = require("which-key") wk.add({ buffer = true, - mode = { "n", "v" }, + mode = { "n", "x" }, { "a", group = "all" }, { "b", group = "between marks" }, { "c", group = "chunks" }, @@ -187,11 +172,7 @@ opts = { ensure_installed = { "r", "rnoweb" } } opts = { servers = { r_language_server = { - root_dir = function(fname) - return require("lspconfig.util").root_pattern("DESCRIPTION", "NAMESPACE", ".Rbuildignore")(fname) - or require("lspconfig.util").find_git_ancestor(fname) - or vim.loop.os_homedir() - end, + root_markers = { "DESCRIPTION", "NAMESPACE", ".Rbuildignore" }, }, }, } @@ -208,11 +189,7 @@ opts = { opts = { servers = { r_language_server = { - root_dir = function(fname) - return require("lspconfig.util").root_pattern("DESCRIPTION", "NAMESPACE", ".Rbuildignore")(fname) - or require("lspconfig.util").find_git_ancestor(fname) - or vim.loop.os_homedir() - end, + root_markers = { "DESCRIPTION", "NAMESPACE", ".Rbuildignore" }, }, }, }, diff --git a/docs/extras/lang/rego.md b/docs/extras/lang/rego.md index 7461507e6b..f6e26aa071 100644 --- a/docs/extras/lang/rego.md +++ b/docs/extras/lang/rego.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.rego" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/ruby.md b/docs/extras/lang/ruby.md index 918d8ed8a0..f70d5bfd49 100644 --- a/docs/extras/lang/ruby.md +++ b/docs/extras/lang/ruby.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.ruby" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -77,7 +62,6 @@ opts = { ensure_installed = { "ruby" } } ```lua opts = { - ---@type lspconfig.options servers = { ruby_lsp = { enabled = lsp == "ruby_lsp", @@ -106,9 +90,8 @@ opts = { ```lua { "neovim/nvim-lspconfig", - ---@class PluginLspOpts + ---@type PluginLspOpts opts = { - ---@type lspconfig.options servers = { ruby_lsp = { enabled = lsp == "ruby_lsp", @@ -134,7 +117,7 @@ opts = {
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -151,7 +134,7 @@ opts = { ensure_installed = { "erb-formatter", "erb-lint" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "erb-formatter", "erb-lint" } }, } ``` diff --git a/docs/extras/lang/rust.md b/docs/extras/lang/rust.md index 28edcf4965..aad3506764 100644 --- a/docs/extras/lang/rust.md +++ b/docs/extras/lang/rust.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.rust" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -162,11 +147,22 @@ opts = { }, procMacro = { enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, + }, + files = { + exclude = { + ".direnv", + ".git", + ".jj", + ".github", + ".gitlab", + "bin", + "node_modules", + "target", + "venv", + ".venv", }, + -- Avoid Roots Scanned hanging, see https://github.com/rust-lang/rust-analyzer/issues/12613#issuecomment-2096386344 + watcher = "client", }, }, }, @@ -182,7 +178,6 @@ opts = { ```lua { "mrcjkb/rustaceanvim", - version = vim.fn.has("nvim-0.10.0") == 0 and "^4" or false, ft = { "rust" }, opts = { server = { @@ -212,11 +207,22 @@ opts = { }, procMacro = { enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, + }, + files = { + exclude = { + ".direnv", + ".git", + ".jj", + ".github", + ".gitlab", + "bin", + "node_modules", + "target", + "venv", + ".venv", }, + -- Avoid Roots Scanned hanging, see https://github.com/rust-lang/rust-analyzer/issues/12613#issuecomment-2096386344 + watcher = "client", }, }, }, @@ -224,13 +230,9 @@ opts = { }, config = function(_, opts) if LazyVim.has("mason.nvim") then - local package_path = require("mason-registry").get_package("codelldb"):get_install_path() - local codelldb = package_path .. "/extension/adapter/codelldb" - local library_path = package_path .. "/extension/lldb/lib/liblldb.dylib" - local uname = io.popen("uname"):read("*l") - if uname == "Linux" then - library_path = package_path .. "/extension/lldb/lib/liblldb.so" - end + local codelldb = vim.fn.exepath("codelldb") + local codelldb_lib_ext = io.popen("uname"):read("*l") == "Linux" and ".so" or ".dylib" + local library_path = vim.fn.expand("$MASON/opt/lldb/lib/liblldb" .. codelldb_lib_ext) opts.dap = { adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb, library_path), } @@ -293,7 +295,7 @@ opts = {
-## [mason.nvim](https://github.com/williamboman/mason.nvim) _(optional)_ +## [mason.nvim](https://github.com/mason-org/mason.nvim) _(optional)_ Ensure Rust debugger is installed @@ -319,7 +321,7 @@ end ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", optional = true, opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} diff --git a/docs/extras/lang/scala.md b/docs/extras/lang/scala.md index 2ebae5dfc3..7c7a4ff731 100644 --- a/docs/extras/lang/scala.md +++ b/docs/extras/lang/scala.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.scala" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -65,7 +50,32 @@ opts = { ensure_installed = { "scala" } } ```lua -opts = {} +opts = function() + local metals_config = require("metals").bare_config() + + metals_config.init_options.statusBarProvider = "off" + + metals_config.settings = { + verboseCompilation = true, + showImplicitArguments = true, + showImplicitConversionsAndClasses = true, + showInferredType = true, + superMethodLensesEnabled = true, + excludedPackages = { + "akka.actor.typed.javadsl", + "org.apache.pekko.actor.typed.javadsl", + "com.github.swagger.akka.javadsl", + }, + testUserInterface = "Test Explorer", + } + + metals_config.on_attach = function(client, bufnr) + -- your on_attach function + require("metals").setup_dap() + end + + return metals_config +end ``` @@ -76,8 +86,69 @@ opts = {} ```lua { "scalameta/nvim-metals", - ft = { "scala", "sbt" }, - config = function() end, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { + "me", + function() + require("telescope").extensions.metals.commands() + end, + desc = "Metals commands", + }, + { + "mc", + function() + require("metals").compile_cascade() + end, + desc = "Metals compile cascade", + }, + { + "mh", + function() + require("metals").hover_worksheet() + end, + desc = "Metals hover worksheet", + }, + }, + ft = { "scala", "sbt", "java" }, + opts = function() + local metals_config = require("metals").bare_config() + + metals_config.init_options.statusBarProvider = "off" + + metals_config.settings = { + verboseCompilation = true, + showImplicitArguments = true, + showImplicitConversionsAndClasses = true, + showInferredType = true, + superMethodLensesEnabled = true, + excludedPackages = { + "akka.actor.typed.javadsl", + "org.apache.pekko.actor.typed.javadsl", + "com.github.swagger.akka.javadsl", + }, + testUserInterface = "Test Explorer", + } + + metals_config.on_attach = function(client, bufnr) + -- your on_attach function + require("metals").setup_dap() + end + + return metals_config + end, + config = function(self, metals_config) + local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true }) + vim.api.nvim_create_autocmd("FileType", { + pattern = self.ft, + callback = function() + require("metals").initialize_or_attach(metals_config) + end, + group = nvim_metals_group, + }) + end, } ``` @@ -85,66 +156,14 @@ opts = {} -## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) +## [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) ```lua -opts = { - servers = { - metals = { - keys = { - { - "me", - function() - require("telescope").extensions.metals.commands() - end, - desc = "Metals commands", - }, - { - "mc", - function() - require("metals").compile_cascade() - end, - desc = "Metals compile cascade", - }, - { - "mh", - function() - require("metals").hover_worksheet() - end, - desc = "Metals hover worksheet", - }, - }, - init_options = { - statusBarProvider = "off", - }, - settings = { - showImplicitArguments = true, - excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" }, - }, - }, - }, - setup = { - metals = function(_, opts) - local metals = require("metals") - local metals_config = vim.tbl_deep_extend("force", metals.bare_config(), opts) - metals_config.on_attach = LazyVim.has("nvim-dap") and metals.setup_dap or nil - - local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true }) - vim.api.nvim_create_autocmd("FileType", { - pattern = { "scala", "sbt" }, - callback = function() - metals.initialize_or_attach(metals_config) - end, - group = nvim_metals_group, - }) - return true - end, - }, -} +opts = nil ``` @@ -154,60 +173,7 @@ opts = { ```lua { - "neovim/nvim-lspconfig", - opts = { - servers = { - metals = { - keys = { - { - "me", - function() - require("telescope").extensions.metals.commands() - end, - desc = "Metals commands", - }, - { - "mc", - function() - require("metals").compile_cascade() - end, - desc = "Metals compile cascade", - }, - { - "mh", - function() - require("metals").hover_worksheet() - end, - desc = "Metals hover worksheet", - }, - }, - init_options = { - statusBarProvider = "off", - }, - settings = { - showImplicitArguments = true, - excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" }, - }, - }, - }, - setup = { - metals = function(_, opts) - local metals = require("metals") - local metals_config = vim.tbl_deep_extend("force", metals.bare_config(), opts) - metals_config.on_attach = LazyVim.has("nvim-dap") and metals.setup_dap or nil - - local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true }) - vim.api.nvim_create_autocmd("FileType", { - pattern = { "scala", "sbt" }, - callback = function() - metals.initialize_or_attach(metals_config) - end, - group = nvim_metals_group, - }) - return true - end, - }, - }, + "nvim-lua/plenary.nvim", } ``` diff --git a/docs/extras/lang/solidity.md b/docs/extras/lang/solidity.md new file mode 100644 index 0000000000..0eda4c9f02 --- /dev/null +++ b/docs/extras/lang/solidity.md @@ -0,0 +1,124 @@ +# `Solidity` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + Add Solidity & related to treesitter + + + + + + +```lua +opts = { ensure_installed = { "solidity" } } +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "solidity" } }, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + Correctly setup lspconfig for Solidity + + + + + + +```lua +opts = { + servers = { + solidity_ls = {}, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + solidity_ls = {}, + }, + }, +} +``` + + + + + +## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ + + Formatter for Solidity + + + + + + +```lua +opts = { + formatters_by_ft = { + solidity = { "forge_fmt" }, + }, +} +``` + + + + + + +```lua +{ + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + solidity = { "forge_fmt" }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/lang/sql.md b/docs/extras/lang/sql.md index 87ddc6d983..1e7b7f71a9 100644 --- a/docs/extras/lang/sql.md +++ b/docs/extras/lang/sql.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.sql" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -114,7 +99,7 @@ opts = nil vim.api.nvim_create_autocmd("FileType", { pattern = sql_ft, callback = function() - if LazyVim.has("nvim-cmp") then + if LazyVim.has_extra("coding.nvim-cmp") then local cmp = require("cmp") -- global sources @@ -210,7 +195,7 @@ opts = nil
-## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) Linters & formatters @@ -230,7 +215,7 @@ opts = { ensure_installed = { "sqlfluff" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "sqlfluff" } }, } ``` @@ -345,9 +330,7 @@ end ```lua opts = { sources = { - completion = { - enabled_providers = { "dadbod" }, - }, + default = { "dadbod" }, providers = { dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, }, @@ -366,9 +349,7 @@ opts = { optional = true, opts = { sources = { - completion = { - enabled_providers = { "dadbod" }, - }, + default = { "dadbod" }, providers = { dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, }, diff --git a/docs/extras/lang/svelte.md b/docs/extras/lang/svelte.md index e36da298c7..a9d491129f 100644 --- a/docs/extras/lang/svelte.md +++ b/docs/extras/lang/svelte.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.svelte" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -82,11 +67,6 @@ opts = { desc = "Organize Imports", }, }, - capabilities = { - workspace = { - didChangeWatchedFiles = vim.fn.has("nvim-0.10") == 0 and { dynamicRegistration = true }, - }, - }, }, }, } @@ -110,11 +90,6 @@ opts = { desc = "Organize Imports", }, }, - capabilities = { - workspace = { - didChangeWatchedFiles = vim.fn.has("nvim-0.10") == 0 and { dynamicRegistration = true }, - }, - }, }, }, }, diff --git a/docs/extras/lang/tailwind.md b/docs/extras/lang/tailwind.md index 9eeb232328..c5217b7ecb 100644 --- a/docs/extras/lang/tailwind.md +++ b/docs/extras/lang/tailwind.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.tailwind" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -48,15 +33,28 @@ opts = { filetypes_include = {}, -- to fully override the default_config, change the below -- filetypes = {} + + -- additional settings for the server, e.g: + -- tailwindCSS = { includeLanguages = { someLang = "html" } } + -- can be addeded to the settings table and will be merged with + -- this defaults for Phoenix projects + settings = { + tailwindCSS = { + includeLanguages = { + elixir = "html-eex", + eelixir = "html-eex", + heex = "html-eex", + }, + }, + }, }, }, setup = { tailwindcss = function(_, opts) - local tw = LazyVim.lsp.get_raw_config("tailwindcss") opts.filetypes = opts.filetypes or {} -- Add default filetypes - vim.list_extend(opts.filetypes, tw.default_config.filetypes) + vim.list_extend(opts.filetypes, vim.lsp.config.tailwindcss.filetypes) -- Remove excluded filetypes --- @param ft string @@ -64,17 +62,6 @@ opts = { return not vim.tbl_contains(opts.filetypes_exclude or {}, ft) end, opts.filetypes) - -- Additional settings for Phoenix projects - opts.settings = { - tailwindCSS = { - includeLanguages = { - elixir = "html-eex", - eelixir = "html-eex", - heex = "html-eex", - }, - }, - } - -- Add additional filetypes vim.list_extend(opts.filetypes, opts.filetypes_include or {}) end, @@ -99,15 +86,28 @@ opts = { filetypes_include = {}, -- to fully override the default_config, change the below -- filetypes = {} + + -- additional settings for the server, e.g: + -- tailwindCSS = { includeLanguages = { someLang = "html" } } + -- can be addeded to the settings table and will be merged with + -- this defaults for Phoenix projects + settings = { + tailwindCSS = { + includeLanguages = { + elixir = "html-eex", + eelixir = "html-eex", + heex = "html-eex", + }, + }, + }, }, }, setup = { tailwindcss = function(_, opts) - local tw = LazyVim.lsp.get_raw_config("tailwindcss") opts.filetypes = opts.filetypes or {} -- Add default filetypes - vim.list_extend(opts.filetypes, tw.default_config.filetypes) + vim.list_extend(opts.filetypes, vim.lsp.config.tailwindcss.filetypes) -- Remove excluded filetypes --- @param ft string @@ -115,17 +115,6 @@ opts = { return not vim.tbl_contains(opts.filetypes_exclude or {}, ft) end, opts.filetypes) - -- Additional settings for Phoenix projects - opts.settings = { - tailwindCSS = { - includeLanguages = { - elixir = "html-eex", - eelixir = "html-eex", - heex = "html-eex", - }, - }, - } - -- Add additional filetypes vim.list_extend(opts.filetypes, opts.filetypes_include or {}) end, diff --git a/docs/extras/lang/terraform.md b/docs/extras/lang/terraform.md index 89050149c9..b7db716f7e 100644 --- a/docs/extras/lang/terraform.md +++ b/docs/extras/lang/terraform.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.terraform" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -92,7 +77,7 @@ opts = { -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) ensure terraform tools are installed @@ -112,7 +97,7 @@ opts = { ensure_installed = { "tflint" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "tflint" } }, } ``` diff --git a/docs/extras/lang/tex.md b/docs/extras/lang/tex.md index 93fc6f2917..76a406b459 100644 --- a/docs/extras/lang/tex.md +++ b/docs/extras/lang/tex.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.tex" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -45,7 +30,7 @@ import TabItem from '@theme/TabItem'; opts = function(_, opts) opts.highlight = opts.highlight or {} if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "bibtex" }) + vim.list_extend(opts.ensure_installed, { "bibtex", "latex" }) end if type(opts.highlight.disable) == "table" then vim.list_extend(opts.highlight.disable, { "latex" }) @@ -66,7 +51,7 @@ end opts = function(_, opts) opts.highlight = opts.highlight or {} if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "bibtex" }) + vim.list_extend(opts.ensure_installed, { "bibtex", "latex" }) end if type(opts.highlight.disable) == "table" then vim.list_extend(opts.highlight.disable, { "latex" }) diff --git a/docs/extras/lang/thrift.md b/docs/extras/lang/thrift.md index 8bba7bacbb..c1a0b28fd0 100644 --- a/docs/extras/lang/thrift.md +++ b/docs/extras/lang/thrift.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.thrift" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/toml.md b/docs/extras/lang/toml.md index 48ab00c404..0d091c8d2a 100644 --- a/docs/extras/lang/toml.md +++ b/docs/extras/lang/toml.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.toml" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lang/twig.md b/docs/extras/lang/twig.md new file mode 100644 index 0000000000..13f7bf05ad --- /dev/null +++ b/docs/extras/lang/twig.md @@ -0,0 +1,227 @@ +# `Twig` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + + + + +```lua +opts = { ensure_installed = { "twig" } } +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "twig" } }, +} +``` + + + + + +## [mason.nvim](https://github.com/mason-org/mason.nvim) + + + + + +```lua +opts = { + ensure_installed = { + "twigcs", + "twig-cs-fixer", + }, +} +``` + + + + + + +```lua +{ + "mason-org/mason.nvim", + opts = { + ensure_installed = { + "twigcs", + "twig-cs-fixer", + }, + }, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + twiggy_language_server = { + enabled = true, + }, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + twiggy_language_server = { + enabled = true, + }, + }, + }, +} +``` + + + + + +## [none-ls.nvim](https://github.com/nvimtools/none-ls.nvim) _(optional)_ + + + + + +```lua +opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + table.insert(opts.sources, nls.builtins.diagnostics.twigcs) + -- Twig-CS-Fixer builtin not available in none-ls +end +``` + + + + + + +```lua +{ + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + table.insert(opts.sources, nls.builtins.diagnostics.twigcs) + -- Twig-CS-Fixer builtin not available in none-ls + end, +} +``` + + + + + +## [nvim-lint](https://github.com/mfussenegger/nvim-lint) _(optional)_ + + + + + +```lua +opts = { + linters_by_ft = { + twig = { "twigcs" }, + }, +} +``` + + + + + + +```lua +{ + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + twig = { "twigcs" }, + }, + }, +} +``` + + + + + +## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ + + + + + +```lua +opts = { + formatters_by_ft = { + twig = { "twig-cs-fixer" }, + }, +} +``` + + + + + + +```lua +{ + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + twig = { "twig-cs-fixer" }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/lang/typescript.md b/docs/extras/lang/typescript.md index 62947760af..01116fbfd9 100644 --- a/docs/extras/lang/typescript.md +++ b/docs/extras/lang/typescript.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -95,7 +80,8 @@ opts = { { "gD", function() - local params = vim.lsp.util.make_position_params() + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, "utf-16") LazyVim.lsp.execute({ command = "typescript.goToSourceDefinition", arguments = { params.textDocument.uri, params.position }, @@ -157,20 +143,42 @@ opts = { return true end, vtsls = function(_, opts) - LazyVim.lsp.on_attach(function(client, buffer) + if vim.lsp.config.denols and vim.lsp.config.vtsls then + ---@param server string + local resolve = function(server) + local markers, root_dir = vim.lsp.config[server].root_markers, vim.lsp.config[server].root_dir + vim.lsp.config(server, { + root_dir = function(bufnr, on_dir) + local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil + if is_deno == (server == "denols") then + if root_dir then + return root_dir(bufnr, on_dir) + elseif type(markers) == "table" then + local root = vim.fs.root(bufnr, markers) + return root and on_dir(root) + end + end + end, + }) + end + resolve("denols") + resolve("vtsls") + end + + Snacks.util.lsp.on({ name = "vtsls" }, function(buffer, client) client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx) ---@type string, string, lsp.Range local action, uri, range = unpack(command.arguments) local function move(newf) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = command.command, arguments = { action, uri, range, newf }, }) end local fname = vim.uri_to_fname(uri) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = "typescript.tsserverRequest", arguments = { "getMoveToRefactoringFileSuggestions", @@ -206,7 +214,7 @@ opts = { end) end) end - end, "vtsls") + end) -- copy typescript settings to javascript opts.settings.javascript = vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {}) @@ -276,7 +284,8 @@ opts = { { "gD", function() - local params = vim.lsp.util.make_position_params() + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, "utf-16") LazyVim.lsp.execute({ command = "typescript.goToSourceDefinition", arguments = { params.textDocument.uri, params.position }, @@ -338,20 +347,42 @@ opts = { return true end, vtsls = function(_, opts) - LazyVim.lsp.on_attach(function(client, buffer) + if vim.lsp.config.denols and vim.lsp.config.vtsls then + ---@param server string + local resolve = function(server) + local markers, root_dir = vim.lsp.config[server].root_markers, vim.lsp.config[server].root_dir + vim.lsp.config(server, { + root_dir = function(bufnr, on_dir) + local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil + if is_deno == (server == "denols") then + if root_dir then + return root_dir(bufnr, on_dir) + elseif type(markers) == "table" then + local root = vim.fs.root(bufnr, markers) + return root and on_dir(root) + end + end + end, + }) + end + resolve("denols") + resolve("vtsls") + end + + Snacks.util.lsp.on({ name = "vtsls" }, function(buffer, client) client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx) ---@type string, string, lsp.Range local action, uri, range = unpack(command.arguments) local function move(newf) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = command.command, arguments = { action, uri, range, newf }, }) end local fname = vim.uri_to_fname(uri) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = "typescript.tsserverRequest", arguments = { "getMoveToRefactoringFileSuggestions", @@ -387,7 +418,7 @@ opts = { end) end) end - end, "vtsls") + end) -- copy typescript settings to javascript opts.settings.javascript = vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {}) @@ -401,7 +432,7 @@ opts = { -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -421,7 +452,7 @@ end ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} table.insert(opts.ensure_installed, "js-debug-adapter") @@ -433,7 +464,7 @@ end -## [mini.icons](https://github.com/echasnovski/mini.icons) +## [mini.icons](https://github.com/nvim-mini/mini.icons) Filetype icons @@ -465,7 +496,7 @@ opts = { ```lua { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".eslintrc.js"] = { glyph = "󰱺", hl = "MiniIconsYellow" }, @@ -495,31 +526,34 @@ opts = { ```lua opts = function() local dap = require("dap") - if not dap.adapters["pwa-node"] then - require("dap").adapters["pwa-node"] = { - type = "server", - host = "localhost", - port = "${port}", - executable = { - command = "node", - -- 💀 Make sure to update this path to point to your installation - args = { - LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"), - "${port}", + + for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do + local pwaType = "pwa-" .. adapterType + + if not dap.adapters[pwaType] then + dap.adapters[pwaType] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "js-debug-adapter", + args = { "${port}" }, }, - }, - } - end - if not dap.adapters["node"] then - dap.adapters["node"] = function(cb, config) - if config.type == "node" then - config.type = "pwa-node" - end - local nativeAdapter = dap.adapters["pwa-node"] - if type(nativeAdapter) == "function" then - nativeAdapter(cb, config) - else - cb(nativeAdapter) + } + end + + -- Define adapters without the "pwa-" prefix for VSCode compatibility + if not dap.adapters[adapterType] then + dap.adapters[adapterType] = function(cb, config) + local nativeAdapter = dap.adapters[pwaType] + + config.type = pwaType + + if type(nativeAdapter) == "function" then + nativeAdapter(cb, config) + else + cb(nativeAdapter) + end end end end @@ -532,6 +566,10 @@ opts = function() for _, language in ipairs(js_filetypes) do if not dap.configurations[language] then + local runtimeExecutable = nil + if language:find("typescript") then + runtimeExecutable = vim.fn.executable("tsx") == 1 and "tsx" or "ts-node" + end dap.configurations[language] = { { type = "pwa-node", @@ -539,6 +577,16 @@ opts = function() name = "Launch file", program = "${file}", cwd = "${workspaceFolder}", + sourceMaps = true, + runtimeExecutable = runtimeExecutable, + skipFiles = { + "/**", + "node_modules/**", + }, + resolveSourceMapLocations = { + "${workspaceFolder}/**", + "!**/node_modules/**", + }, }, { type = "pwa-node", @@ -546,6 +594,16 @@ opts = function() name = "Attach", processId = require("dap.utils").pick_process, cwd = "${workspaceFolder}", + sourceMaps = true, + runtimeExecutable = runtimeExecutable, + skipFiles = { + "/**", + "node_modules/**", + }, + resolveSourceMapLocations = { + "${workspaceFolder}/**", + "!**/node_modules/**", + }, }, } end @@ -564,7 +622,7 @@ end optional = true, dependencies = { { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} table.insert(opts.ensure_installed, "js-debug-adapter") @@ -573,31 +631,34 @@ end }, opts = function() local dap = require("dap") - if not dap.adapters["pwa-node"] then - require("dap").adapters["pwa-node"] = { - type = "server", - host = "localhost", - port = "${port}", - executable = { - command = "node", - -- 💀 Make sure to update this path to point to your installation - args = { - LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"), - "${port}", + + for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do + local pwaType = "pwa-" .. adapterType + + if not dap.adapters[pwaType] then + dap.adapters[pwaType] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "js-debug-adapter", + args = { "${port}" }, }, - }, - } - end - if not dap.adapters["node"] then - dap.adapters["node"] = function(cb, config) - if config.type == "node" then - config.type = "pwa-node" - end - local nativeAdapter = dap.adapters["pwa-node"] - if type(nativeAdapter) == "function" then - nativeAdapter(cb, config) - else - cb(nativeAdapter) + } + end + + -- Define adapters without the "pwa-" prefix for VSCode compatibility + if not dap.adapters[adapterType] then + dap.adapters[adapterType] = function(cb, config) + local nativeAdapter = dap.adapters[pwaType] + + config.type = pwaType + + if type(nativeAdapter) == "function" then + nativeAdapter(cb, config) + else + cb(nativeAdapter) + end end end end @@ -610,6 +671,10 @@ end for _, language in ipairs(js_filetypes) do if not dap.configurations[language] then + local runtimeExecutable = nil + if language:find("typescript") then + runtimeExecutable = vim.fn.executable("tsx") == 1 and "tsx" or "ts-node" + end dap.configurations[language] = { { type = "pwa-node", @@ -617,6 +682,16 @@ end name = "Launch file", program = "${file}", cwd = "${workspaceFolder}", + sourceMaps = true, + runtimeExecutable = runtimeExecutable, + skipFiles = { + "/**", + "node_modules/**", + }, + resolveSourceMapLocations = { + "${workspaceFolder}/**", + "!**/node_modules/**", + }, }, { type = "pwa-node", @@ -624,6 +699,16 @@ end name = "Attach", processId = require("dap.utils").pick_process, cwd = "${workspaceFolder}", + sourceMaps = true, + runtimeExecutable = runtimeExecutable, + skipFiles = { + "/**", + "node_modules/**", + }, + resolveSourceMapLocations = { + "${workspaceFolder}/**", + "!**/node_modules/**", + }, }, } end @@ -636,4 +721,37 @@ end +## [mason-nvim-dap.nvim](https://github.com/jay-babu/mason-nvim-dap.nvim) _(optional)_ + + + + + +```lua +opts = { + -- chrome adapter is deprecated, use js-debug-adapter instead + automatic_installation = { exclude = { "chrome" } }, +} +``` + + + + + + +```lua +{ + "jay-babu/mason-nvim-dap.nvim", + optional = true, + opts = { + -- chrome adapter is deprecated, use js-debug-adapter instead + automatic_installation = { exclude = { "chrome" } }, + }, +} +``` + + + + + diff --git a/docs/extras/lang/typst.md b/docs/extras/lang/typst.md new file mode 100644 index 0000000000..a0e8e54b0b --- /dev/null +++ b/docs/extras/lang/typst.md @@ -0,0 +1,236 @@ +# `Typst` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) + + + + + +```lua +opts = { + ensure_installed = { "typst" }, +} +``` + + + + + + +```lua +{ + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { "typst" }, + }, +} +``` + + + + + +## [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) + + + + + +```lua +opts = { + servers = { + tinymist = { + keys = { + { + "cP", + function() + local buf_name = vim.api.nvim_buf_get_name(0) + local file_name = vim.fn.fnamemodify(buf_name, ":t") + LazyVim.lsp.execute({ + command = "tinymist.pinMain", + arguments = { buf_name }, + }) + LazyVim.info("Tinymist: Pinned " .. file_name) + end, + desc = "Pin main file", + }, + }, + single_file_support = true, -- Fixes LSP attachment in non-Git directories + settings = { + formatterMode = "typstyle", + }, + }, + }, +} +``` + + + + + + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + tinymist = { + keys = { + { + "cP", + function() + local buf_name = vim.api.nvim_buf_get_name(0) + local file_name = vim.fn.fnamemodify(buf_name, ":t") + LazyVim.lsp.execute({ + command = "tinymist.pinMain", + arguments = { buf_name }, + }) + LazyVim.info("Tinymist: Pinned " .. file_name) + end, + desc = "Pin main file", + }, + }, + single_file_support = true, -- Fixes LSP attachment in non-Git directories + settings = { + formatterMode = "typstyle", + }, + }, + }, + }, +} +``` + + + + + +## [typst-preview.nvim](https://github.com/chomosuke/typst-preview.nvim) + + + + + +```lua +opts = { + dependencies_bin = { + tinymist = "tinymist", + }, +} +``` + + + + + + +```lua +{ + "chomosuke/typst-preview.nvim", + cmd = { "TypstPreview", "TypstPreviewToggle", "TypstPreviewUpdate" }, + keys = { + { + "cp", + ft = "typst", + "TypstPreviewToggle", + desc = "Toggle Typst Preview", + }, + }, + opts = { + dependencies_bin = { + tinymist = "tinymist", + }, + }, +} +``` + + + + + +## [ts-comments.nvim](https://github.com/folke/ts-comments.nvim) + + + + + +```lua +opts = { + lang = { + typst = { "// %s", "/* %s */" }, + }, +} +``` + + + + + + +```lua +{ + "folke/ts-comments.nvim", + opts = { + lang = { + typst = { "// %s", "/* %s */" }, + }, + }, +} +``` + + + + + +## [conform.nvim](https://github.com/stevearc/conform.nvim) _(optional)_ + + + + + +```lua +opts = { + formatters_by_ft = { + typst = { "typstyle", lsp_format = "prefer" }, + }, +} +``` + + + + + + +```lua +{ + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + typst = { "typstyle", lsp_format = "prefer" }, + }, + }, +} +``` + + + + + + diff --git a/docs/extras/lang/vue.md b/docs/extras/lang/vue.md index 109ec0d107..1ffe66ff65 100644 --- a/docs/extras/lang/vue.md +++ b/docs/extras/lang/vue.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.vue" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -74,13 +59,7 @@ opts = { ensure_installed = { "vue", "css" } } ```lua opts = { servers = { - volar = { - init_options = { - vue = { - hybridMode = true, - }, - }, - }, + vue_ls = {}, vtsls = {}, }, } @@ -96,13 +75,7 @@ opts = { "neovim/nvim-lspconfig", opts = { servers = { - volar = { - init_options = { - vue = { - hybridMode = true, - }, - }, - }, + vue_ls = {}, vtsls = {}, }, }, diff --git a/docs/extras/lang/yaml.md b/docs/extras/lang/yaml.md index 0349298a18..042ee19fb0 100644 --- a/docs/extras/lang/yaml.md +++ b/docs/extras/lang/yaml.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.yaml" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -86,7 +71,7 @@ opts = { }, }, -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.yaml.schemas = vim.tbl_deep_extend( "force", new_config.settings.yaml.schemas or {}, @@ -112,16 +97,6 @@ opts = { }, }, }, - setup = { - yamlls = function() - -- Neovim < 0.10 does not have dynamic registration for formatting - if vim.fn.has("nvim-0.10") == 0 then - LazyVim.lsp.on_attach(function(client, _) - client.server_capabilities.documentFormattingProvider = true - end, "yamlls") - end - end, - }, } ``` @@ -147,7 +122,7 @@ opts = { }, }, -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.yaml.schemas = vim.tbl_deep_extend( "force", new_config.settings.yaml.schemas or {}, @@ -173,16 +148,6 @@ opts = { }, }, }, - setup = { - yamlls = function() - -- Neovim < 0.10 does not have dynamic registration for formatting - if vim.fn.has("nvim-0.10") == 0 then - LazyVim.lsp.on_attach(function(client, _) - client.server_capabilities.documentFormattingProvider = true - end, "yamlls") - end - end, - }, }, } ``` diff --git a/docs/extras/lang/zig.md b/docs/extras/lang/zig.md index f26af4f33b..ce82de8539 100644 --- a/docs/extras/lang/zig.md +++ b/docs/extras/lang/zig.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.zig" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/linting/eslint.md b/docs/extras/linting/eslint.md index ecc7d662e0..62a997c722 100644 --- a/docs/extras/linting/eslint.md +++ b/docs/extras/linting/eslint.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.linting.eslint" }, - { import = "plugins" }, - }, -}) -``` - -
- ### Options Additional options for this extra can be configured in your [lua/config/options.lua](/configuration/general#options) file: @@ -49,7 +34,7 @@ import TabItem from '@theme/TabItem'; ```lua opts = { - ---@type lspconfig.options + ---@type table servers = { eslint = { settings = { @@ -65,10 +50,6 @@ opts = { return end - local function get_client(buf) - return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] - end - local formatter = LazyVim.lsp.formatter({ name = "eslint: lsp", primary = false, @@ -76,24 +57,6 @@ opts = { filter = "eslint", }) - -- Use EslintFixAll on Neovim < 0.10.0 - if not pcall(require, "vim.lsp._dynamic") then - formatter.name = "eslint: EslintFixAll" - formatter.sources = function(buf) - local client = get_client(buf) - return client and { "eslint" } or {} - end - formatter.format = function(buf) - local client = get_client(buf) - if client then - local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) - if #diag > 0 then - vim.cmd("EslintFixAll") - end - end - end - end - -- register the formatter with LazyVim LazyVim.format.register(formatter) end, @@ -111,7 +74,7 @@ opts = { "neovim/nvim-lspconfig", -- other settings removed for brevity opts = { - ---@type lspconfig.options + ---@type table servers = { eslint = { settings = { @@ -127,10 +90,6 @@ opts = { return end - local function get_client(buf) - return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] - end - local formatter = LazyVim.lsp.formatter({ name = "eslint: lsp", primary = false, @@ -138,24 +97,6 @@ opts = { filter = "eslint", }) - -- Use EslintFixAll on Neovim < 0.10.0 - if not pcall(require, "vim.lsp._dynamic") then - formatter.name = "eslint: EslintFixAll" - formatter.sources = function(buf) - local client = get_client(buf) - return client and { "eslint" } or {} - end - formatter.format = function(buf) - local client = get_client(buf) - if client then - local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) - if #diag > 0 then - vim.cmd("EslintFixAll") - end - end - end - end - -- register the formatter with LazyVim LazyVim.format.register(formatter) end, diff --git a/docs/extras/lsp/neoconf.md b/docs/extras/lsp/neoconf.md index 53f21bc640..a560647b37 100644 --- a/docs/extras/lsp/neoconf.md +++ b/docs/extras/lsp/neoconf.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lsp.neoconf" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/lsp/none-ls.md b/docs/extras/lsp/none-ls.md index 63f324dd58..ddb5f4f81c 100644 --- a/docs/extras/lsp/none-ls.md +++ b/docs/extras/lsp/none-ls.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lsp.none-ls" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -107,7 +92,7 @@ end -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) diff --git a/docs/extras/test/core.md b/docs/extras/test/core.md index 8d10937574..ab6e7c9847 100644 --- a/docs/extras/test/core.md +++ b/docs/extras/test/core.md @@ -21,21 +21,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.test.core" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -191,6 +176,7 @@ opts = { -- stylua: ignore keys = { {"t", "", desc = "+test"}, + { "ta", function() require("neotest").run.attach() end, desc = "Attach to Test (Neotest)" }, { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File (Neotest)" }, { "tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files (Neotest)" }, { "tr", function() require("neotest").run.run() end, desc = "Run Nearest (Neotest)" }, diff --git a/docs/extras/ui/alpha.md b/docs/extras/ui/alpha.md index b311802f35..83fe60843f 100644 --- a/docs/extras/ui/alpha.md +++ b/docs/extras/ui/alpha.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.alpha" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/ui/dashboard-nvim.md b/docs/extras/ui/dashboard-nvim.md index c2e7a8c50c..8d31c7aa6a 100644 --- a/docs/extras/ui/dashboard-nvim.md +++ b/docs/extras/ui/dashboard-nvim.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.dashboard-nvim" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/ui/edgy.md b/docs/extras/ui/edgy.md index 42c3e4a04d..fb0674244b 100644 --- a/docs/extras/ui/edgy.md +++ b/docs/extras/ui/edgy.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.edgy" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -34,7 +19,7 @@ import TabItem from '@theme/TabItem'; ## [edgy.nvim](https://github.com/folke/edgy.nvim) - edgy + Create and display predefined window layouts. diff --git a/docs/extras/ui/indent-blankline.md b/docs/extras/ui/indent-blankline.md new file mode 100644 index 0000000000..c626c06ac5 --- /dev/null +++ b/docs/extras/ui/indent-blankline.md @@ -0,0 +1,153 @@ +# `Indent-blankline` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + disable snacks indent when indent-blankline is enabled + + + + + + +```lua +opts = { + indent = { enabled = false }, +} +``` + + + + + + +```lua +{ + "snacks.nvim", + opts = { + indent = { enabled = false }, + }, +} +``` + + + + + +## [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) + + + + + +```lua +opts = function() + Snacks.toggle({ + name = "Indention Guides", + get = function() + return require("ibl.config").get_config(0).enabled + end, + set = function(state) + require("ibl").setup_buffer(0, { enabled = state }) + end, + }):map("ug") + + return { + indent = { + char = "│", + tab_char = "│", + }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "Trouble", + "alpha", + "dashboard", + "help", + "lazy", + "mason", + "neo-tree", + "notify", + "snacks_dashboard", + "snacks_notif", + "snacks_terminal", + "snacks_win", + "toggleterm", + "trouble", + }, + }, + } +end +``` + + + + + + +```lua +{ + "lukas-reineke/indent-blankline.nvim", + event = "LazyFile", + opts = function() + Snacks.toggle({ + name = "Indention Guides", + get = function() + return require("ibl.config").get_config(0).enabled + end, + set = function(state) + require("ibl").setup_buffer(0, { enabled = state }) + end, + }):map("ug") + + return { + indent = { + char = "│", + tab_char = "│", + }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "Trouble", + "alpha", + "dashboard", + "help", + "lazy", + "mason", + "neo-tree", + "notify", + "snacks_dashboard", + "snacks_notif", + "snacks_terminal", + "snacks_win", + "toggleterm", + "trouble", + }, + }, + } + end, + main = "ibl", +} +``` + + + + + + diff --git a/docs/extras/ui/mini-animate.md b/docs/extras/ui/mini-animate.md index b7a12a0533..4712be29b2 100644 --- a/docs/extras/ui/mini-animate.md +++ b/docs/extras/ui/mini-animate.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.mini-animate" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,44 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.animate](https://github.com/echasnovski/mini.animate) +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + disable snacks scroll when animate is enabled + + + + + + +```lua +opts = { + scroll = { enabled = false }, +} +``` + + + + + + +```lua +{ + "snacks.nvim", + opts = { + scroll = { enabled = false }, + }, +} +``` + + + + + +## [mini.animate](https://github.com/nvim-mini/mini.animate) + + Animates many common Neovim actions, like scrolling, + moving the cursor, and resizing windows. + @@ -57,15 +79,19 @@ opts = function(_, opts) end, }) - Snacks.toggle({ - name = "Mini Animate", - get = function() - return not vim.g.minianimate_disable - end, - set = function(state) - vim.g.minianimate_disable = not state - end, - }):map("ua") + -- schedule setting the mapping to override the default mapping from `keymaps.lua` + -- seems `keymaps.lua` is the last event to execute on `VeryLazy` and it overwrites it + vim.schedule(function() + Snacks.toggle({ + name = "Mini Animate", + get = function() + return not vim.g.minianimate_disable + end, + set = function(state) + vim.g.minianimate_disable = not state + end, + }):map("ua") + end) local animate = require("mini.animate") return vim.tbl_deep_extend("force", opts, { @@ -95,8 +121,7 @@ end ```lua { - "echasnovski/mini.animate", - recommended = true, + "nvim-mini/mini.animate", event = "VeryLazy", cond = vim.g.neovide == nil, opts = function(_, opts) @@ -117,15 +142,19 @@ end end, }) - Snacks.toggle({ - name = "Mini Animate", - get = function() - return not vim.g.minianimate_disable - end, - set = function(state) - vim.g.minianimate_disable = not state - end, - }):map("ua") + -- schedule setting the mapping to override the default mapping from `keymaps.lua` + -- seems `keymaps.lua` is the last event to execute on `VeryLazy` and it overwrites it + vim.schedule(function() + Snacks.toggle({ + name = "Mini Animate", + get = function() + return not vim.g.minianimate_disable + end, + set = function(state) + vim.g.minianimate_disable = not state + end, + }):map("ua") + end) local animate = require("mini.animate") return vim.tbl_deep_extend("force", opts, { diff --git a/docs/extras/ui/mini-indentscope.md b/docs/extras/ui/mini-indentscope.md index 982a0a20ab..084917e5f9 100644 --- a/docs/extras/ui/mini-indentscope.md +++ b/docs/extras/ui/mini-indentscope.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.mini-indentscope" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.indentscope](https://github.com/echasnovski/mini.indentscope) +## [mini.indentscope](https://github.com/nvim-mini/mini.indentscope) Active indent guide and indent text objects. When you're browsing code, this highlights the current level of indentation, and animates @@ -58,7 +43,7 @@ opts = { ```lua { - "echasnovski/mini.indentscope", + "nvim-mini/mini.indentscope", version = false, -- wait till new 0.7.0 release to put it back on semver event = "LazyFile", opts = { @@ -78,6 +63,7 @@ opts = { "mason", "neo-tree", "notify", + "sidekick_terminal", "snacks_dashboard", "snacks_notif", "snacks_terminal", @@ -104,7 +90,47 @@ opts = {
-## [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + disable snacks scroll when mini-indentscope is enabled + + + + + + +```lua +opts = { + indent = { + scope = { enabled = false }, + }, +} +``` + + + + + + +```lua +{ + "snacks.nvim", + opts = { + indent = { + scope = { enabled = false }, + }, + }, +} +``` + + + + + +## [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) _(optional)_ + + disable indent-blankline scope when mini-indentscope is enabled + @@ -124,6 +150,7 @@ opts = { ```lua { "lukas-reineke/indent-blankline.nvim", + optional = true, event = "LazyFile", opts = { scope = { enabled = false }, diff --git a/docs/extras/ui/mini-starter.md b/docs/extras/ui/mini-starter.md index b1ed410ae3..5fe94a2461 100644 --- a/docs/extras/ui/mini-starter.md +++ b/docs/extras/ui/mini-starter.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.mini-starter" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -58,7 +43,7 @@ opts = { dashboard = { enabled = false } }
-## [mini.starter](https://github.com/echasnovski/mini.starter) +## [mini.starter](https://github.com/nvim-mini/mini.starter) enable mini.starter @@ -114,7 +99,7 @@ end ```lua { - "echasnovski/mini.starter", + "nvim-mini/mini.starter", version = false, -- wait till new 0.7.0 release to put it back on semver event = "VimEnter", opts = function() @@ -176,7 +161,7 @@ end local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) local pad_footer = string.rep(" ", 8) starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" - -- INFO: based on @echasnovski's recommendation (thanks a lot!!!) + -- INFO: based on @nvim-mini's recommendation (thanks a lot!!!) if vim.bo[ev.buf].filetype == "ministarter" then pcall(starter.refresh) end diff --git a/docs/extras/ui/smear-cursor.md b/docs/extras/ui/smear-cursor.md index a3cf48bf3c..bfb003bbf4 100644 --- a/docs/extras/ui/smear-cursor.md +++ b/docs/extras/ui/smear-cursor.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.smear-cursor" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -62,7 +47,7 @@ opts = { specs = { -- disable mini.animate cursor { - "echasnovski/mini.animate", + "nvim-mini/mini.animate", optional = true, opts = { cursor = { enable = false }, @@ -76,7 +61,7 @@ opts = {
-## [mini.animate](https://github.com/echasnovski/mini.animate) _(optional)_ +## [mini.animate](https://github.com/nvim-mini/mini.animate) _(optional)_ disable mini.animate cursor @@ -98,7 +83,7 @@ opts = { ```lua { - "echasnovski/mini.animate", + "nvim-mini/mini.animate", optional = true, opts = { cursor = { enable = false }, diff --git a/docs/extras/ui/treesitter-context.md b/docs/extras/ui/treesitter-context.md index edcd4c5558..d7bad09730 100644 --- a/docs/extras/ui/treesitter-context.md +++ b/docs/extras/ui/treesitter-context.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.ui.treesitter-context" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/util/chezmoi.md b/docs/extras/util/chezmoi.md index ddad046f1b..a96dcc6508 100644 --- a/docs/extras/util/chezmoi.md +++ b/docs/extras/util/chezmoi.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.chezmoi" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -53,7 +38,7 @@ opts = nil "alker0/chezmoi.vim", init = function() vim.g["chezmoi#use_tmp_buffer"] = 1 - vim.g["chezmoi#source_dir_path"] = os.getenv("HOME") .. "/.local/share/chezmoi" + vim.g["chezmoi#source_dir_path"] = vim.env.HOME .. "/.local/share/chezmoi" end, } ``` @@ -93,6 +78,7 @@ opts = { ```lua { "xvzc/chezmoi.nvim", + cmd = { "ChezmoiEdit" }, keys = { { "sz", @@ -117,7 +103,7 @@ opts = { init = function() -- run chezmoi edit on file enter vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, + pattern = { vim.env.HOME .. "/.local/share/chezmoi/*" }, callback = function() vim.schedule(require("chezmoi.commands.__edit").watch) end, @@ -130,7 +116,7 @@ opts = {
-## [mini.icons](https://github.com/echasnovski/mini.icons) +## [mini.icons](https://github.com/nvim-mini/mini.icons) Filetype icons @@ -164,7 +150,7 @@ opts = { ```lua { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".chezmoiignore"] = { glyph = "", hl = "MiniIconsGrey" }, @@ -252,4 +238,63 @@ end +## [snacks.nvim](https://github.com/folke/snacks.nvim) _(optional)_ + + + + + +```lua +opts = function(_, opts) + local chezmoi_entry = { + icon = " ", + key = "c", + desc = "Config", + action = pick_chezmoi, + } + local config_index + for i = #opts.dashboard.preset.keys, 1, -1 do + if opts.dashboard.preset.keys[i].key == "c" then + table.remove(opts.dashboard.preset.keys, i) + config_index = i + break + end + end + table.insert(opts.dashboard.preset.keys, config_index, chezmoi_entry) +end +``` + + + + + + +```lua +{ + "folke/snacks.nvim", + optional = true, + opts = function(_, opts) + local chezmoi_entry = { + icon = " ", + key = "c", + desc = "Config", + action = pick_chezmoi, + } + local config_index + for i = #opts.dashboard.preset.keys, 1, -1 do + if opts.dashboard.preset.keys[i].key == "c" then + table.remove(opts.dashboard.preset.keys, i) + config_index = i + break + end + end + table.insert(opts.dashboard.preset.keys, config_index, chezmoi_entry) + end, +} +``` + + + + + diff --git a/docs/extras/util/dot.md b/docs/extras/util/dot.md index e059503d09..f58d86c62d 100644 --- a/docs/extras/util/dot.md +++ b/docs/extras/util/dot.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.dot" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -66,7 +51,7 @@ opts = { -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -83,7 +68,7 @@ opts = { ensure_installed = { "shellcheck" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "shellcheck" } }, } ``` diff --git a/docs/extras/util/gh.md b/docs/extras/util/gh.md new file mode 100644 index 0000000000..71c5469ed1 --- /dev/null +++ b/docs/extras/util/gh.md @@ -0,0 +1,114 @@ +# `Gh` + + + +:::info +You can enable the extra with the `:LazyExtras` command. +Plugins marked as optional will only be configured if they are installed. +::: + +Below you can find a list of included plugins and their default settings. + +:::caution +You don't need to copy the default settings to your config. +They are only shown here for reference. +::: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +### Includes the following extras + +- [lang.git](/extras/lang/git) + +## [litee.nvim](https://github.com/ldelossa/litee.nvim) + + + + + +```lua +opts = nil +``` + + + + + + +```lua +{ "ldelossa/litee.nvim", lazy = true } +``` + + + + + +## [gh.nvim](https://github.com/ldelossa/gh.nvim) + + gh.nvim + + + + + + +```lua +opts = {} +``` + + + + + + +```lua +{ + "ldelossa/gh.nvim", + opts = {}, + config = function(_, opts) + require("litee.lib").setup() + require("litee.gh").setup(opts) + end, + keys = { + { "G", "", desc = "+Github" }, + { "Gc", "", desc = "+Commits" }, + { "Gcc", "GHCloseCommit", desc = "Close" }, + { "Gce", "GHExpandCommit", desc = "Expand" }, + { "Gco", "GHOpenToCommit", desc = "Open To" }, + { "Gcp", "GHPopOutCommit", desc = "Pop Out" }, + { "Gcz", "GHCollapseCommit", desc = "Collapse" }, + { "Gi", "", desc = "+Issues" }, + { "Gip", "GHPreviewIssue", desc = "Preview" }, + { "Gio", "GHOpenIssue", desc = "Open" }, + { "Gl", "", desc = "+Litee" }, + { "Glt", "LTPanel", desc = "Toggle Panel" }, + { "Gp", "", desc = "+Pull Request" }, + { "Gpc", "GHClosePR", desc = "Close" }, + { "Gpd", "GHPRDetails", desc = "Details" }, + { "Gpe", "GHExpandPR", desc = "Expand" }, + { "Gpo", "GHOpenPR", desc = "Open" }, + { "Gpp", "GHPopOutPR", desc = "PopOut" }, + { "Gpr", "GHRefreshPR", desc = "Refresh" }, + { "Gpt", "GHOpenToPR", desc = "Open To" }, + { "Gpz", "GHCollapsePR", desc = "Collapse" }, + { "Gr", "", desc = "+Review" }, + { "Grb", "GHStartReview", desc = "Begin" }, + { "Grc", "GHCloseReview", desc = "Close" }, + { "Grd", "GHDeleteReview", desc = "Delete" }, + { "Gre", "GHExpandReview", desc = "Expand" }, + { "Grs", "GHSubmitReview", desc = "Submit" }, + { "Grz", "GHCollapseReview", desc = "Collapse" }, + { "Gt", "", desc = "+Threads" }, + { "Gtc", "GHCreateThread", desc = "Create" }, + { "Gtn", "GHNextThread", desc = "Next" }, + { "Gtt", "GHToggleThread", desc = "Toggle" }, + }, +} +``` + + + + + + diff --git a/docs/extras/util/gitui.md b/docs/extras/util/gitui.md index 424daffa82..b258db9cf5 100644 --- a/docs/extras/util/gitui.md +++ b/docs/extras/util/gitui.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.gitui" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) Ensure GitUI tool is installed @@ -52,7 +37,7 @@ opts = { ensure_installed = { "gitui" } } ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", opts = { ensure_installed = { "gitui" } }, keys = { { diff --git a/docs/extras/util/mini-hipatterns.md b/docs/extras/util/mini-hipatterns.md index c713e17af9..a58f74acba 100644 --- a/docs/extras/util/mini-hipatterns.md +++ b/docs/extras/util/mini-hipatterns.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -32,7 +17,7 @@ They are only shown here for reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [mini.hipatterns](https://github.com/echasnovski/mini.hipatterns) +## [mini.hipatterns](https://github.com/nvim-mini/mini.hipatterns) @@ -89,7 +74,7 @@ end ```lua { - "echasnovski/mini.hipatterns", + "nvim-mini/mini.hipatterns", recommended = true, desc = "Highlight colors in your code. Also includes Tailwind CSS support.", event = "LazyFile", diff --git a/docs/extras/util/octo.md b/docs/extras/util/octo.md index 8481e3201a..e9c2660a4d 100644 --- a/docs/extras/util/octo.md +++ b/docs/extras/util/octo.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.octo" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -110,12 +95,14 @@ opts = { ```lua opts = function(_, opts) vim.treesitter.language.register("markdown", "octo") - if LazyVim.has("telescope.nvim") then + if LazyVim.has_extra("editor.telescope") then opts.picker = "telescope" - elseif LazyVim.has("fzf-lua") then + elseif LazyVim.has_extra("editor.fzf") then opts.picker = "fzf-lua" + elseif LazyVim.has_extra("editor.snacks_picker") then + opts.picker = "snacks" else - LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua`") + LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua` or `snacks.nvim`") end -- Keep some empty windows in sessions @@ -144,12 +131,14 @@ end "pwntester/octo.nvim", opts = function(_, opts) vim.treesitter.language.register("markdown", "octo") - if LazyVim.has("telescope.nvim") then + if LazyVim.has_extra("editor.telescope") then opts.picker = "telescope" - elseif LazyVim.has("fzf-lua") then + elseif LazyVim.has_extra("editor.fzf") then opts.picker = "fzf-lua" + elseif LazyVim.has_extra("editor.snacks_picker") then + opts.picker = "snacks" else - LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua`") + LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua` or `snacks.nvim`") end -- Keep some empty windows in sessions diff --git a/docs/extras/util/project.md b/docs/extras/util/project.md index eb70061604..4514dd451d 100644 --- a/docs/extras/util/project.md +++ b/docs/extras/util/project.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.project" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -144,7 +129,7 @@ opts = nil ```lua opts = function(_, dashboard) - local button = dashboard.button("p", " " .. " Projects", pick) + local button = dashboard.button("P", " " .. " Projects (util.project)", pick) button.opts.hl = "AlphaButtons" button.opts.hl_shortcut = "AlphaShortcut" table.insert(dashboard.section.buttons.val, 4, button) @@ -161,7 +146,7 @@ end "goolord/alpha-nvim", optional = true, opts = function(_, dashboard) - local button = dashboard.button("p", " " .. " Projects", pick) + local button = dashboard.button("P", " " .. " Projects (util.project)", pick) button.opts.hl = "AlphaButtons" button.opts.hl_shortcut = "AlphaShortcut" table.insert(dashboard.section.buttons.val, 4, button) @@ -173,7 +158,7 @@ end
-## [mini.starter](https://github.com/echasnovski/mini.starter) _(optional)_ +## [mini.starter](https://github.com/nvim-mini/mini.starter) _(optional)_ @@ -183,7 +168,7 @@ end opts = function(_, opts) local items = { { - name = "Projects", + name = "Projects (util.project)", action = pick, section = string.rep(" ", 22) .. "Telescope", }, @@ -199,12 +184,12 @@ end ```lua { - "echasnovski/mini.starter", + "nvim-mini/mini.starter", optional = true, opts = function(_, opts) local items = { { - name = "Projects", + name = "Projects (util.project)", action = pick, section = string.rep(" ", 22) .. "Telescope", }, @@ -231,9 +216,9 @@ opts = function(_, opts) end local projects = { action = pick, - desc = " Projects", + desc = " Projects (util.project)", icon = " ", - key = "p", + key = "P", } projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) @@ -258,9 +243,9 @@ end end local projects = { action = pick, - desc = " Projects", + desc = " Projects (util.project)", icon = " ", - key = "p", + key = "P", } projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) @@ -285,9 +270,9 @@ end opts = function(_, opts) table.insert(opts.dashboard.preset.keys, 3, { action = pick, - desc = "Projects", + desc = "Projects (util.project)", icon = " ", - key = "p", + key = "P", }) end ``` @@ -304,9 +289,9 @@ end opts = function(_, opts) table.insert(opts.dashboard.preset.keys, 3, { action = pick, - desc = "Projects", + desc = "Projects (util.project)", icon = " ", - key = "p", + key = "P", }) end, } diff --git a/docs/extras/util/rest.md b/docs/extras/util/rest.md index 97e72d1942..b828adc996 100644 --- a/docs/extras/util/rest.md +++ b/docs/extras/util/rest.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.rest" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution @@ -52,10 +37,11 @@ opts = {} "mistweaverco/kulala.nvim", ft = "http", keys = { - { "R", "", desc = "+Rest", ft = "http" }, - { "Rb", "lua require('kulala').scratchpad()", desc = "Open scratchpad", ft = "http" }, + { "R", "", desc = "+Rest" }, + { "Rb", "lua require('kulala').scratchpad()", desc = "Open scratchpad" }, { "Rc", "lua require('kulala').copy()", desc = "Copy as cURL", ft = "http" }, { "RC", "lua require('kulala').from_curl()", desc = "Paste from curl", ft = "http" }, + { "Re", "lua require('kulala').set_selected_env()", desc = "Set environment", ft = "http" }, { "Rg", "lua require('kulala').download_graphql_schema()", @@ -66,7 +52,7 @@ opts = {} { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request", ft = "http" }, { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, { "Rq", "lua require('kulala').close()", desc = "Close window", ft = "http" }, - { "Rr", "lua require('kulala').replay()", desc = "Replay the last request", ft = "http" }, + { "Rr", "lua require('kulala').replay()", desc = "Replay the last request" }, { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, { "RS", "lua require('kulala').show_stats()", desc = "Show stats", ft = "http" }, { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, diff --git a/docs/extras/util/startuptime.md b/docs/extras/util/startuptime.md index df7ecb53e0..6f3a4b2406 100644 --- a/docs/extras/util/startuptime.md +++ b/docs/extras/util/startuptime.md @@ -7,21 +7,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.startuptime" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/extras/vscode.md b/docs/extras/vscode.md index b5a7be886a..e65c5ce642 100644 --- a/docs/extras/vscode.md +++ b/docs/extras/vscode.md @@ -35,21 +35,6 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.vscode" }, - { import = "plugins" }, - }, -}) -``` - -
- Below you can find a list of included plugins and their default settings. :::caution diff --git a/docs/installation.md b/docs/installation.md index c63115a9a5..253464b3e6 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -88,8 +88,9 @@ with [PowerShell](https://github.com/PowerShell/PowerShell) ```sh -docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update +docker run -w /root -it --rm fedora:latest sh -uelic ' + dnf copr enable -y dejan/lazygit + dnf install -y git lazygit fd-find curl ripgrep tree-sitter-cli neovim git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/docs/intro.md b/docs/intro.md index 780ea89c60..fe77ec4658 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -24,12 +24,14 @@ to make it easy to customize and extend your config. ## ⚡️ Requirements -- Neovim >= **0.9.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.11.2** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a [Nerd Font](https://www.nerdfonts.com/)(v3.0 or greater) **_(optional, but needed to display some icons)_** - [lazygit](https://github.com/jesseduffield/lazygit) **_(optional)_** -- a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements) -- for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) **_(optional)_** +- **tree-sitter-cli** and a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter/tree/main?tab=readme-ov-file#requirements) +- **curl** for [blink.cmp](https://github.com/Saghen/blink.cmp) **(completion engine)** +- for [fzf-lua](https://github.com/ibhagwan/fzf-lua) **_(optional)_** + - **fzf**: [fzf](https://github.com/junegunn/fzf) **(v0.25.1 or greater)** - **live grep**: [ripgrep](https://github.com/BurntSushi/ripgrep) - **find files**: [fd](https://github.com/sharkdp/fd) - a terminal that support true color and _undercurl_: @@ -37,6 +39,7 @@ to make it easy to customize and extend your config. - [wezterm](https://github.com/wez/wezterm) **_(Linux, Macos & Windows)_** - [alacritty](https://github.com/alacritty/alacritty) **_(Linux, Macos & Windows)_** - [iterm2](https://iterm2.com/) **_(Macos)_** + - [ghostty](https://ghostty.org/) **_(Linux, Macos & Windows)_** ## 🎓 Learn diff --git a/docs/keymaps.md b/docs/keymaps.md index a9f0304a9b..e7bc14a5ee 100644 --- a/docs/keymaps.md +++ b/docs/keymaps.md @@ -42,7 +42,7 @@ possible keymaps starting with ``. | <leader>bd | Delete Buffer | **n** | | <leader>bo | Delete Other Buffers | **n** | | <leader>bD | Delete Buffer and Window | **n** | -| <esc> | Escape and Clear hlsearch | **i**, **n** | +| <esc> | Escape and Clear hlsearch | **i**, **n**, **s** | | <leader>ur | Redraw / Clear hlsearch / Diff Update | **n** | | n | Next Search Result | **n**, **x**, **o** | | N | Prev Search Result | **n**, **x**, **o** | @@ -56,7 +56,7 @@ possible keymaps starting with ``. | <leader>xq | Quickfix List | **n** | | [q | Previous Quickfix | **n** | | ]q | Next Quickfix | **n** | -| <leader>cf | Format | **n**, **v** | +| <leader>cf | Format | **n**, **x** | | <leader>cd | Line Diagnostics | **n** | | ]d | Next Diagnostic | **n** | | [d | Prev Diagnostic | **n** | @@ -75,8 +75,17 @@ possible keymaps starting with ``. | <leader>uA | Toggle Tabline | **n** | | <leader>uT | Toggle Treesitter Highlight | **n** | | <leader>ub | Toggle Dark Background | **n** | +| <leader>uD | Toggle Dimming | **n** | +| <leader>ua | Toggle Animations | **n** | +| <leader>ug | Toggle Indent Guides | **n** | +| <leader>uS | Toggle Smooth Scroll | **n** | +| <leader>dpp | Toggle Profiler | **n** | +| <leader>dph | Toggle Profiler Highlights | **n** | | <leader>uh | Toggle Inlay Hints | **n** | +| <leader>gL | Git Log (cwd) | **n** | | <leader>gb | Git Blame Line | **n** | +| <leader>gf | Git Current File History | **n** | +| <leader>gl | Git Log | **n** | | <leader>gB | Git Browse (open) | **n**, **x** | | <leader>gY | Git Browse (copy) | **n**, **x** | | <leader>qq | Quit All | **n** | @@ -85,14 +94,14 @@ possible keymaps starting with ``. | <leader>L | LazyVim Changelog | **n** | | <leader>fT | Terminal (cwd) | **n** | | <leader>ft | Terminal (Root Dir) | **n** | -| <c-/> | Terminal (Root Dir) | **n** | +| <c-/> | Terminal (Root Dir) | **n**, **t** | | <c-_> | which_key_ignore | **n**, **t** | -| <C-/> | Hide Terminal | **t** | -| <leader>w | Windows | **n** | | <leader>- | Split Window Below | **n** | | <leader>| | Split Window Right | **n** | | <leader>wd | Delete Window | **n** | -| <leader>wm | Toggle Maximize | **n** | +| <leader>wm | Toggle Zoom Mode | **n** | +| <leader>uZ | Toggle Zoom Mode | **n** | +| <leader>uz | Toggle Zen Mode | **n** | | <leader><tab>l | Last Tab | **n** | | <leader><tab>o | Close Other Tabs | **n** | | <leader><tab>f | First Tab | **n** | @@ -106,16 +115,16 @@ possible keymaps starting with ``. | Key | Description | Mode | | --- | --- | --- | | <leader>cl | Lsp Info | **n** | -| gd | Goto Definition | **n** | -| gr | References | **n** | -| gI | Goto Implementation | **n** | -| gy | Goto T[y]pe Definition | **n** | +| gd | Goto Definition | **n**, **n** | +| gr | References | **n**, **n** | +| gI | Goto Implementation | **n**, **n** | +| gy | Goto T[y]pe Definition | **n**, **n** | | gD | Goto Declaration | **n** | | K | Hover | **n** | | gK | Signature Help | **n** | | <c-k> | Signature Help | **i** | -| <leader>ca | Code Action | **n**, **v** | -| <leader>cc | Run Codelens | **n**, **v** | +| <leader>ca | Code Action | **n**, **x** | +| <leader>cc | Run Codelens | **n**, **x** | | <leader>cC | Refresh & Display Codelens | **n** | | <leader>cR | Rename File | **n** | | <leader>cr | Rename | **n** | @@ -124,6 +133,10 @@ possible keymaps starting with ``. | [[ | Prev Reference | **n** | | <a-n> | Next Reference | **n** | | <a-p> | Prev Reference | **n** | +| <leader>ss | LSP Symbols | **n** | +| <leader>sS | LSP Workspace Symbols | **n** | +| gai | C[a]lls Incoming | **n** | +| gao | C[a]lls Outgoing | **n** | ## [bufferline.nvim](https://github.com/akinsho/bufferline.nvim.git) @@ -144,7 +157,7 @@ possible keymaps starting with ``. | Key | Description | Mode | | --- | --- | --- | -| <leader>cF | Format Injected Langs | **n**, **v** | +| <leader>cF | Format Injected Langs | **n**, **x** | ## [flash.nvim](https://github.com/folke/flash.nvim.git) @@ -155,30 +168,20 @@ possible keymaps starting with ``. | R | Treesitter Search | **o**, **x** | | s | Flash | **n**, **o**, **x** | | S | Flash Treesitter | **n**, **o**, **x** | +| <c-space> | Treesitter Incremental Selection | **n**, **o**, **x** | ## [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim.git) | Key | Description | Mode | | --- | --- | --- | -| <leader>sr | Search and Replace | **n**, **v** | +| <leader>sr | Search and Replace | **n**, **x** | -## [mason.nvim](https://github.com/williamboman/mason.nvim.git) +## [mason.nvim](https://github.com/mason-org/mason.nvim.git) | Key | Description | Mode | | --- | --- | --- | | <leader>cm | Mason | **n** | -## [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) - -| Key | Description | Mode | -| --- | --- | --- | -| <leader>be | Buffer Explorer | **n** | -| <leader>e | Explorer NeoTree (Root Dir) | **n** | -| <leader>E | Explorer NeoTree (cwd) | **n** | -| <leader>fe | Explorer NeoTree (Root Dir) | **n** | -| <leader>fE | Explorer NeoTree (cwd) | **n** | -| <leader>ge | Git Explorer | **n** | - ## [noice.nvim](https://github.com/folke/noice.nvim.git) | Key | Description | Mode | @@ -193,13 +196,6 @@ possible keymaps starting with ``. | <leader>snt | Noice Picker (Telescope/FzfLua) | **n** | | <S-Enter> | Redirect Cmdline | **c** | -## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git) - -| Key | Description | Mode | -| --- | --- | --- | -| <bs> | Decrement Selection | **x** | -| <c-space> | Increment Selection | **n** | - ## [persistence.nvim](https://github.com/folke/persistence.nvim.git) | Key | Description | Mode | @@ -211,56 +207,60 @@ possible keymaps starting with ``. ## [snacks.nvim](https://github.com/folke/snacks.nvim.git) -| Key | Description | Mode | -| --- | --- | --- | -| <leader>. | Toggle Scratch Buffer | **n** | -| <leader>n | Notification History | **n** | -| <leader>S | Select Scratch Buffer | **n** | -| <leader>un | Dismiss All Notifications | **n** | - -## [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) - | Key | Description | Mode | | --- | --- | --- | | <leader><space> | Find Files (Root Dir) | **n** | -| <leader>, | Switch Buffer | **n** | +| <leader>, | Buffers | **n** | +| <leader>. | Toggle Scratch Buffer | **n** | | <leader>/ | Grep (Root Dir) | **n** | | <leader>: | Command History | **n** | +| <leader>dps | Profiler Scratch Buffer | **n** | +| <leader>e | Explorer Snacks (root dir) | **n** | +| <leader>E | Explorer Snacks (cwd) | **n** | | <leader>fb | Buffers | **n** | +| <leader>fB | Buffers (all) | **n** | | <leader>fc | Find Config File | **n** | +| <leader>fe | Explorer Snacks (root dir) | **n** | +| <leader>fE | Explorer Snacks (cwd) | **n** | | <leader>ff | Find Files (Root Dir) | **n** | | <leader>fF | Find Files (cwd) | **n** | | <leader>fg | Find Files (git-files) | **n** | +| <leader>fp | Projects | **n** | | <leader>fr | Recent | **n** | | <leader>fR | Recent (cwd) | **n** | -| <leader>gc | Commits | **n** | -| <leader>gs | Status | **n** | +| <leader>gd | Git Diff (hunks) | **n** | +| <leader>gD | Git Diff (origin) | **n** | +| <leader>gs | Git Status | **n** | +| <leader>gS | Git Stash | **n** | +| <leader>n | Notification History | **n** | +| <leader>S | Select Scratch Buffer | **n** | | <leader>s" | Registers | **n** | -| <leader>sa | Auto Commands | **n** | -| <leader>sb | Buffer | **n** | +| <leader>s/ | Search History | **n** | +| <leader>sa | Autocmds | **n** | +| <leader>sb | Buffer Lines | **n** | +| <leader>sB | Grep Open Buffers | **n** | | <leader>sc | Command History | **n** | | <leader>sC | Commands | **n** | -| <leader>sd | Document Diagnostics | **n** | -| <leader>sD | Workspace Diagnostics | **n** | +| <leader>sd | Diagnostics | **n** | +| <leader>sD | Buffer Diagnostics | **n** | | <leader>sg | Grep (Root Dir) | **n** | | <leader>sG | Grep (cwd) | **n** | | <leader>sh | Help Pages | **n** | -| <leader>sH | Search Highlight Groups | **n** | -| <leader>sj | Jumplist | **n** | -| <leader>sk | Key Maps | **n** | +| <leader>sH | Highlights | **n** | +| <leader>si | Icons | **n** | +| <leader>sj | Jumps | **n** | +| <leader>sk | Keymaps | **n** | | <leader>sl | Location List | **n** | -| <leader>sm | Jump to Mark | **n** | +| <leader>sm | Marks | **n** | | <leader>sM | Man Pages | **n** | -| <leader>so | Options | **n** | +| <leader>sp | Search for Plugin Spec | **n** | | <leader>sq | Quickfix List | **n** | | <leader>sR | Resume | **n** | -| <leader>ss | Goto Symbol | **n** | -| <leader>sS | Goto Symbol (Workspace) | **n** | -| <leader>sw | Word (Root Dir) | **n** | -| <leader>sW | Word (cwd) | **n** | -| <leader>sw | Selection (Root Dir) | **v** | -| <leader>sW | Selection (cwd) | **v** | -| <leader>uC | Colorscheme with Preview | **n** | +| <leader>su | Undotree | **n** | +| <leader>sw | Visual selection or word (Root Dir) | **n**, **x** | +| <leader>sW | Visual selection or word (cwd) | **n**, **x** | +| <leader>uC | Colorschemes | **n** | +| <leader>un | Dismiss All Notifications | **n** | ## [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) @@ -293,24 +293,72 @@ possible keymaps starting with ``. | <c-w><space> | Window Hydra Mode (which-key) | **n** | | <leader>? | Buffer Keymaps (which-key) | **n** | +## [avante.nvim](https://github.com/yetone/avante.nvim.git) +Part of [lazyvim.plugins.extras.ai.avante](/extras/ai/avante) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>aa | Ask Avante | **n** | +| <leader>ac | Chat with Avante | **n** | +| <leader>ae | Edit Avante | **n** | +| <leader>af | Focus Avante | **n** | +| <leader>ah | Avante History | **n** | +| <leader>am | Select Avante Model | **n** | +| <leader>an | New Avante Chat | **n** | +| <leader>ap | Switch Avante Provider | **n** | +| <leader>ar | Refresh Avante | **n** | +| <leader>as | Stop Avante | **n** | +| <leader>at | Toggle Avante | **n** | + +## [claudecode.nvim](https://github.com/coder/claudecode.nvim.git) +Part of [lazyvim.plugins.extras.ai.claudecode](/extras/ai/claudecode) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>a | +ai | **n**, **v** | +| <leader>aa | Accept diff | **n** | +| <leader>ab | Add current buffer | **n** | +| <leader>ac | Toggle Claude | **n** | +| <leader>aC | Continue Claude | **n** | +| <leader>ad | Deny diff | **n** | +| <leader>af | Focus Claude | **n** | +| <leader>ar | Resume Claude | **n** | +| <leader>as | Add file | **n** | +| <leader>as | Send to Claude | **v** | + ## [CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim.git) Part of [lazyvim.plugins.extras.ai.copilot-chat](/extras/ai/copilot-chat) | Key | Description | Mode | | --- | --- | --- | | <c-s> | Submit Prompt | **n** | -| <leader>a | +ai | **n**, **v** | -| <leader>aa | Toggle (CopilotChat) | **n**, **v** | -| <leader>ap | Prompt Actions (CopilotChat) | **n**, **v** | -| <leader>aq | Quick Chat (CopilotChat) | **n**, **v** | -| <leader>ax | Clear (CopilotChat) | **n**, **v** | +| <leader>a | +ai | **n**, **x** | +| <leader>aa | Toggle (CopilotChat) | **n**, **x** | +| <leader>ap | Prompt Actions (CopilotChat) | **n**, **x** | +| <leader>aq | Quick Chat (CopilotChat) | **n**, **x** | +| <leader>ax | Clear (CopilotChat) | **n**, **x** | -## [mini.surround](https://github.com/echasnovski/mini.surround.git) +## [sidekick.nvim](https://github.com/folke/sidekick.nvim.git) +Part of [lazyvim.plugins.extras.ai.sidekick](/extras/ai/sidekick) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>a | +ai | **n**, **v** | +| <leader>aa | Sidekick Toggle CLI | **n** | +| <leader>ad | Detach a CLI Session | **n** | +| <leader>af | Send File | **n** | +| <leader>ap | Sidekick Select Prompt | **n**, **x** | +| <leader>as | Select CLI | **n** | +| <leader>at | Send This | **n**, **x** | +| <leader>av | Send Visual Selection | **x** | +| <c-.> | Sidekick Toggle | **n**, **i**, **t**, **x** | + +## [mini.surround](https://github.com/nvim-mini/mini.surround.git) Part of [lazyvim.plugins.extras.coding.mini-surround](/extras/coding/mini-surround) | Key | Description | Mode | | --- | --- | --- | -| gsa | Add Surrounding | **n**, **v** | +| gsa | Add Surrounding | **n**, **x** | | gsd | Delete Surrounding | **n** | | gsf | Find Right Surrounding | **n** | | gsF | Find Left Surrounding | **n** | @@ -354,7 +402,6 @@ Part of [lazyvim.plugins.extras.dap.core](/extras/dap/core) | Key | Description | Mode | | --- | --- | --- | -| <leader>d | +debug | **n**, **v** | | <leader>da | Run with Args | **n** | | <leader>db | Toggle Breakpoint | **n** | | <leader>dB | Breakpoint Condition | **n** | @@ -367,7 +414,7 @@ Part of [lazyvim.plugins.extras.dap.core](/extras/dap/core) | <leader>dl | Run Last | **n** | | <leader>do | Step Out | **n** | | <leader>dO | Step Over | **n** | -| <leader>dp | Pause | **n** | +| <leader>dP | Pause | **n** | | <leader>dr | Toggle REPL | **n** | | <leader>ds | Session | **n** | | <leader>dt | Terminate | **n** | @@ -378,7 +425,7 @@ Part of [lazyvim.plugins.extras.dap.core](/extras/dap/core) | Key | Description | Mode | | --- | --- | --- | -| <leader>de | Eval | **n**, **v** | +| <leader>de | Eval | **n**, **x** | | <leader>du | Dap UI | **n** | ## [aerial.nvim](https://github.com/stevearc/aerial.nvim.git) @@ -402,60 +449,8 @@ Part of [lazyvim.plugins.extras.editor.dial](/extras/editor/dial) | --- | --- | --- | | <C-a> | Increment | **n**, **v** | | <C-x> | Decrement | **n**, **v** | -| g<C-a> | Increment | **n**, **v** | -| g<C-x> | Decrement | **n**, **v** | - -## [fzf-lua](https://github.com/ibhagwan/fzf-lua.git) -Part of [lazyvim.plugins.extras.editor.fzf](/extras/editor/fzf) - -| Key | Description | Mode | -| --- | --- | --- | -| <leader><space> | Find Files (Root Dir) | **n** | -| <leader>, | Switch Buffer | **n** | -| <leader>/ | Grep (Root Dir) | **n** | -| <leader>: | Command History | **n** | -| <leader>fb | Buffers | **n** | -| <leader>fc | Find Config File | **n** | -| <leader>ff | Find Files (Root Dir) | **n** | -| <leader>fF | Find Files (cwd) | **n** | -| <leader>fg | Find Files (git-files) | **n** | -| <leader>fr | Recent | **n** | -| <leader>fR | Recent (cwd) | **n** | -| <leader>gc | Commits | **n** | -| <leader>gs | Status | **n** | -| <leader>s" | Registers | **n** | -| <leader>sa | Auto Commands | **n** | -| <leader>sb | Buffer | **n** | -| <leader>sc | Command History | **n** | -| <leader>sC | Commands | **n** | -| <leader>sd | Document Diagnostics | **n** | -| <leader>sD | Workspace Diagnostics | **n** | -| <leader>sg | Grep (Root Dir) | **n** | -| <leader>sG | Grep (cwd) | **n** | -| <leader>sh | Help Pages | **n** | -| <leader>sH | Search Highlight Groups | **n** | -| <leader>sj | Jumplist | **n** | -| <leader>sk | Key Maps | **n** | -| <leader>sl | Location List | **n** | -| <leader>sm | Jump to Mark | **n** | -| <leader>sM | Man Pages | **n** | -| <leader>sq | Quickfix List | **n** | -| <leader>sR | Resume | **n** | -| <leader>ss | Goto Symbol | **n** | -| <leader>sS | Goto Symbol (Workspace) | **n** | -| <leader>sw | Word (Root Dir) | **n** | -| <leader>sW | Word (cwd) | **n** | -| <leader>sw | Selection (Root Dir) | **v** | -| <leader>sW | Selection (cwd) | **v** | -| <leader>uC | Colorscheme with Preview | **n** | - -## [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) -Part of [lazyvim.plugins.extras.editor.fzf](/extras/editor/fzf) - -| Key | Description | Mode | -| --- | --- | --- | -| <leader>st | Todo | **n** | -| <leader>sT | Todo/Fix/Fixme | **n** | +| g<C-a> | Increment | **n**, **x** | +| g<C-x> | Decrement | **n**, **x** | ## [harpoon](https://github.com/ThePrimeagen/harpoon.git) Part of [lazyvim.plugins.extras.editor.harpoon2](/extras/editor/harpoon2) @@ -467,6 +462,10 @@ Part of [lazyvim.plugins.extras.editor.harpoon2](/extras/editor/harpoon2) | <leader>3 | Harpoon to File 3 | **n** | | <leader>4 | Harpoon to File 4 | **n** | | <leader>5 | Harpoon to File 5 | **n** | +| <leader>6 | Harpoon to File 6 | **n** | +| <leader>7 | Harpoon to File 7 | **n** | +| <leader>8 | Harpoon to File 8 | **n** | +| <leader>9 | Harpoon to File 9 | **n** | | <leader>h | Harpoon Quick Menu | **n** | | <leader>H | Harpoon File | **n** | @@ -487,21 +486,21 @@ Part of [lazyvim.plugins.extras.editor.leap](/extras/editor/leap) | s | Leap Forward to | **n**, **o**, **x** | | S | Leap Backward to | **n**, **o**, **x** | -## [mini.surround](https://github.com/echasnovski/mini.surround.git) +## [mini.surround](https://github.com/nvim-mini/mini.surround.git) Part of [lazyvim.plugins.extras.editor.leap](/extras/editor/leap) | Key | Description | Mode | | --- | --- | --- | | gz | +surround | **n** | -## [mini.diff](https://github.com/echasnovski/mini.diff.git) +## [mini.diff](https://github.com/nvim-mini/mini.diff.git) Part of [lazyvim.plugins.extras.editor.mini-diff](/extras/editor/mini-diff) | Key | Description | Mode | | --- | --- | --- | | <leader>go | Toggle mini.diff overlay | **n** | -## [mini.files](https://github.com/echasnovski/mini.files.git) +## [mini.files](https://github.com/nvim-mini/mini.files.git) Part of [lazyvim.plugins.extras.editor.mini-files](/extras/editor/mini-files) | Key | Description | Mode | @@ -534,62 +533,84 @@ Part of [lazyvim.plugins.extras.editor.refactoring](/extras/editor/refactoring) | Key | Description | Mode | | --- | --- | --- | -| <leader>r | +refactor | **n**, **v** | -| <leader>rb | Extract Block | **n** | +| <leader>r | +refactor | **n**, **x** | +| <leader>rb | Extract Block | **n**, **x** | | <leader>rc | Debug Cleanup | **n** | -| <leader>rf | Extract Block To File | **n** | -| <leader>rf | Extract Function | **v** | -| <leader>rF | Extract Function To File | **v** | -| <leader>ri | Inline Variable | **n**, **v** | -| <leader>rp | Debug Print Variable | **n**, **v** | +| <leader>rf | Extract Function | **n**, **x** | +| <leader>rF | Extract Function To File | **n**, **x** | +| <leader>ri | Inline Variable | **n**, **x** | +| <leader>rp | Debug Print Variable | **n**, **x** | | <leader>rP | Debug Print | **n** | -| <leader>rs | Refactor | **v** | -| <leader>rx | Extract Variable | **v** | +| <leader>rs | Refactor | **n**, **x** | +| <leader>rx | Extract Variable | **n**, **x** | -## [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) -Part of [lazyvim.plugins.extras.editor.telescope](/extras/editor/telescope) +## [snacks.nvim](https://github.com/folke/snacks.nvim.git) +Part of [lazyvim.plugins.extras.editor.snacks_explorer](/extras/editor/snacks_explorer) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>e | Explorer Snacks (root dir) | **n** | +| <leader>E | Explorer Snacks (cwd) | **n** | +| <leader>fe | Explorer Snacks (root dir) | **n** | +| <leader>fE | Explorer Snacks (cwd) | **n** | + +## [snacks.nvim](https://github.com/folke/snacks.nvim.git) +Part of [lazyvim.plugins.extras.editor.snacks_picker](/extras/editor/snacks_picker) | Key | Description | Mode | | --- | --- | --- | | <leader><space> | Find Files (Root Dir) | **n** | -| <leader>, | Switch Buffer | **n** | +| <leader>, | Buffers | **n** | | <leader>/ | Grep (Root Dir) | **n** | | <leader>: | Command History | **n** | | <leader>fb | Buffers | **n** | +| <leader>fB | Buffers (all) | **n** | | <leader>fc | Find Config File | **n** | | <leader>ff | Find Files (Root Dir) | **n** | | <leader>fF | Find Files (cwd) | **n** | | <leader>fg | Find Files (git-files) | **n** | +| <leader>fp | Projects | **n** | | <leader>fr | Recent | **n** | | <leader>fR | Recent (cwd) | **n** | -| <leader>gc | Commits | **n** | -| <leader>gs | Status | **n** | +| <leader>gd | Git Diff (hunks) | **n** | +| <leader>gD | Git Diff (origin) | **n** | +| <leader>gs | Git Status | **n** | +| <leader>gS | Git Stash | **n** | +| <leader>n | Notification History | **n** | | <leader>s" | Registers | **n** | -| <leader>sa | Auto Commands | **n** | -| <leader>sb | Buffer | **n** | +| <leader>s/ | Search History | **n** | +| <leader>sa | Autocmds | **n** | +| <leader>sb | Buffer Lines | **n** | +| <leader>sB | Grep Open Buffers | **n** | | <leader>sc | Command History | **n** | | <leader>sC | Commands | **n** | -| <leader>sd | Document Diagnostics | **n** | -| <leader>sD | Workspace Diagnostics | **n** | +| <leader>sd | Diagnostics | **n** | +| <leader>sD | Buffer Diagnostics | **n** | | <leader>sg | Grep (Root Dir) | **n** | | <leader>sG | Grep (cwd) | **n** | | <leader>sh | Help Pages | **n** | -| <leader>sH | Search Highlight Groups | **n** | -| <leader>sj | Jumplist | **n** | -| <leader>sk | Key Maps | **n** | +| <leader>sH | Highlights | **n** | +| <leader>si | Icons | **n** | +| <leader>sj | Jumps | **n** | +| <leader>sk | Keymaps | **n** | | <leader>sl | Location List | **n** | -| <leader>sm | Jump to Mark | **n** | +| <leader>sm | Marks | **n** | | <leader>sM | Man Pages | **n** | -| <leader>so | Options | **n** | +| <leader>sp | Search for Plugin Spec | **n** | | <leader>sq | Quickfix List | **n** | | <leader>sR | Resume | **n** | -| <leader>ss | Goto Symbol | **n** | -| <leader>sS | Goto Symbol (Workspace) | **n** | -| <leader>sw | Word (Root Dir) | **n** | -| <leader>sW | Word (cwd) | **n** | -| <leader>sw | Selection (Root Dir) | **v** | -| <leader>sW | Selection (cwd) | **v** | -| <leader>uC | Colorscheme with Preview | **n** | +| <leader>su | Undotree | **n** | +| <leader>sw | Visual selection or word (Root Dir) | **n**, **x** | +| <leader>sW | Visual selection or word (cwd) | **n**, **x** | +| <leader>uC | Colorschemes | **n** | + +## [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) +Part of [lazyvim.plugins.extras.editor.snacks_picker](/extras/editor/snacks_picker) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>st | Todo | **n** | +| <leader>sT | Todo/Fix/Fixme | **n** | ## [nvim-ansible](https://github.com/mfussenegger/nvim-ansible.git) Part of [lazyvim.plugins.extras.lang.ansible](/extras/lang/ansible) @@ -598,6 +619,23 @@ Part of [lazyvim.plugins.extras.lang.ansible](/extras/lang/ansible) | --- | --- | --- | | <leader>ta | Ansible Run Playbook/Role | **n** | +## [haskell-tools.nvim](https://github.com/mrcjkb/haskell-tools.nvim.git) +Part of [lazyvim.plugins.extras.lang.haskell](/extras/lang/haskell) + +| Key | Description | Mode | +| --- | --- | --- | +| <localleader>e | Evaluate All | **n** | +| <localleader>h | Hoogle Signature | **n** | +| <localleader>r | REPL (Package) | **n** | +| <localleader>R | REPL (Buffer) | **n** | + +## [telescope_hoogle](https://github.com/luc-tielen/telescope_hoogle.git) +Part of [lazyvim.plugins.extras.lang.haskell](/extras/lang/haskell) + +| Key | Description | Mode | +| --- | --- | --- | +| <localleader>H | Hoogle | **n** | + ## [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim.git) Part of [lazyvim.plugins.extras.lang.markdown](/extras/lang/markdown) @@ -620,6 +658,15 @@ Part of [lazyvim.plugins.extras.lang.python](/extras/lang/python) | --- | --- | --- | | <leader>cv | Select VirtualEnv | **n** | +## [nvim-metals](https://github.com/scalameta/nvim-metals.git) +Part of [lazyvim.plugins.extras.lang.scala](/extras/lang/scala) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>mc | Metals compile cascade | **n** | +| <leader>me | Metals commands | **n** | +| <leader>mh | Metals hover worksheet | **n** | + ## [vim-dadbod-ui](https://github.com/kristijanhusak/vim-dadbod-ui.git) Part of [lazyvim.plugins.extras.lang.sql](/extras/lang/sql) @@ -634,12 +681,20 @@ Part of [lazyvim.plugins.extras.lang.tex](/extras/lang/tex) | --- | --- | --- | | <localLeader>l | +vimtex | **n** | +## [typst-preview.nvim](https://github.com/chomosuke/typst-preview.nvim.git) +Part of [lazyvim.plugins.extras.lang.typst](/extras/lang/typst) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>cp | Toggle Typst Preview | **n** | + ## [neotest](https://github.com/nvim-neotest/neotest.git) Part of [lazyvim.plugins.extras.test.core](/extras/test/core) | Key | Description | Mode | | --- | --- | --- | | <leader>t | +test | **n** | +| <leader>ta | Attach to Test (Neotest) | **n** | | <leader>tl | Run Last (Neotest) | **n** | | <leader>to | Show Output (Neotest) | **n** | | <leader>tO | Toggle Output Panel (Neotest) | **n** | @@ -672,7 +727,45 @@ Part of [lazyvim.plugins.extras.util.chezmoi](/extras/util/chezmoi) | --- | --- | --- | | <leader>sz | Chezmoi | **n** | -## [mason.nvim](https://github.com/williamboman/mason.nvim.git) +## [gh.nvim](https://github.com/ldelossa/gh.nvim.git) +Part of [lazyvim.plugins.extras.util.gh](/extras/util/gh) + +| Key | Description | Mode | +| --- | --- | --- | +| <leader>G | +Github | **n** | +| <leader>Gc | +Commits | **n** | +| <leader>Gcc | Close | **n** | +| <leader>Gce | Expand | **n** | +| <leader>Gco | Open To | **n** | +| <leader>Gcp | Pop Out | **n** | +| <leader>Gcz | Collapse | **n** | +| <leader>Gi | +Issues | **n** | +| <leader>Gio | Open | **n** | +| <leader>Gip | Preview | **n** | +| <leader>Gl | +Litee | **n** | +| <leader>Glt | Toggle Panel | **n** | +| <leader>Gp | +Pull Request | **n** | +| <leader>Gpc | Close | **n** | +| <leader>Gpd | Details | **n** | +| <leader>Gpe | Expand | **n** | +| <leader>Gpo | Open | **n** | +| <leader>Gpp | PopOut | **n** | +| <leader>Gpr | Refresh | **n** | +| <leader>Gpt | Open To | **n** | +| <leader>Gpz | Collapse | **n** | +| <leader>Gr | +Review | **n** | +| <leader>Grb | Begin | **n** | +| <leader>Grc | Close | **n** | +| <leader>Grd | Delete | **n** | +| <leader>Gre | Expand | **n** | +| <leader>Grs | Submit | **n** | +| <leader>Grz | Collapse | **n** | +| <leader>Gt | +Threads | **n** | +| <leader>Gtc | Create | **n** | +| <leader>Gtn | Next | **n** | +| <leader>Gtt | Toggle | **n** | + +## [mason.nvim](https://github.com/mason-org/mason.nvim.git) Part of [lazyvim.plugins.extras.util.gitui](/extras/util/gitui) | Key | Description | Mode | @@ -725,6 +818,7 @@ Part of [lazyvim.plugins.extras.util.rest](/extras/util/rest) | <leader>Rb | Open scratchpad | **n** | | <leader>Rc | Copy as cURL | **n** | | <leader>RC | Paste from curl | **n** | +| <leader>Re | Set environment | **n** | | <leader>Rg | Download GraphQL schema | **n** | | <leader>Ri | Inspect current request | **n** | | <leader>Rn | Jump to next request | **n** | diff --git a/docs/news.md b/docs/news.md index 57d13e9fd0..feec7aef4c 100644 --- a/docs/news.md +++ b/docs/news.md @@ -4,6 +4,79 @@ sidebar_position: 2 # 📰 What's new? +## 15.x + +**Neovim** `>= 0.11.2` includes a lot of changes to the underlying LSP implementation. + +Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support for older versions. + +### Changes + +- removed compatibility code for Neovim `< 0.11.2` +- configure **LSP** with the native `vim.lsp.config` +- migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` +- migrated to [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter/tree/main) **main** branch + - with the new version, the `tree-sitter` cli is **required** to install parsers + - best to run `:checkhealth nvim-treesitter` after updating +- replace `nvim-treesitter` incremental selection with `flash.nvim`, since it is no longer supported +- enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions +- use **LSP** based folding when available (disable with `nvim-lspconfig.folds.enabled = false`) + +## 14.x + +Big new release with a lot of changes and improvements! +Two new plugins have been added, and a lot of plugins have been replaced. +With these changes, default **LazyVim** is now just `34` plugins. + +### Added Plugins + +- [fzf-lua](https://github.com/ibhagwan/fzf-lua) as a replacement for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) + - to use **telescope.nvim** instead, enable the `editor.telescope` extra +- [blink.cmp](https://github.com/saghen/blink.cmp) as a replacement for [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) + - to use **nvim-cmp** instead, enable the `coding.nvim-cmp` extra + +### Removed Plugins + +- [dressing.nvim](https://github.com/stevearc/dressing.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua) and [snacks.input](https://github.com/folke/snacks.nvim)) +- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua)) +- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua)) +- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) (replaced with [snacks.indent](https://github.com/Folke/snacks.nvim)) + - to use **indent-blankline.nvim** instead, enable the `indent-blankline` extra +- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [nvim-snippets](https://github.com/hrsh7th/vim-vsnip) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-path](https://github.com/hrsh7th/cmp-path) (replaced with [blink](https://github.com/Saghen/blink.cmp)) + +### Changes + +- added [`snacks.input`](https://github.com/folke/snacks.nvim/blob/main/docs/input.md) +- added [`snacks.scroll`](https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md) +- added [`snacks.indent`](https://github.com/folke/snacks.nvim/blob/main/docs/indent.md) +- added [`snacks.scope`](https://github.com/folke/snacks.nvim/blob/main/docs/scope.md) +- added [`snacks.dim`](https://github.com/folke/snacks.nvim/blob/main/docs/dim.md) +- added [`snacks.zen`](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- changed default [`which-key`](https://github.com/folke/which-key.nvim) preset to `helix` +- drop `LazyVim.ui.fg` in favor of [`Snacks.util.color`](https://github.com/folke/snacks.nvim/blob/main/docs/util.md) + +To disable **all animations**, add the following to your `options.lua`: + +```lua +vim.g.snacks_animate = false +``` + +### Keymaps + +- `uz` to toggle [zen mode](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- `uZ` & `wm` to toggle [zoom mode](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- `uD` to toggle [dimming](https://github.com/folke/snacks.nvim/blob/main/docs/dim.md) +- `ua` to toggle [animations](https://github.com/folke/snacks.nvim/blob/main/docs/animate.md) +- `uS` to toggle [scroll](https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md) +- `ug` to toggle [indent guides](https://github.com/folke/snacks.nvim/blob/main/docs/indent.md) +- [`snacks.profiler`](https://github.com/folke/snacks.nvim/blob/main/docs/profiler.md) keymaps under `dp` + +--- + ## 13.x - **LazyVim** now uses `Snacks.dashboard` as the default dashboard. @@ -25,6 +98,8 @@ sidebar_position: 2 - `Snacks.terminal` is similar to `lazyterm`, but has more features and creates bottom splits by default (similar to the `edgy` integrating) +--- + ## 12.x - **Markdown Extra**: [headlines.nvim](https://github.com/lukas-reineke/headlines.nvim) has been removed in favor of [markdown.nvim](https://github.com/MeanderingProgrammer/markdown.nvim) @@ -52,10 +127,11 @@ sidebar_position: 2 - moved `neoconf.nvim` to extras. Project specific LSP settings can be done with a `.lazy.lua` file instead. +--- + ## 11.x - **Keymaps:** - - `gB` to open the current repo in the browser - `gco` and `gcO` to add a comment below or above the current line - `wm` to toggle window maximize @@ -68,7 +144,6 @@ sidebar_position: 2 It's a great plugin that enhances the native text objects. - `:LazyExtras` now has multiple new sections: - - **Enabled**: extras that are currently enabled - **Recommended Languages**: language extras recommended for the current buffer / directory - **Recommended Plugins**: extras that are recommended for most users @@ -106,11 +181,12 @@ Additionally, some core plugins have been moved to extras. ``` - plugins moved to extras: - - `mini.surround` - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` +--- + ## 10.x - added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md) @@ -122,7 +198,6 @@ Additionally, some core plugins have been moved to extras. You can find the updated docs [here](https://github.com/folke/trouble.nvim/tree/dev) - The **lazygit** integration now configures: - - the theme based on the colorscheme - nerd font icons (v3) - editor preset is set to `nvim-remote` for better interop with Neovim @@ -163,9 +238,7 @@ Additionally, some core plugins have been moved to extras. - New `:LazyExtras` command for managing **LazyVim** extras - Improved **formatting**: - - **LazyVim** can now work with multiple formatters. Types: - - **primary**: only one primary formatter can be active at a time. _(conform, none-ls, LSP)_ - **secondary**: multiple secondary formatters can be active _(eslint, ...)_ @@ -184,18 +257,15 @@ Additionally, some core plugins have been moved to extras. ``` - `none-ls.nvim` is no longer installed by default - - `conform.nvim` is now the default formatter - `nvim-lint` is now the default linter - If you want to keep using `none-ls.nvim`, you can enable the **lsp.none-ls** extra - `dashboard.nvim` is the new default dashboard plugin - - If you want to keep using `alpha.nvim`, you can enable the **ui.alpha** extra - Improved **root detection**: - - New `:LazyRoot` command that shows info about the root dir detection - Configurable with `vim.g.root_spec` diff --git a/docs/plugins/coding.md b/docs/plugins/coding.md index d324e93d33..d9fd2ab346 100644 --- a/docs/plugins/coding.md +++ b/docs/plugins/coding.md @@ -5,365 +5,11 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +## [mini.pairs](https://github.com/nvim-mini/mini.pairs) - auto completion - - - - - - -```lua -opts = function() - vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) - local cmp = require("cmp") - local defaults = require("cmp.config.default")() - local auto_select = true - return { - auto_brackets = {}, -- configure any filetype to auto add brackets - completion = { - completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), - }, - preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.complete(), - [""] = LazyVim.cmp.confirm({ select = auto_select }), - [""] = LazyVim.cmp.confirm({ select = true }), - [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = function(fallback) - cmp.abort() - fallback() - end, - [""] = function(fallback) - return LazyVim.cmp.map({ "snippet_forward", "ai_accept" }, fallback)() - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "path" }, - }, { - { name = "buffer" }, - }), - formatting = { - format = function(entry, item) - local icons = LazyVim.config.icons.kinds - if icons[item.kind] then - item.kind = icons[item.kind] .. item.kind - end - - local widths = { - abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, - menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, - } - - for key, width in pairs(widths) do - if item[key] and vim.fn.strdisplaywidth(item[key]) > width then - item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" - end - end - - return item - end, - }, - experimental = { - -- only show ghost text when we show ai completions - ghost_text = vim.g.ai_cmp and { - hl_group = "CmpGhostText", - } or false, - }, - sorting = defaults.sorting, - } -end -``` - - - - - - -```lua -{ - "hrsh7th/nvim-cmp", - version = false, -- last release is way too old - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - }, - -- Not all LSP servers add brackets when completing a function. - -- To better deal with this, LazyVim adds a custom option to cmp, - -- that you can configure. For example: - -- - -- ```lua - -- opts = { - -- auto_brackets = { "python" } - -- } - -- ``` - opts = function() - vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) - local cmp = require("cmp") - local defaults = require("cmp.config.default")() - local auto_select = true - return { - auto_brackets = {}, -- configure any filetype to auto add brackets - completion = { - completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), - }, - preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.complete(), - [""] = LazyVim.cmp.confirm({ select = auto_select }), - [""] = LazyVim.cmp.confirm({ select = true }), - [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = function(fallback) - cmp.abort() - fallback() - end, - [""] = function(fallback) - return LazyVim.cmp.map({ "snippet_forward", "ai_accept" }, fallback)() - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "path" }, - }, { - { name = "buffer" }, - }), - formatting = { - format = function(entry, item) - local icons = LazyVim.config.icons.kinds - if icons[item.kind] then - item.kind = icons[item.kind] .. item.kind - end - - local widths = { - abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, - menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, - } - - for key, width in pairs(widths) do - if item[key] and vim.fn.strdisplaywidth(item[key]) > width then - item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" - end - end - - return item - end, - }, - experimental = { - -- only show ghost text when we show ai completions - ghost_text = vim.g.ai_cmp and { - hl_group = "CmpGhostText", - } or false, - }, - sorting = defaults.sorting, - } - end, - main = "lazyvim.util.cmp", -} -``` - - - - - -## [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -{ - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", -} -``` - - - - - -## [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -"hrsh7th/cmp-buffer" -``` - - - - - -## [cmp-path](https://github.com/hrsh7th/cmp-path) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -"hrsh7th/cmp-path" -``` - - - - - -## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - - snippets - - - - - - -```lua -opts = function(_, opts) - opts.snippet = { - expand = function(item) - return LazyVim.cmp.expand(item.body) - end, - } - if LazyVim.has("nvim-snippets") then - table.insert(opts.sources, { name = "snippets" }) - end -end -``` - - - - - - -```lua -{ - "nvim-cmp", - optional = true, - dependencies = { - { - "garymjr/nvim-snippets", - opts = { - friendly_snippets = true, - }, - dependencies = { "rafamadriz/friendly-snippets" }, - }, - }, - opts = function(_, opts) - opts.snippet = { - expand = function(item) - return LazyVim.cmp.expand(item.body) - end, - } - if LazyVim.has("nvim-snippets") then - table.insert(opts.sources, { name = "snippets" }) - end - end, -} -``` - - - - - -## [nvim-snippets](https://github.com/garymjr/nvim-snippets) - - - - - -```lua -opts = { - friendly_snippets = true, -} -``` - - - - - - -```lua -{ - "garymjr/nvim-snippets", - opts = { - friendly_snippets = true, - }, - dependencies = { "rafamadriz/friendly-snippets" }, -} -``` - - - - - -## [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) - - - - - -```lua -opts = nil -``` - - - - - - -```lua -{ "rafamadriz/friendly-snippets" } -``` - - - - - -## [mini.pairs](https://github.com/echasnovski/mini.pairs) - - auto pairs + Auto pairs + Automatically inserts a matching closing character + when you type an opening character like `"`, `[`, or `(`. @@ -392,7 +38,7 @@ opts = { ```lua { - "echasnovski/mini.pairs", + "nvim-mini/mini.pairs", event = "VeryLazy", opts = { modes = { insert = true, command = true, terminal = false }, @@ -418,7 +64,9 @@ opts = { ## [ts-comments.nvim](https://github.com/folke/ts-comments.nvim) - comments + Improves comment syntax, lets Neovim handle multiple + types of comments for a single language, and relaxes rules + for uncommenting. @@ -446,9 +94,11 @@ opts = {} -## [mini.ai](https://github.com/echasnovski/mini.ai) +## [mini.ai](https://github.com/nvim-mini/mini.ai) - Better text-objects + Extends the a & i text objects, this adds the ability to select + arguments, function calls, text within quotes and brackets, and to + repeat those selections to select an outer text object. @@ -473,7 +123,6 @@ opts = function() { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]", "%f[%P][%l%d]+%f[^%l%d]", "^[%l%d]+%f[^%l%d]" }, "^().*()$", }, - i = LazyVim.mini.ai_indent, -- indent g = LazyVim.mini.ai_buffer, -- buffer u = ai.gen_spec.function_call(), -- u for "Usage" U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name @@ -489,7 +138,7 @@ end ```lua { - "echasnovski/mini.ai", + "nvim-mini/mini.ai", event = "VeryLazy", opts = function() local ai = require("mini.ai") @@ -508,7 +157,6 @@ end { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]", "%f[%P][%l%d]+%f[^%l%d]", "^[%l%d]+%f[^%l%d]" }, "^().*()$", }, - i = LazyVim.mini.ai_indent, -- indent g = LazyVim.mini.ai_buffer, -- buffer u = ai.gen_spec.function_call(), -- u for "Usage" U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name @@ -532,6 +180,10 @@ end ## [lazydev.nvim](https://github.com/folke/lazydev.nvim) + Configures LuaLS to support auto-completion and type checking + while editing your Neovim configuration. + + @@ -572,38 +224,4 @@ opts = { -## [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - - Add lazydev source to cmp - - - - - - -```lua -opts = function(_, opts) - table.insert(opts.sources, { name = "lazydev", group_index = 0 }) -end -``` - - - - - - -```lua -{ - "hrsh7th/nvim-cmp", - optional = true, - opts = function(_, opts) - table.insert(opts.sources, { name = "lazydev", group_index = 0 }) - end, -} -``` - - - - - diff --git a/docs/plugins/colorscheme.md b/docs/plugins/colorscheme.md index 4338a2b27a..4edf96b084 100644 --- a/docs/plugins/colorscheme.md +++ b/docs/plugins/colorscheme.md @@ -63,12 +63,21 @@ opts = { style = "moon" } ```lua opts = { + lsp_styles = { + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, integrations = { aerial = true, alpha = true, cmp = true, dashboard = true, flash = true, + fzf = true, grug_far = true, gitsigns = true, headlines = true, @@ -77,26 +86,14 @@ opts = { leap = true, lsp_trouble = true, mason = true, - markdown = true, mini = true, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, navic = { enabled = true, custom_bg = "lualine" }, neotest = true, neotree = true, noice = true, notify = true, - semantic_tokens = true, snacks = true, telescope = true, - treesitter = true, treesitter_context = true, which_key = true, }, @@ -114,12 +111,21 @@ opts = { lazy = true, name = "catppuccin", opts = { + lsp_styles = { + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, integrations = { aerial = true, alpha = true, cmp = true, dashboard = true, flash = true, + fzf = true, grug_far = true, gitsigns = true, headlines = true, @@ -128,26 +134,14 @@ opts = { leap = true, lsp_trouble = true, mason = true, - markdown = true, mini = true, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, navic = { enabled = true, custom_bg = "lualine" }, neotest = true, neotree = true, noice = true, notify = true, - semantic_tokens = true, snacks = true, telescope = true, - treesitter = true, treesitter_context = true, which_key = true, }, @@ -158,7 +152,7 @@ opts = { optional = true, opts = function(_, opts) if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + opts.highlights = require("catppuccin.special.bufferline").get_theme() end end, }, @@ -179,7 +173,7 @@ opts = { ```lua opts = function(_, opts) if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + opts.highlights = require("catppuccin.special.bufferline").get_theme() end end ``` @@ -195,7 +189,7 @@ end optional = true, opts = function(_, opts) if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + opts.highlights = require("catppuccin.special.bufferline").get_theme() end end, } diff --git a/docs/plugins/editor.md b/docs/plugins/editor.md index 7048292874..06235c04da 100644 --- a/docs/plugins/editor.md +++ b/docs/plugins/editor.md @@ -5,204 +5,6 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -### Includes the following extras - -- [editor.fzf](/extras/editor/fzf) -- [editor.telescope](/extras/editor/telescope) - -## [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) - - file explorer - - - - - - -```lua -opts = { - sources = { "filesystem", "buffers", "git_status" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - filesystem = { - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - }, - window = { - mappings = { - ["l"] = "open", - ["h"] = "close_node", - [""] = "none", - ["Y"] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - desc = "Copy Path to Clipboard", - }, - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - ["P"] = { "toggle_preview", config = { use_float = false } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - git_status = { - symbols = { - unstaged = "󰄱", - staged = "󰱒", - }, - }, - }, -} -``` - - - - - - -```lua -{ - "nvim-neo-tree/neo-tree.nvim", - cmd = "Neotree", - keys = { - { - "fe", - function() - require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) - end, - desc = "Explorer NeoTree (Root Dir)", - }, - { - "fE", - function() - require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) - end, - desc = "Explorer NeoTree (cwd)", - }, - { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, - { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, - { - "ge", - function() - require("neo-tree.command").execute({ source = "git_status", toggle = true }) - end, - desc = "Git Explorer", - }, - { - "be", - function() - require("neo-tree.command").execute({ source = "buffers", toggle = true }) - end, - desc = "Buffer Explorer", - }, - }, - deactivate = function() - vim.cmd([[Neotree close]]) - end, - init = function() - -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, - -- because `cwd` is not set up properly. - vim.api.nvim_create_autocmd("BufEnter", { - group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), - desc = "Start Neo-tree with directory", - once = true, - callback = function() - if package.loaded["neo-tree"] then - return - else - local stats = vim.uv.fs_stat(vim.fn.argv(0)) - if stats and stats.type == "directory" then - require("neo-tree") - end - end - end, - }) - end, - opts = { - sources = { "filesystem", "buffers", "git_status" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - filesystem = { - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - }, - window = { - mappings = { - ["l"] = "open", - ["h"] = "close_node", - [""] = "none", - ["Y"] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - desc = "Copy Path to Clipboard", - }, - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - ["P"] = { "toggle_preview", config = { use_float = false } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - git_status = { - symbols = { - unstaged = "󰄱", - staged = "󰱒", - }, - }, - }, - }, - config = function(_, opts) - local function on_move(data) - Snacks.rename.on_rename_file(data.source, data.destination) - end - - local events = require("neo-tree.events") - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - require("neo-tree").setup(opts) - vim.api.nvim_create_autocmd("TermClose", { - pattern = "*lazygit", - callback = function() - if package.loaded["neo-tree.sources.git_status"] then - require("neo-tree.sources.git_status").refresh() - end - end, - }) - end, -} -``` - - - - - ## [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim) search/replace in multiple files @@ -225,7 +27,7 @@ opts = { headerMaxWidth = 80 } { "MagicDuck/grug-far.nvim", opts = { headerMaxWidth = 80 }, - cmd = "GrugFar", + cmd = { "GrugFar", "GrugFarWithin" }, keys = { { "sr", @@ -239,7 +41,7 @@ opts = { headerMaxWidth = 80 } }, }) end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Search and Replace", }, }, @@ -284,6 +86,16 @@ opts = {} { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + -- Simulate nvim-treesitter incremental selection + { "", mode = { "n", "o", "x" }, + function() + require("flash").treesitter({ + actions = { + [""] = "next", + [""] = "prev" + } + }) + end, desc = "Treesitter Incremental Selection" }, }, } ``` @@ -304,19 +116,22 @@ opts = {} ```lua opts = { + preset = "helix", defaults = {}, spec = { { - mode = { "n", "v" }, + mode = { "n", "x" }, { "", group = "tabs" }, { "c", group = "code" }, + { "d", group = "debug" }, + { "dp", group = "profiler" }, { "f", group = "file/find" }, { "g", group = "git" }, { "gh", group = "hunks" }, { "q", group = "quit/session" }, { "s", group = "search" }, - { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, - { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, + { "u", group = "ui" }, + { "x", group = "diagnostics/quickfix" }, { "[", group = "prev" }, { "]", group = "next" }, { "g", group = "goto" }, @@ -355,19 +170,22 @@ opts = { event = "VeryLazy", opts_extend = { "spec" }, opts = { + preset = "helix", defaults = {}, spec = { { - mode = { "n", "v" }, + mode = { "n", "x" }, { "", group = "tabs" }, { "c", group = "code" }, + { "d", group = "debug" }, + { "dp", group = "profiler" }, { "f", group = "file/find" }, { "g", group = "git" }, { "gh", group = "hunks" }, { "q", group = "quit/session" }, { "s", group = "search" }, - { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, - { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, + { "u", group = "ui" }, + { "x", group = "diagnostics/quickfix" }, { "[", group = "prev" }, { "]", group = "next" }, { "g", group = "goto" }, @@ -456,7 +274,7 @@ opts = { local gs = package.loaded.gitsigns local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc, silent = true }) end -- stylua: ignore start @@ -476,8 +294,8 @@ opts = { end, "Prev Hunk") map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk") map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk") - map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") + map({ "n", "x" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "x" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") map("n", "ghS", gs.stage_buffer, "Stage Buffer") map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "ghR", gs.reset_buffer, "Reset Buffer") @@ -520,7 +338,7 @@ opts = { local gs = package.loaded.gitsigns local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc, silent = true }) end -- stylua: ignore start @@ -540,8 +358,8 @@ opts = { end, "Prev Hunk") map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk") map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk") - map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") + map({ "n", "x" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "x" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") map("n", "ghS", gs.stage_buffer, "Stage Buffer") map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "ghR", gs.reset_buffer, "Reset Buffer") diff --git a/docs/plugins/formatting.md b/docs/plugins/formatting.md index db151eeb05..37ccf3e1de 100644 --- a/docs/plugins/formatting.md +++ b/docs/plugins/formatting.md @@ -87,7 +87,7 @@ end function() require("conform").format({ formatters = { "injected" }, timeout_ms = 3000 }) end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Format Injected Langs", }, }, @@ -161,7 +161,7 @@ end -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) diff --git a/docs/plugins/linting.md b/docs/plugins/linting.md index b0bfc8ece5..11392c5c6e 100644 --- a/docs/plugins/linting.md +++ b/docs/plugins/linting.md @@ -7,6 +7,10 @@ import TabItem from '@theme/TabItem'; ## [nvim-lint](https://github.com/mfussenegger/nvim-lint) + Asynchronously calls language-specific linter tools and reports + their results via the `vim.diagnostic` module. + + diff --git a/docs/plugins/lsp.md b/docs/plugins/lsp.md index 7d52c57650..a2b81e06f7 100644 --- a/docs/plugins/lsp.md +++ b/docs/plugins/lsp.md @@ -2,26 +2,86 @@ ## ⌨️ Customizing [LSP Keymaps](/keymaps#lsp) -The syntax for adding, deleting and changing [LSP Keymaps](/keymaps#lsp), -is the same as for [plugin keymaps](/configuration/plugins#%EF%B8%8F-adding--disabling-plugin-keymaps), -but you need to configure it using the `opts()` method. +LSP keymaps are configured using the `keys` option in your server configuration. +You can add global keymaps that apply to all LSP servers, or server-specific keymaps. + +### Global LSP Keymaps + +Use the special `servers['*']` key to add keymaps for all LSP servers: ```lua --- LSP keymaps { "neovim/nvim-lspconfig", - opts = function() - local keys = require("lazyvim.plugins.lsp.keymaps").get() - -- change a keymap - keys[#keys + 1] = { "K", "echo 'hello'" } - -- disable a keymap - keys[#keys + 1] = { "K", false } - -- add a keymap - keys[#keys + 1] = { "H", "echo 'hello'" } - end, + opts = { + servers = { + ['*'] = { + keys = { + -- Add a keymap + { "H", "echo 'hello'", desc = "Say Hello" }, + -- Change an existing keymap + { "K", "echo 'custom hover'", desc = "Custom Hover" }, + -- Disable a keymap + { "gd", false }, + }, + }, + }, + }, +} +``` + +### Server-Specific Keymaps + +Add keymaps for specific LSP servers: + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + vtsls = { + keys = { + { "co", function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, desc = "Organize Imports" }, + }, + }, + }, + }, } ``` +### Capability-Based Keymaps + +Use the `has` field to only set keymaps when the LSP server supports specific capabilities: + +```lua +{ + "neovim/nvim-lspconfig", + opts = { + servers = { + ['*'] = { + keys = { + -- Only set this keymap for servers that support code actions + { "ca", vim.lsp.buf.code_action, desc = "Code Action", has = "codeAction" }, + -- Multiple capabilities + { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", + has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, + }, + }, + }, + }, +} +``` + +**Note**: The `has` field automatically prefixes methods with `textDocument/` if no `/` is present. +So `has = "codeAction"` becomes `has = "textDocument/codeAction"`. + import Tabs from '@theme/Tabs'; @@ -50,7 +110,6 @@ opts = function() source = "if_many", prefix = "●", -- this will set set the prefix to a function that returns the diagnostics icon based on the severity - -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported -- prefix = "icons", }, severity_sort = true, @@ -63,32 +122,25 @@ opts = function() }, }, }, - -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP inlay hints on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the inlay hints. inlay_hints = { enabled = true, exclude = { "vue" }, -- filetypes for which you don't want to enable inlay hints }, - -- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP code lenses on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the code lenses. codelens = { enabled = false, }, - -- Enable lsp cursor word highlighting - document_highlight = { + -- Enable this to enable the builtin LSP folding on Neovim. + -- Be aware that you also will need to properly configure your LSP server to + -- provide the folds. + folds = { enabled = true, }, - -- add any global capabilities here - capabilities = { - workspace = { - fileOperations = { - didRename = true, - willRename = true, - }, - }, - }, -- options for vim.lsp.buf.format -- `bufnr` and `filter` is handled by the LazyVim formatter, -- but can be also overridden when specified @@ -97,8 +149,48 @@ opts = function() timeout_ms = nil, }, -- LSP Server Settings - ---@type lspconfig.options + -- Sets the default configuration for an LSP client (or all clients if the special name "*" is used). + ---@alias lazyvim.lsp.Config vim.lsp.Config|{mason?:boolean, enabled?:boolean, keys?:LazyKeysLspSpec[]} + ---@type table servers = { + -- configuration for all lsp servers + ["*"] = { + capabilities = { + workspace = { + fileOperations = { + didRename = true, + willRename = true, + }, + }, + }, + -- stylua: ignore + keys = { + { "cl", function() Snacks.picker.lsp_config() end, desc = "Lsp Info" }, + { "gd", vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" }, + { "gr", vim.lsp.buf.references, desc = "References", nowait = true }, + { "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" }, + { "gy", vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" }, + { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, + { "K", function() return vim.lsp.buf.hover() end, desc = "Hover" }, + { "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" }, + { "", function() return vim.lsp.buf.signature_help() end, mode = "i", desc = "Signature Help", has = "signatureHelp" }, + { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "x" }, has = "codeAction" }, + { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "x" }, has = "codeLens" }, + { "cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" }, + { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", mode ={"n"}, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, + { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }, + { "cA", LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" }, + { "]]", function() Snacks.words.jump(vim.v.count1) end, has = "documentHighlight", + desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "[[", function() Snacks.words.jump(-vim.v.count1) end, has = "documentHighlight", + desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(vim.v.count1, true) end, has = "documentHighlight", + desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(-vim.v.count1, true) end, has = "documentHighlight", + desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end }, + }, + }, + stylua = { enabled = false }, lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason -- Use this to add any additional keymaps @@ -133,7 +225,7 @@ opts = function() }, -- you can do any additional lsp server setup here -- return true if you don't want this server to be setup with lspconfig - ---@type table + ---@type table setup = { -- example to setup with typescript.nvim -- tsserver = function(_, opts) @@ -159,8 +251,9 @@ end event = "LazyFile", dependencies = { "mason.nvim", - { "williamboman/mason-lspconfig.nvim", config = function() end }, + { "mason-org/mason-lspconfig.nvim", config = function() end }, }, + opts_extend = { "servers.*.keys" }, opts = function() ---@class PluginLspOpts local ret = { @@ -174,7 +267,6 @@ end source = "if_many", prefix = "●", -- this will set set the prefix to a function that returns the diagnostics icon based on the severity - -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported -- prefix = "icons", }, severity_sort = true, @@ -187,32 +279,25 @@ end }, }, }, - -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP inlay hints on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the inlay hints. inlay_hints = { enabled = true, exclude = { "vue" }, -- filetypes for which you don't want to enable inlay hints }, - -- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP code lenses on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the code lenses. codelens = { enabled = false, }, - -- Enable lsp cursor word highlighting - document_highlight = { + -- Enable this to enable the builtin LSP folding on Neovim. + -- Be aware that you also will need to properly configure your LSP server to + -- provide the folds. + folds = { enabled = true, }, - -- add any global capabilities here - capabilities = { - workspace = { - fileOperations = { - didRename = true, - willRename = true, - }, - }, - }, -- options for vim.lsp.buf.format -- `bufnr` and `filter` is handled by the LazyVim formatter, -- but can be also overridden when specified @@ -221,8 +306,48 @@ end timeout_ms = nil, }, -- LSP Server Settings - ---@type lspconfig.options + -- Sets the default configuration for an LSP client (or all clients if the special name "*" is used). + ---@alias lazyvim.lsp.Config vim.lsp.Config|{mason?:boolean, enabled?:boolean, keys?:LazyKeysLspSpec[]} + ---@type table servers = { + -- configuration for all lsp servers + ["*"] = { + capabilities = { + workspace = { + fileOperations = { + didRename = true, + willRename = true, + }, + }, + }, + -- stylua: ignore + keys = { + { "cl", function() Snacks.picker.lsp_config() end, desc = "Lsp Info" }, + { "gd", vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" }, + { "gr", vim.lsp.buf.references, desc = "References", nowait = true }, + { "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" }, + { "gy", vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" }, + { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, + { "K", function() return vim.lsp.buf.hover() end, desc = "Hover" }, + { "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" }, + { "", function() return vim.lsp.buf.signature_help() end, mode = "i", desc = "Signature Help", has = "signatureHelp" }, + { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "x" }, has = "codeAction" }, + { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "x" }, has = "codeLens" }, + { "cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" }, + { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", mode ={"n"}, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, + { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }, + { "cA", LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" }, + { "]]", function() Snacks.words.jump(vim.v.count1) end, has = "documentHighlight", + desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "[[", function() Snacks.words.jump(-vim.v.count1) end, has = "documentHighlight", + desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(vim.v.count1, true) end, has = "documentHighlight", + desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(-vim.v.count1, true) end, has = "documentHighlight", + desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end }, + }, + }, + stylua = { enabled = false }, lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason -- Use this to add any additional keymaps @@ -257,7 +382,7 @@ end }, -- you can do any additional lsp server setup here -- return true if you don't want this server to be setup with lspconfig - ---@type table + ---@type table setup = { -- example to setup with typescript.nvim -- tsserver = function(_, opts) @@ -271,145 +396,116 @@ end return ret end, ---@param opts PluginLspOpts - config = function(_, opts) + config = vim.schedule_wrap(function(_, opts) -- setup autoformat LazyVim.format.register(LazyVim.lsp.formatter()) -- setup keymaps - LazyVim.lsp.on_attach(function(client, buffer) - require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) - end) - - LazyVim.lsp.setup() - LazyVim.lsp.on_dynamic_capability(require("lazyvim.plugins.lsp.keymaps").on_attach) + for server, server_opts in pairs(opts.servers) do + if type(server_opts) == "table" and server_opts.keys then + require("lazyvim.plugins.lsp.keymaps").set({ name = server ~= "*" and server or nil }, server_opts.keys) + end + end - -- diagnostics signs - if vim.fn.has("nvim-0.10.0") == 0 then - if type(opts.diagnostics.signs) ~= "boolean" then - for severity, icon in pairs(opts.diagnostics.signs.text) do - local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper) - name = "DiagnosticSign" .. name - vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + -- inlay hints + if opts.inlay_hints.enabled then + Snacks.util.lsp.on({ method = "textDocument/inlayHint" }, function(buffer) + if + vim.api.nvim_buf_is_valid(buffer) + and vim.bo[buffer].buftype == "" + and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) + then + vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) end - end + end) end - if vim.fn.has("nvim-0.10") == 1 then - -- inlay hints - if opts.inlay_hints.enabled then - LazyVim.lsp.on_supports_method("textDocument/inlayHint", function(client, buffer) - if - vim.api.nvim_buf_is_valid(buffer) - and vim.bo[buffer].buftype == "" - and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) - then - vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) - end - end) - end + -- folds + if opts.folds.enabled then + Snacks.util.lsp.on({ method = "textDocument/foldingRange" }, function() + if LazyVim.set_default("foldmethod", "expr") then + LazyVim.set_default("foldexpr", "v:lua.vim.lsp.foldexpr()") + end + end) + end - -- code lens - if opts.codelens.enabled and vim.lsp.codelens then - LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer) - vim.lsp.codelens.refresh() - vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { - buffer = buffer, - callback = vim.lsp.codelens.refresh, - }) - end) - end + -- code lens + if opts.codelens.enabled and vim.lsp.codelens then + Snacks.util.lsp.on({ method = "textDocument/codeLens" }, function(buffer) + vim.lsp.codelens.refresh() + vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { + buffer = buffer, + callback = vim.lsp.codelens.refresh, + }) + end) end + -- diagnostics if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then - opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●" - or function(diagnostic) - local icons = LazyVim.config.icons.diagnostics - for d, icon in pairs(icons) do - if diagnostic.severity == vim.diagnostic.severity[d:upper()] then - return icon - end + opts.diagnostics.virtual_text.prefix = function(diagnostic) + local icons = LazyVim.config.icons.diagnostics + for d, icon in pairs(icons) do + if diagnostic.severity == vim.diagnostic.severity[d:upper()] then + return icon end end + return "●" + end end - vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) - local servers = opts.servers - local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") - local has_blink, blink = pcall(require, "blink.cmp") - local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - has_cmp and cmp_nvim_lsp.default_capabilities() or {}, - has_blink and blink.get_lsp_capabilities() or {}, - opts.capabilities or {} - ) - - local function setup(server) - local server_opts = vim.tbl_deep_extend("force", { - capabilities = vim.deepcopy(capabilities), - }, servers[server] or {}) - if server_opts.enabled == false then - return - end + if opts.capabilities then + LazyVim.deprecate("lsp-config.opts.capabilities", "Use lsp-config.opts.servers['*'].capabilities instead") + opts.servers["*"] = vim.tbl_deep_extend("force", opts.servers["*"] or {}, { + capabilities = opts.capabilities, + }) + end - if opts.setup[server] then - if opts.setup[server](server, server_opts) then - return - end - elseif opts.setup["*"] then - if opts.setup["*"](server, server_opts) then - return - end - end - require("lspconfig")[server].setup(server_opts) + if opts.servers["*"] then + vim.lsp.config("*", opts.servers["*"]) end -- get all the servers that are available through mason-lspconfig - local have_mason, mlsp = pcall(require, "mason-lspconfig") - local all_mslp_servers = {} - if have_mason then - all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) - end + local have_mason = LazyVim.has("mason-lspconfig.nvim") + local mason_all = have_mason + and vim.tbl_keys(require("mason-lspconfig.mappings").get_mason_map().lspconfig_to_package) + or {} --[[ @as string[] ]] + local mason_exclude = {} ---@type string[] + + ---@return boolean? exclude automatic setup + local function configure(server) + if server == "*" then + return false + end + local sopts = opts.servers[server] + sopts = sopts == true and {} or (not sopts) and { enabled = false } or sopts --[[@as lazyvim.lsp.Config]] - local ensure_installed = {} ---@type string[] - for server, server_opts in pairs(servers) do - if server_opts then - server_opts = server_opts == true and {} or server_opts - if server_opts.enabled ~= false then - -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig - if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then - setup(server) - else - ensure_installed[#ensure_installed + 1] = server - end + if sopts.enabled == false then + mason_exclude[#mason_exclude + 1] = server + return + end + + local use_mason = sopts.mason ~= false and vim.tbl_contains(mason_all, server) + local setup = opts.setup[server] or opts.setup["*"] + if setup and setup(server, sopts) then + mason_exclude[#mason_exclude + 1] = server + else + vim.lsp.config(server, sopts) -- configure the server + if not use_mason then + vim.lsp.enable(server) end end + return use_mason end + local install = vim.tbl_filter(configure, vim.tbl_keys(opts.servers)) if have_mason then - mlsp.setup({ - ensure_installed = vim.tbl_deep_extend( - "force", - ensure_installed, - LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {} - ), - handlers = { setup }, + require("mason-lspconfig").setup({ + ensure_installed = vim.list_extend(install, LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {}), + automatic_enable = { exclude = mason_exclude }, }) end - - if LazyVim.lsp.is_enabled("denols") and LazyVim.lsp.is_enabled("vtsls") then - local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc") - LazyVim.lsp.disable("vtsls", is_deno) - LazyVim.lsp.disable("denols", function(root_dir, config) - if not is_deno(root_dir) then - config.settings.deno.enable = false - end - return false - end) - end - end, + end), } ``` @@ -417,7 +513,7 @@ end -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) @@ -435,7 +531,7 @@ opts = nil ```lua { "mason.nvim", - { "williamboman/mason-lspconfig.nvim", config = function() end }, + { "mason-org/mason-lspconfig.nvim", config = function() end }, } ``` @@ -443,7 +539,7 @@ opts = nil -## [mason-lspconfig.nvim](https://github.com/williamboman/mason-lspconfig.nvim) +## [mason-lspconfig.nvim](https://github.com/mason-org/mason-lspconfig.nvim) @@ -459,14 +555,14 @@ opts = {} ```lua -{ "williamboman/mason-lspconfig.nvim", config = function() end } +{ "mason-org/mason-lspconfig.nvim", config = function() end } ``` -## [mason.nvim](https://github.com/williamboman/mason.nvim) +## [mason.nvim](https://github.com/mason-org/mason.nvim) cmdline tools and lsp servers @@ -492,7 +588,7 @@ opts = { ```lua { - "williamboman/mason.nvim", + "mason-org/mason.nvim", cmd = "Mason", keys = { { "cm", "Mason", desc = "Mason" } }, build = ":MasonUpdate", diff --git a/docs/plugins/treesitter.md b/docs/plugins/treesitter.md index 32d65ccc9b..881fa6d09c 100644 --- a/docs/plugins/treesitter.md +++ b/docs/plugins/treesitter.md @@ -5,42 +5,6 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## [which-key.nvim](https://github.com/folke/which-key.nvim) - - - - - -```lua -opts = { - spec = { - { "", desc = "Decrement Selection", mode = "x" }, - { "", desc = "Increment Selection", mode = { "x", "n" } }, - }, -} -``` - - - - - - -```lua -{ - "folke/which-key.nvim", - opts = { - spec = { - { "", desc = "Decrement Selection", mode = "x" }, - { "", desc = "Increment Selection", mode = { "x", "n" } }, - }, - }, -} -``` - - - - - ## [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) Treesitter is a new parser generator tool that we can @@ -54,8 +18,10 @@ opts = { ```lua opts = { - highlight = { enable = true }, - indent = { enable = true }, + -- LazyVim config for treesitter + indent = { enable = true }, ---@type lazyvim.TSFeat + highlight = { enable = true }, ---@type lazyvim.TSFeat + folds = { enable = true }, ---@type lazyvim.TSFeat ensure_installed = { "bash", "c", @@ -82,24 +48,6 @@ opts = { "xml", "yaml", }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, - }, - }, } ``` @@ -111,30 +59,30 @@ opts = { ```lua { "nvim-treesitter/nvim-treesitter", + branch = "main", version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "LazyFile", "VeryLazy" }, - lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline - init = function(plugin) - -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early - -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which - -- no longer trigger the **nvim-treesitter** module to be loaded in time. - -- Luckily, the only things that those plugins need are the custom queries, which we make available - -- during startup. - require("lazy.core.loader").add_to_rtp(plugin) - require("nvim-treesitter.query_predicates") + build = function() + local TS = require("nvim-treesitter") + if not TS.get_installed then + LazyVim.error("Please restart Neovim and run `:TSUpdate` to use the `nvim-treesitter` **main** branch.") + return + end + -- make sure we're using the latest treesitter util + package.loaded["lazyvim.util.treesitter"] = nil + LazyVim.treesitter.build(function() + TS.update(nil, { summary = true }) + end) end, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, - keys = { - { "", desc = "Increment Selection" }, - { "", desc = "Decrement Selection", mode = "x" }, - }, + event = { "LazyFile", "VeryLazy" }, + cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" }, opts_extend = { "ensure_installed" }, - ---@type TSConfig - ---@diagnostic disable-next-line: missing-fields + ---@alias lazyvim.TSFeat { enable?: boolean, disable?: string[] } + ---@class lazyvim.TSConfig: TSConfig opts = { - highlight = { enable = true }, - indent = { enable = true }, + -- LazyVim config for treesitter + indent = { enable = true }, ---@type lazyvim.TSFeat + highlight = { enable = true }, ---@type lazyvim.TSFeat + folds = { enable = true }, ---@type lazyvim.TSFeat ensure_installed = { "bash", "c", @@ -161,31 +109,84 @@ opts = { "xml", "yaml", }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, - }, - }, }, - ---@param opts TSConfig + ---@param opts lazyvim.TSConfig config = function(_, opts) - if type(opts.ensure_installed) == "table" then - opts.ensure_installed = LazyVim.dedup(opts.ensure_installed) + local TS = require("nvim-treesitter") + + setmetatable(require("nvim-treesitter.install"), { + __newindex = function(_, k) + if k == "compilers" then + vim.schedule(function() + LazyVim.error({ + "Setting custom compilers for `nvim-treesitter` is no longer supported.", + "", + "For more info, see:", + "- [compilers](https://docs.rs/cc/latest/cc/#compile-time-requirements)", + }) + end) + end + end, + }) + + -- some quick sanity checks + if not TS.get_installed then + return LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + elseif type(opts.ensure_installed) ~= "table" then + return LazyVim.error("`nvim-treesitter` opts.ensure_installed must be a table") end - require("nvim-treesitter.configs").setup(opts) + + -- setup treesitter + TS.setup(opts) + LazyVim.treesitter.get_installed(true) -- initialize the installed langs + + -- install missing parsers + local install = vim.tbl_filter(function(lang) + return not LazyVim.treesitter.have(lang) + end, opts.ensure_installed or {}) + if #install > 0 then + LazyVim.treesitter.build(function() + TS.install(install, { summary = true }):await(function() + LazyVim.treesitter.get_installed(true) -- refresh the installed langs + end) + end) + end + + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("lazyvim_treesitter", { clear = true }), + callback = function(ev) + local ft, lang = ev.match, vim.treesitter.language.get_lang(ev.match) + if not LazyVim.treesitter.have(ft) then + return + end + + ---@param feat string + ---@param query string + local function enabled(feat, query) + local f = opts[feat] or {} ---@type lazyvim.TSFeat + return f.enable ~= false + and not (type(f.disable) == "table" and vim.tbl_contains(f.disable, lang)) + and LazyVim.treesitter.have(ft, query) + end + + -- highlighting + if enabled("highlight", "highlights") then + pcall(vim.treesitter.start, ev.buf) + end + + -- indents + if enabled("indent", "indents") then + LazyVim.set_default("indentexpr", "v:lua.LazyVim.treesitter.indentexpr()") + end + + -- folds + if enabled("folds", "folds") then + if LazyVim.set_default("foldmethod", "expr") then + LazyVim.set_default("foldexpr", "v:lua.LazyVim.treesitter.foldexpr()") + end + end + end, + }) end, } ``` @@ -201,7 +202,19 @@ opts = { ```lua -opts = {} +opts = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + -- LazyVim extention to create buffer-local keymaps + keys = { + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + }, + }, +} ``` @@ -212,35 +225,63 @@ opts = {} ```lua { "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", event = "VeryLazy", - enabled = true, - config = function() - -- If treesitter is already loaded, we need to run config again for textobjects - if LazyVim.is_loaded("nvim-treesitter") then - local opts = LazyVim.opts("nvim-treesitter") - require("nvim-treesitter.configs").setup({ textobjects = opts.textobjects }) + opts = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + -- LazyVim extention to create buffer-local keymaps + keys = { + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + }, + }, + }, + config = function(_, opts) + local TS = require("nvim-treesitter-textobjects") + if not TS.setup then + LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + return end + TS.setup(opts) - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - local configs = require("nvim-treesitter.configs") - for name, fn in pairs(move) do - if name:find("goto") == 1 then - move[name] = function(q, ...) - if vim.wo.diff then - local config = configs.get_module("textobjects.move")[name] ---@type table - for key, query in pairs(config or {}) do - if q == query and key:find("[%]%[][cC]") then - vim.cmd("normal! " .. key) - return - end - end + local function attach(buf) + local ft = vim.bo[buf].filetype + if not (vim.tbl_get(opts, "move", "enable") and LazyVim.treesitter.have(ft, "textobjects")) then + return + end + ---@type table> + local moves = vim.tbl_get(opts, "move", "keys") or {} + + for method, keymaps in pairs(moves) do + for key, query in pairs(keymaps) do + local desc = query:gsub("@", ""):gsub("%..*", "") + desc = desc:sub(1, 1):upper() .. desc:sub(2) + desc = (key:sub(1, 1) == "[" and "Prev " or "Next ") .. desc + desc = desc .. (key:sub(2, 2) == key:sub(2, 2):upper() and " End" or " Start") + if not (vim.wo.diff and key:find("[cC]")) then + vim.keymap.set({ "n", "x", "o" }, key, function() + require("nvim-treesitter-textobjects.move")[method](query, "textobjects") + end, { + buffer = buf, + desc = desc, + silent = true, + }) end - return fn(q, ...) end end end + + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("lazyvim_treesitter_textobjects", { clear = true }), + callback = function(ev) + attach(ev.buf) + end, + }) + vim.tbl_map(attach, vim.api.nvim_list_bufs()) end, } ``` diff --git a/docs/plugins/ui.md b/docs/plugins/ui.md index 803787b250..6eedca753c 100644 --- a/docs/plugins/ui.md +++ b/docs/plugins/ui.md @@ -37,6 +37,9 @@ opts = { highlight = "Directory", text_align = "left", }, + { + filetype = "snacks_layout_box", + }, }, ---@param opts bufferline.IconFetcherOpts get_element_icon = function(opts) @@ -88,6 +91,9 @@ opts = { highlight = "Directory", text_align = "left", }, + { + filetype = "snacks_layout_box", + }, }, ---@param opts bufferline.IconFetcherOpts get_element_icon = function(opts) @@ -115,7 +121,8 @@ opts = { ## [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) - statusline + Displays a fancy status line with git status, + LSP diagnostics, filetype information, and more. @@ -157,29 +164,30 @@ opts = function() { LazyVim.lualine.pretty_path() }, }, lualine_x = { + Snacks.profiler.status(), -- stylua: ignore { function() return require("noice").api.status.command.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, - color = function() return LazyVim.ui.fg("Statement") end, + color = function() return { fg = Snacks.util.color("Statement") } end, }, -- stylua: ignore { function() return require("noice").api.status.mode.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, - color = function() return LazyVim.ui.fg("Constant") end, + color = function() return { fg = Snacks.util.color("Constant") } end, }, -- stylua: ignore { function() return " " .. require("dap").status() end, cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, - color = function() return LazyVim.ui.fg("Debug") end, + color = function() return { fg = Snacks.util.color("Debug") } end, }, -- stylua: ignore { require("lazy.status").updates, cond = require("lazy.status").has_updates, - color = function() return LazyVim.ui.fg("Special") end, + color = function() return { fg = Snacks.util.color("Special") } end, }, { "diff", @@ -210,7 +218,7 @@ opts = function() end, }, }, - extensions = { "neo-tree", "lazy" }, + extensions = { "neo-tree", "lazy", "fzf" }, } -- do not add trouble symbols if aerial is enabled @@ -290,29 +298,30 @@ end { LazyVim.lualine.pretty_path() }, }, lualine_x = { + Snacks.profiler.status(), -- stylua: ignore { function() return require("noice").api.status.command.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, - color = function() return LazyVim.ui.fg("Statement") end, + color = function() return { fg = Snacks.util.color("Statement") } end, }, -- stylua: ignore { function() return require("noice").api.status.mode.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, - color = function() return LazyVim.ui.fg("Constant") end, + color = function() return { fg = Snacks.util.color("Constant") } end, }, -- stylua: ignore { function() return " " .. require("dap").status() end, cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, - color = function() return LazyVim.ui.fg("Debug") end, + color = function() return { fg = Snacks.util.color("Debug") } end, }, -- stylua: ignore { require("lazy.status").updates, cond = require("lazy.status").has_updates, - color = function() return LazyVim.ui.fg("Special") end, + color = function() return { fg = Snacks.util.color("Special") } end, }, { "diff", @@ -343,7 +352,7 @@ end end, }, }, - extensions = { "neo-tree", "lazy" }, + extensions = { "neo-tree", "lazy", "fzf" }, } -- do not add trouble symbols if aerial is enabled @@ -375,109 +384,6 @@ end -## [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) - - indent guides for Neovim - - - - - - -```lua -opts = function() - Snacks.toggle({ - name = "Indention Guides", - get = function() - return require("ibl.config").get_config(0).enabled - end, - set = function(state) - require("ibl").setup_buffer(0, { enabled = state }) - end, - }):map("ug") - - return { - indent = { - char = "│", - tab_char = "│", - }, - scope = { show_start = false, show_end = false }, - exclude = { - filetypes = { - "Trouble", - "alpha", - "dashboard", - "help", - "lazy", - "mason", - "neo-tree", - "notify", - "snacks_dashboard", - "snacks_notif", - "snacks_terminal", - "snacks_win", - "toggleterm", - "trouble", - }, - }, - } -end -``` - - - - - - -```lua -{ - "lukas-reineke/indent-blankline.nvim", - event = "LazyFile", - opts = function() - Snacks.toggle({ - name = "Indention Guides", - get = function() - return require("ibl.config").get_config(0).enabled - end, - set = function(state) - require("ibl").setup_buffer(0, { enabled = state }) - end, - }):map("ug") - - return { - indent = { - char = "│", - tab_char = "│", - }, - scope = { show_start = false, show_end = false }, - exclude = { - filetypes = { - "Trouble", - "alpha", - "dashboard", - "help", - "lazy", - "mason", - "neo-tree", - "notify", - "snacks_dashboard", - "snacks_notif", - "snacks_terminal", - "snacks_win", - "toggleterm", - "trouble", - }, - }, - } - end, - main = "ibl", -} -``` - - - - - ## [noice.nvim](https://github.com/folke/noice.nvim) Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu. @@ -581,7 +487,7 @@ opts = { -## [mini.icons](https://github.com/echasnovski/mini.icons) +## [mini.icons](https://github.com/nvim-mini/mini.icons) icons @@ -609,7 +515,7 @@ opts = { ```lua { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", lazy = true, opts = { file = { @@ -665,10 +571,68 @@ opts = nil +```lua +opts = { + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = false }, -- we set this in options.lua + toggle = { map = LazyVim.safe_keymap_set }, + words = { enabled = true }, +} +``` + + + + + + +```lua +{ + "snacks.nvim", + opts = { + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = false }, -- we set this in options.lua + toggle = { map = LazyVim.safe_keymap_set }, + words = { enabled = true }, + }, + -- stylua: ignore + keys = { + { "n", function() + if Snacks.config.picker and Snacks.config.picker.enabled then + Snacks.picker.notifications() + else + Snacks.notifier.show_history() + end + end, desc = "Notification History" }, + { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, + }, +} +``` + + + + + +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + + + + ```lua opts = { dashboard = { preset = { + pick = function(cmd, opts) + return LazyVim.pick(cmd, opts)() + end, header = [[ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z @@ -702,10 +666,13 @@ opts = { ```lua { - "folke/snacks.nvim", + "snacks.nvim", opts = { dashboard = { preset = { + pick = function(cmd, opts) + return LazyVim.pick(cmd, opts)() + end, header = [[ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z diff --git a/docs/plugins/util.md b/docs/plugins/util.md index 74dff515d4..8e207d5118 100644 --- a/docs/plugins/util.md +++ b/docs/plugins/util.md @@ -5,6 +5,71 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +## [snacks.nvim](https://github.com/folke/snacks.nvim) + + Snacks utils + + + + + + +```lua +opts = { + bigfile = { enabled = true }, + quickfile = { enabled = true }, + terminal = { + win = { + keys = { + nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, + nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, + nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, + nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + hide_slash = { "", "hide", desc = "Hide Terminal", mode = { "t", "n" } }, + hide_underscore = { "", "hide", desc = "which_key_ignore", mode = { "t", "n" } }, + }, + }, + }, +} +``` + + + + + + +```lua +{ + "snacks.nvim", + opts = { + bigfile = { enabled = true }, + quickfile = { enabled = true }, + terminal = { + win = { + keys = { + nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, + nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, + nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, + nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + hide_slash = { "", "hide", desc = "Hide Terminal", mode = { "t", "n" } }, + hide_underscore = { "", "hide", desc = "which_key_ignore", mode = { "t", "n" } }, + }, + }, + }, + }, + -- stylua: ignore + keys = { + { ".", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" }, + { "S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" }, + { "dps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Buffer" }, + }, +} +``` + + + + + ## [persistence.nvim](https://github.com/folke/persistence.nvim) Session management. This saves your session in the background, diff --git a/lua/build.lua b/lua/build.lua index 4add8b4234..e64552661d 100644 --- a/lua/build.lua +++ b/lua/build.lua @@ -71,15 +71,17 @@ function M.keymaps() group = "General" dofile(rootLazyVim .. "/lua/lazyvim/config/keymaps.lua") group = "LSP" - local lsp = dofile(rootLazyVim .. "/lua/lazyvim/plugins/lsp/keymaps.lua") - for _, keys in ipairs(lsp.get()) do - map(keys.mode or "n", keys[1], keys[2], keys) + local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" }, { optional = true }) + + local Plugin = require("lazy.core.plugin") + local lsp_opts = Plugin.values(core.plugins["nvim-lspconfig"], "opts", false) + for _, km in ipairs(lsp_opts.servers["*"].keys or {}) do + map(km.mode or "n", km[1], km[2], km) end vim.keymap.set = keymap_set group = "Plugins" - local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" }, { optional = true }) Util.foreach(core.plugins, function(name, plugin) Handler.resolve(plugin) group = ("[%s](%s)"):format(plugin.name, plugin.url) @@ -308,28 +310,13 @@ You can enable the extra with the `:LazyExtras` command. Plugins marked as optional will only be configured if they are installed. ::: -
-Alternatively, you can add it to your lazy.nvim imports - -```lua title="lua/config/lazy.lua" {4} -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "%s" }, - { import = "plugins" }, - }, -}) -``` - -
- %sBelow you can find a list of included plugins and their default settings. :::caution You don't need to copy the default settings to your config. They are only shown here for reference. ::: -]]):format(modname, options or ""), +]]):format(options or ""), M.plugins("extras/" .. path:gsub(".*/extras/", "")).content, "", }) diff --git a/scripts/build_docs.lua b/scripts/build_docs.lua index 8a39d8232c..e057bce41b 100644 --- a/scripts/build_docs.lua +++ b/scripts/build_docs.lua @@ -20,7 +20,7 @@ local plugins = { { "LazyVim/LazyVim", import = "lazyvim.plugins", dev = true, version = false }, { "LazyVim/LazyVim", dev = true, version = false }, { "folke/lazy.nvim", version = false }, - { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, + { "nvim-treesitter/nvim-treesitter", branch = "main", opts = { ensure_installed = {} } }, } local function main() @@ -41,7 +41,7 @@ local function main() -- require("lazy.core.cache").reset() vim.opt.rtp:append(".") - vim.cmd([[TSUpdateSync lua]]) + require("nvim-treesitter").update({ "lua" }):wait(300000) -- max. 5 minutes print("Building docs")