diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 9f92a4d3..8560146d 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.32.0" + ".": "12.36.0" } diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a0c704be..4e0273bc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,6 +5,7 @@ on: - cron: "30 1 * * *" jobs: - ci: + stale: + if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner) uses: folke/github/.github/workflows/stale.yml@main secrets: inherit diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 2177a50b..6784ef9c 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -7,6 +7,7 @@ on: - cron: "0 * * * *" jobs: - ci: + update: + if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner) uses: folke/github/.github/workflows/update.yml@main secrets: inherit diff --git a/CHANGELOG.md b/CHANGELOG.md index b148a091..33cbefe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,59 @@ # Changelog +## [12.36.0](https://github.com/LazyVim/LazyVim/compare/v12.35.1...v12.36.0) (2024-07-22) + + +### Features + +* **grug-far:** no longer needed to call visual replace separately ([72d0cad](https://github.com/LazyVim/LazyVim/commit/72d0cad3530d877401ad9674f5266c79fbec396b)) + +## [12.35.1](https://github.com/LazyVim/LazyVim/compare/v12.35.0...v12.35.1) (2024-07-21) + + +### Bug Fixes + +* **grug-far:** only prefill files filter when file has an extension. Closes [#4130](https://github.com/LazyVim/LazyVim/issues/4130) ([6411ab0](https://github.com/LazyVim/LazyVim/commit/6411ab0897f19dad9f902dfee29e101a9a767357)) + +## [12.35.0](https://github.com/LazyVim/LazyVim/compare/v12.34.0...v12.35.0) (2024-07-21) + + +### Features + +* **python:** default to new ruff instead of ruff_lsp ([#4126](https://github.com/LazyVim/LazyVim/issues/4126)) ([61ce1cf](https://github.com/LazyVim/LazyVim/commit/61ce1cfaaf8365e3b5c12b1509064579ab7d80b5)) + +## [12.34.0](https://github.com/LazyVim/LazyVim/compare/v12.33.0...v12.34.0) (2024-07-20) + + +### Features + +* **editor:** replace nvim-spectre with grug-far.nvim ([#4099](https://github.com/LazyVim/LazyVim/issues/4099)) ([0d561a3](https://github.com/LazyVim/LazyVim/commit/0d561a3226b46f6a44c4f2c9be2288f3b52cc351)) +* **indent-blankline:** add which-key toggles ([#4122](https://github.com/LazyVim/LazyVim/issues/4122)) ([a997152](https://github.com/LazyVim/LazyVim/commit/a997152eb2307380888d640440e0732493f82727)) + + +### Bug Fixes + +* **conform:** changes for new conform.nvim config ([eed91a3](https://github.com/LazyVim/LazyVim/commit/eed91a3e4c1521dd839d1a8bc09bdd98ac2fb874)) +* **toggle:** safe toggle get ([c8ab5d7](https://github.com/LazyVim/LazyVim/commit/c8ab5d7554da9f1eff69f5d6d8a0df38309d9f81)) + + +### Performance Improvements + +* **core:** defer clipboard because xsel and pbcopy can be slow ([#4120](https://github.com/LazyVim/LazyVim/issues/4120)) ([578f06e](https://github.com/LazyVim/LazyVim/commit/578f06e1401defbbc0a82f9ff1fb505564d038cf)) + +## [12.33.0](https://github.com/LazyVim/LazyVim/compare/v12.32.0...v12.33.0) (2024-07-19) + + +### Features + +* **extras:** improve ruby extra by letting user chose ([#3652](https://github.com/LazyVim/LazyVim/issues/3652)) ([7839498](https://github.com/LazyVim/LazyVim/commit/783949810855556dd12ed2685e62fb37a4c9504d)) +* **lang:** add Lean 4 support ([#4080](https://github.com/LazyVim/LazyVim/issues/4080)) ([3e29fdf](https://github.com/LazyVim/LazyVim/commit/3e29fdf478383034c48477dd04fd433a7c9327ee)) +* **lang:** add OCaml ([#4079](https://github.com/LazyVim/LazyVim/issues/4079)) ([a219e10](https://github.com/LazyVim/LazyVim/commit/a219e105b0e86316edfedb57f1fa267a764eab13)) + + +### Bug Fixes + +* **ui:** trouble lualine component ([f9fdb35](https://github.com/LazyVim/LazyVim/commit/f9fdb356f2362e5ae4ef490944b1957b49dc6680)) + ## [12.32.0](https://github.com/LazyVim/LazyVim/compare/v12.31.0...v12.32.0) (2024-07-18) diff --git a/NEWS.md b/NEWS.md index 3abd43b7..1abf2ec8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ ## 12.x +- [nvim-spectre](https://github.com/nvim-pack/nvim-spectre) has been removed in favor of [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim). + **grug-far.nvim** has a great UI and feels more intuitive to use. + - This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news) - **prettier** extra now works for all prettier supported filetypes diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index fcd74ffc..a0b980b7 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 July 18 +*LazyVim.txt* For Neovim Last change: 2024 July 22 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 1440d069..edb392db 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -55,6 +55,7 @@ vim.api.nvim_create_autocmd("FileType", { group = augroup("close_with_q"), pattern = { "PlenaryTestPopup", + "grug-far", "help", "lspinfo", "notify", diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index a95f519f..e8d943f3 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "12.32.0" -- x-release-please-version +M.version = "12.36.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions @@ -161,6 +161,7 @@ end ---@type LazyVimOptions local options +local lazy_clipboard ---@param opts? LazyVimOptions function M.setup(opts) @@ -181,6 +182,9 @@ function M.setup(opts) M.load("autocmds") end M.load("keymaps") + if lazy_clipboard ~= nil then + vim.opt.clipboard = lazy_clipboard + end LazyVim.format.setup() LazyVim.news.setup() @@ -285,6 +289,9 @@ function M.init() -- this is needed to make sure options will be correctly applied -- after installing missing plugins M.load("options") + -- defer built-in clipboard handling: "xsel" and "pbcopy" can be slow + lazy_clipboard = vim.opt.clipboard + vim.opt.clipboard = "" if vim.g.deprecation_warnings == false then vim.deprecate = function() end diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 39108009..28808394 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -128,13 +128,24 @@ return { -- search/replace in multiple files { - "nvim-pack/nvim-spectre", - build = false, - cmd = "Spectre", - opts = { open_cmd = "noswapfile vnew" }, - -- stylua: ignore + "MagicDuck/grug-far.nvim", + opts = { headerMaxWidth = 80 }, + cmd = "GrugFar", keys = { - { "sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" }, + { + "sr", + function() + local grug = require("grug-far") + local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") + grug.grug_far({ + prefills = { + filesFilter = ext and ext ~= "" and "*." .. ext or nil, + }, + }) + end, + mode = { "n", "v" }, + desc = "Search and Replace", + }, }, }, @@ -169,13 +180,6 @@ return { { mode = { "n", "v" }, { "", group = "tabs" }, - { - "b", - group = "buffer", - expand = function() - return require("which-key.extras").expand.buf() - end, - }, { "c", group = "code" }, { "f", group = "file/find" }, { "g", group = "git" }, @@ -183,6 +187,19 @@ return { { "q", group = "quit/session" }, { "s", group = "search" }, { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, + { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, + { "[", group = "prev" }, + { "]", group = "next" }, + { "g", group = "goto" }, + { "gs", group = "surround" }, + { "z", group = "fold" }, + { + "b", + group = "buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, { "w", group = "windows", @@ -191,12 +208,8 @@ return { return require("which-key.extras").expand.win() end, }, - { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, - { "[", group = "prev" }, - { "]", group = "next" }, - { "g", group = "goto" }, - { "gs", group = "surround" }, - { "z", group = "fold" }, + -- better descriptions + { "gx", desc = "Open with system app" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/lean.lua b/lua/lazyvim/plugins/extras/lang/lean.lua new file mode 100644 index 00000000..9ac37f7d --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/lean.lua @@ -0,0 +1,125 @@ +return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "lean" }, + root = { "lean-toolchain" }, + }) + end, + "Julian/lean.nvim", + event = { "BufReadPre *.lean", "BufNewFile *.lean" }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + + -- see details below for full configuration options + opts = { + -- Enable the Lean language server(s)? + -- + -- false to disable, otherwise should be a table of options to pass to `leanls` + -- + -- See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls for details. + -- In particular ensure you have followed instructions setting up a callback + -- for `LspAttach` which sets your key bindings! + lsp = { + init_options = { + -- See Lean.Lsp.InitializationOptions for details and further options. + + -- Time (in milliseconds) which must pass since latest edit until elaboration begins. + -- Lower values may make editing feel faster at the cost of higher CPU usage. + -- Note that lean.nvim changes the Lean default for this value! + editDelay = 0, + + -- Whether to signal that widgets are supported. + hasWidgets = true, + }, + }, + + ft = { + -- A list of patterns which will be used to protect any matching + -- Lean file paths from being accidentally modified (by marking the + -- buffer as `nomodifiable`). + nomodifiable = { + -- by default, this list includes the Lean standard libraries, + -- as well as files within dependency directories (e.g. `_target`) + -- Set this to an empty table to disable. + }, + }, + + -- Abbreviation support + abbreviations = { + -- Enable expanding of unicode abbreviations? + enable = true, + -- additional abbreviations: + extra = { + -- Add a \wknight abbreviation to insert ♘ + -- + -- Note that the backslash is implied, and that you of + -- course may also use a snippet engine directly to do + -- this if so desired. + wknight = "♘", + }, + -- Change if you don't like the backslash + -- (comma is a popular choice on French keyboards) + leader = "\\", + }, + + -- Enable suggested mappings? + -- + -- false by default, true to enable + mappings = true, + + -- Infoview support + infoview = { + -- Automatically open an infoview on entering a Lean buffer? + -- Should be a function that will be called anytime a new Lean file + -- is opened. Return true to open an infoview, otherwise false. + -- Setting this to `true` is the same as `function() return true end`, + -- i.e. autoopen for any Lean file, or setting it to `false` is the + -- same as `function() return false end`, i.e. never autoopen. + autoopen = true, + + -- Set infoview windows' starting dimensions. + -- Windows are opened horizontally or vertically depending on spacing. + width = 50, + height = 20, + + -- Put the infoview on the top or bottom when horizontal? + -- top | bottom + horizontal_position = "bottom", + + -- Always open the infoview window in a separate tabpage. + -- Might be useful if you are using a screen reader and don't want too + -- many dynamic updates in the terminal at the same time. + -- Note that `height` and `width` will be ignored in this case. + separate_tab = false, + + -- Show indicators for pin locations when entering an infoview window? + -- always | never | auto (= only when there are multiple pins) + indicators = "auto", + }, + + -- Progress bar support + progress_bars = { + -- Enable the progress bars? + enable = true, + -- What character should be used for the bars? + character = "│", + -- Use a different priority for the signs + priority = 10, + }, + + -- Redirect Lean's stderr messages somehwere (to a buffer by default) + stderr = { + enable = true, + -- height of the window + height = 5, + -- a callback which will be called with (multi-line) stderr output + -- e.g., use: + -- on_lines = function(lines) vim.notify(lines) end + -- if you want to redirect stderr to `vim.notify`. + -- The default implementation will redirect to a dedicated stderr + -- window. + on_lines = nil, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/ocaml.lua b/lua/lazyvim/plugins/extras/lang/ocaml.lua new file mode 100644 index 00000000..d4485856 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/ocaml.lua @@ -0,0 +1,39 @@ +return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "ml", "mli", "cmi", "cmo", "cmx", "cma", "cmxa", "cmxs", "cmt", "cmti", "opam" }, + root = { "merlin.opam", "dune-project" }, + }) + end, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "ocaml" }) + end + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + ocamllsp = { + get_language_id = function(_, ftype) + return language_id_of[ftype] + end, + root_dir = function(fname) + return require("lspconfig.util").root_pattern( + "*.opam", + "esy.json", + "package.json", + ".git", + "dune-project", + "dune-workspace", + "*.ml" + )(fname) + end, + }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 399f28e3..a06b63d7 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -2,11 +2,12 @@ if lazyvim_docs then -- LSP Server to use for Python. -- Set to "basedpyright" to use basedpyright instead of pyright. vim.g.lazyvim_python_lsp = "pyright" - vim.g.lazyvim_python_ruff = "ruff_lsp" + -- Set to "ruff_lsp" to use the old LSP implementation version. + vim.g.lazyvim_python_ruff = "ruff" end local lsp = vim.g.lazyvim_python_lsp or "pyright" -local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp" +local ruff = vim.g.lazyvim_python_ruff or "ruff" return { recommended = function() @@ -30,22 +31,22 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - pyright = { - enabled = lsp == "pyright", - }, - basedpyright = { - enabled = lsp == "basedpyright", - }, - [lsp] = { - enabled = true, + ruff = { + cmd_env = { RUFF_TRACE = "messages" }, + init_options = { + settings = { + logLevel = "error", + }, + }, + keys = { + { + "co", + LazyVim.lsp.action["source.organizeImports"], + desc = "Organize Imports", + }, + }, }, ruff_lsp = { - enabled = ruff == "ruff_lsp", - }, - ruff = { - enabled = ruff == "ruff", - }, - [ruff] = { keys = { { "co", @@ -65,6 +66,16 @@ return { }, }, }, + { + "neovim/nvim-lspconfig", + opts = function(_, opts) + local servers = { "pyright", "basedpyright", "ruff", "ruff_lsp", ruff, lsp } + for _, server in ipairs(servers) do + opts.servers[server] = opts.servers[server] or {} + opts.servers[server].enabled = server == lsp or server == ruff + end + end, + }, { "nvim-neotest/neotest", optional = true, diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index c70e645d..6eb4fce5 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -1,3 +1,17 @@ +if lazyvim_docs then + -- LSP Server to use for Ruby. + -- Set to "solargraph" to use solargraph instead of ruby_lsp. + vim.g.lazyvim_ruby_lsp = "ruby_lsp" + vim.g.lazyvim_ruby_formatter = "rubocop" +end + +local lsp = vim.g.lazyvim_ruby_lsp or "ruby_lsp" +if vim.fn.has("nvim-0.10") == 0 then + -- ruby_lsp does not work well with Neovim < 0.10 + lsp = vim.g.lazyvim_ruby_lsp or "solargraph" +end +local formatter = vim.g.lazyvim_ruby_formatter or "rubocop" + return { recommended = function() return LazyVim.extras.wants({ @@ -11,12 +25,29 @@ return { }, { "neovim/nvim-lspconfig", + ---@class PluginLspOpts opts = { + ---@type lspconfig.options servers = { - solargraph = {}, + ruby_lsp = { + enabled = lsp == "ruby_lsp", + }, + solargraph = { + enabled = lsp == "solargraph", + }, + rubocop = { + enabled = formatter == "rubocop", + }, + standardrb = { + enabled = formatter == "standardrb", + }, }, }, }, + { + "williamboman/mason.nvim", + opts = { ensure_installed = { "erb-formatter", "erb-lint" } }, + }, { "mfussenegger/nvim-dap", optional = true, @@ -27,6 +58,16 @@ return { end, }, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ruby = { formatter }, + eruby = { "erb-format" }, + }, + }, + }, { "nvim-neotest/neotest", optional = true, diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index 571bee26..1136230a 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -14,6 +14,13 @@ return { end, { expr = true }) end + vim.api.nvim_create_autocmd("FileType", { + pattern = "grug-far", + callback = function() + vim.b.minianimate_disable = true + end, + }) + LazyVim.toggle.map("ua", { name = "Mini Animate", get = function() diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index f4160b4d..ae32c0ef 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -1,6 +1,6 @@ local M = {} ----@param opts ConformOpts +---@param opts conform.setupOpts function M.setup(_, opts) for _, key in ipairs({ "format_on_save", "format_after_save" }) do if opts[key] then @@ -10,6 +10,10 @@ function M.setup(_, opts) opts[key] = nil end end + ---@diagnostic disable-next-line: undefined-field + if opts.format then + LazyVim.warn("**conform.nvim** `opts.format` is deprecated. Please use `opts.default_format_opts` instead.") + end require("conform").setup(opts) end @@ -37,8 +41,7 @@ return { priority = 100, primary = true, format = function(buf) - local opts = LazyVim.opts("conform.nvim") - require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf })) + require("conform").format({ bufnr = buf }) end, sources = function(buf) local ret = require("conform").list_formatters(buf) @@ -59,16 +62,14 @@ return { "Please refer to the docs at https://www.lazyvim.org/plugins/formatting", }, { title = "LazyVim" }) end - ---@class ConformOpts + ---@type conform.setupOpts local opts = { - -- LazyVim will use these options when formatting with the conform.nvim formatter - format = { + default_format_opts = { timeout_ms = 3000, async = false, -- not recommended to change quiet = false, -- not recommended to change lsp_format = "fallback", -- not recommended to change }, - ---@type table formatters_by_ft = { lua = { "stylua" }, fish = { "fish_indent" }, diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 0747547f..076344dd 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -196,6 +196,9 @@ return { 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.setup[server] then if opts.setup[server](server, server_opts) then diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index ed17182d..14807497 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -225,28 +225,40 @@ return { { "lukas-reineke/indent-blankline.nvim", event = "LazyFile", - opts = { - indent = { - char = "│", - tab_char = "│", - }, - scope = { show_start = false, show_end = false }, - exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", + opts = function() + LazyVim.toggle.map("ug", { + 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, + }) + + return { + indent = { + char = "│", + tab_char = "│", }, - }, - }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + } + end, main = "ibl", }, diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index c8027666..4e0ba494 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -39,14 +39,21 @@ function M.wk(lhs, toggle) if not LazyVim.has("which-key.nvim") then return end + local function safe_get() + local ok, enabled = pcall(toggle.get) + if not ok then + LazyVim.error({ "Failed to get toggle state for **" .. toggle.name .. "**:\n", enabled }, { once = true }) + end + return enabled + end require("which-key").add({ { lhs, icon = function() - return toggle.get() and { icon = " ", color = "green" } or { icon = " ", color = "yellow" } + return safe_get() and { icon = " ", color = "green" } or { icon = " ", color = "yellow" } end, desc = function() - return (toggle.get() and "Disable " or "Enable ") .. toggle.name + return (safe_get() and "Disable " or "Enable ") .. toggle.name end, }, })