Merge branch 'main' into feat-cmp-opts-extend

This commit is contained in:
Johnson Hu 2024-07-24 23:21:28 +08:00 committed by GitHub
commit 7874802fef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 517 additions and 113 deletions

View file

@ -1,3 +1,3 @@
{ {
".": "12.32.0" ".": "12.38.0"
} }

View file

@ -5,6 +5,7 @@ on:
- cron: "30 1 * * *" - cron: "30 1 * * *"
jobs: jobs:
ci: stale:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
uses: folke/github/.github/workflows/stale.yml@main uses: folke/github/.github/workflows/stale.yml@main
secrets: inherit secrets: inherit

View file

@ -7,6 +7,7 @@ on:
- cron: "0 * * * *" - cron: "0 * * * *"
jobs: jobs:
ci: update:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
uses: folke/github/.github/workflows/update.yml@main uses: folke/github/.github/workflows/update.yml@main
secrets: inherit secrets: inherit

View file

@ -1,5 +1,85 @@
# Changelog # Changelog
## [12.38.0](https://github.com/LazyVim/LazyVim/compare/v12.37.0...v12.38.0) (2024-07-24)
### Features
* **markdown:** markdown-render toggle ([c8d0faf](https://github.com/LazyVim/LazyVim/commit/c8d0faf9b152283b2ae74f9594287a834eae002a))
* **markdown:** replace `headlines.nvim` by `markdown.nvim` ([#4139](https://github.com/LazyVim/LazyVim/issues/4139)) ([264abdf](https://github.com/LazyVim/LazyVim/commit/264abdf9d52fe44c1dcb66f0502dcba5a881ea43))
## [12.37.0](https://github.com/LazyVim/LazyVim/compare/v12.36.0...v12.37.0) (2024-07-24)
### Features
* **catppuccin:** enable grug-far integration ([#4156](https://github.com/LazyVim/LazyVim/issues/4156)) ([4bf6d85](https://github.com/LazyVim/LazyVim/commit/4bf6d856a805d38c19c8485c7a062d6cbc5cfaa8))
* **elixir:** add elixirls code actions ([#4148](https://github.com/LazyVim/LazyVim/issues/4148)) ([f94a059](https://github.com/LazyVim/LazyVim/commit/f94a0591b3e5838794b1c3897ec21491aeb080fe))
### Bug Fixes
* **dap:** don't mess up DAP adapters provided by nvim-dap-python ([#4141](https://github.com/LazyVim/LazyVim/issues/4141)) ([940d7df](https://github.com/LazyVim/LazyVim/commit/940d7df59aac01f6cc587f035d9b4913139fae60))
* **dap:** extend dap.configurations from .vscode/launch.json ([#4106](https://github.com/LazyVim/LazyVim/issues/4106)) ([caf227d](https://github.com/LazyVim/LazyVim/commit/caf227dd08e83c826800cb88c34c87c600793fa3))
* **grug-far:** use new transient option ([1c2be20](https://github.com/LazyVim/LazyVim/commit/1c2be200c185a4567c6a634da2b624d9a638fe73))
* **keymaps:** leader-wd ([f0d8b8b](https://github.com/LazyVim/LazyVim/commit/f0d8b8b293c1fc798b576a74a87f9bd0b59714f3))
* **keymaps:** leader-wm ([391f506](https://github.com/LazyVim/LazyVim/commit/391f506295607e12db545b85fcbe0e00b1b8efa9))
* **news:** deprecated API ([f6cd4a3](https://github.com/LazyVim/LazyVim/commit/f6cd4a38c667e3ef56672d723705ecd8a774a0f4))
## [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) ## [12.32.0](https://github.com/LazyVim/LazyVim/compare/v12.31.0...v12.32.0) (2024-07-18)

View file

@ -2,6 +2,12 @@
## 12.x ## 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)
to spice up your markdown files.
- [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) - 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 - **prettier** extra now works for all prettier supported filetypes

View file

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim Last change: 2024 July 18 *LazyVim.txt* For Neovim Last change: 2024 July 24
============================================================================== ==============================================================================
Table of Contents *LazyVim-table-of-contents* Table of Contents *LazyVim-table-of-contents*

View file

@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions ---@class LazyVimConfig: LazyVimOptions
local M = {} local M = {}
M.version = "12.32.0" -- x-release-please-version M.version = "12.38.0" -- x-release-please-version
LazyVim.config = M LazyVim.config = M
---@class LazyVimOptions ---@class LazyVimOptions
@ -161,6 +161,7 @@ end
---@type LazyVimOptions ---@type LazyVimOptions
local options local options
local lazy_clipboard
---@param opts? LazyVimOptions ---@param opts? LazyVimOptions
function M.setup(opts) function M.setup(opts)
@ -181,6 +182,9 @@ function M.setup(opts)
M.load("autocmds") M.load("autocmds")
end end
M.load("keymaps") M.load("keymaps")
if lazy_clipboard ~= nil then
vim.opt.clipboard = lazy_clipboard
end
LazyVim.format.setup() LazyVim.format.setup()
LazyVim.news.setup() LazyVim.news.setup()
@ -285,6 +289,9 @@ function M.init()
-- this is needed to make sure options will be correctly applied -- this is needed to make sure options will be correctly applied
-- after installing missing plugins -- after installing missing plugins
M.load("options") 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 if vim.g.deprecation_warnings == false then
vim.deprecate = function() end vim.deprecate = function() end

View file

@ -177,8 +177,8 @@ map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
map("n", "<leader>w", "<c-w>", { desc = "Windows", remap = true }) map("n", "<leader>w", "<c-w>", { desc = "Windows", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true }) map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "Split Window Right", remap = true }) map("n", "<leader>|", "<C-W>v", { desc = "Split Window Right", remap = true })
map("n", "<c-w>d", "<C-W>c", { desc = "Delete Window", remap = true }) map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
LazyVim.toggle.map("<c-w>m", LazyVim.toggle.maximize) LazyVim.toggle.map("<leader>wm", LazyVim.toggle.maximize)
-- tabs -- tabs
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" }) map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })

View file

@ -47,6 +47,7 @@ vim.g.deprecation_warnings = false
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
-- Show the current document symbols location from Trouble in lualine -- Show the current document symbols location from Trouble in lualine
-- You can disable this for a buffer by setting `vim.b.trouble_lualine = false`
vim.g.trouble_lualine = true vim.g.trouble_lualine = true
local opt = vim.opt local opt = vim.opt

View file

@ -19,6 +19,7 @@ return {
cmp = true, cmp = true,
dashboard = true, dashboard = true,
flash = true, flash = true,
grug_far = true,
gitsigns = true, gitsigns = true,
headlines = true, headlines = true,
illuminate = true, illuminate = true,

View file

@ -128,13 +128,25 @@ return {
-- search/replace in multiple files -- search/replace in multiple files
{ {
"nvim-pack/nvim-spectre", "MagicDuck/grug-far.nvim",
build = false, opts = { headerMaxWidth = 80 },
cmd = "Spectre", cmd = "GrugFar",
opts = { open_cmd = "noswapfile vnew" },
-- stylua: ignore
keys = { keys = {
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" }, {
"<leader>sr",
function()
local grug = require("grug-far")
local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
grug.grug_far({
transient = true,
prefills = {
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
},
})
end,
mode = { "n", "v" },
desc = "Search and Replace",
},
}, },
}, },
@ -169,13 +181,6 @@ return {
{ {
mode = { "n", "v" }, mode = { "n", "v" },
{ "<leader><tab>", group = "tabs" }, { "<leader><tab>", group = "tabs" },
{
"<leader>b",
group = "buffer",
expand = function()
return require("which-key.extras").expand.buf()
end,
},
{ "<leader>c", group = "code" }, { "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" }, { "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" }, { "<leader>g", group = "git" },
@ -183,6 +188,19 @@ return {
{ "<leader>q", group = "quit/session" }, { "<leader>q", group = "quit/session" },
{ "<leader>s", group = "search" }, { "<leader>s", group = "search" },
{ "<leader>u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, { "<leader>u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } },
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
{ "gs", group = "surround" },
{ "z", group = "fold" },
{
"<leader>b",
group = "buffer",
expand = function()
return require("which-key.extras").expand.buf()
end,
},
{ {
"<leader>w", "<leader>w",
group = "windows", group = "windows",
@ -191,12 +209,8 @@ return {
return require("which-key.extras").expand.win() return require("which-key.extras").expand.win()
end, end,
}, },
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, -- better descriptions
{ "[", group = "prev" }, { "gx", desc = "Open with system app" },
{ "]", group = "next" },
{ "g", group = "goto" },
{ "gs", group = "surround" },
{ "z", group = "fold" },
}, },
}, },
}, },

View file

@ -69,6 +69,11 @@ return {
vscode.json_decode = function(str) vscode.json_decode = function(str)
return vim.json.decode(json.json_strip_comments(str)) return vim.json.decode(json.json_strip_comments(str))
end end
-- Extends dap.configurations with entries read from .vscode/launch.json
if vim.fn.filereadable(".vscode/launch.json") then
vscode.load_launchjs()
end
end, end,
}, },

View file

@ -9,7 +9,32 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
elixirls = {}, elixirls = {
keys = {
{
"<leader>cp",
function()
local params = vim.lsp.util.make_position_params()
LazyVim.lsp.execute({
command = "manipulatePipes:serverid",
arguments = { "toPipe", params.textDocument.uri, params.position.line, params.position.character },
})
end,
desc = "To Pipe",
},
{
"<leader>cP",
function()
local params = vim.lsp.util.make_position_params()
LazyVim.lsp.execute({
command = "manipulatePipes:serverid",
arguments = { "fromPipe", params.textDocument.uri, params.position.line, params.position.character },
})
end,
desc = "From Pipe",
},
},
},
}, },
}, },
}, },

View file

@ -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,
},
},
}

View file

@ -92,31 +92,36 @@ return {
}, },
{ {
"lukas-reineke/headlines.nvim", "MeanderingProgrammer/markdown.nvim",
opts = function() opts = {
local opts = {} file_types = { "markdown", "norg", "rmd", "org" },
for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do code = {
opts[ft] = { sign = false,
headline_highlights = {}, width = "block",
-- disable bullets for now. See https://github.com/lukas-reineke/headlines.nvim/issues/66 right_pad = 1,
bullets = {}, },
quote_string = false, heading = {
} sign = false,
for i = 1, 6 do icons = {},
local hl = "Headline" .. i },
vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true }) },
table.insert(opts[ft].headline_highlights, hl)
end
end
return opts
end,
ft = { "markdown", "norg", "rmd", "org" }, ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts) config = function(_, opts)
-- PERF: schedule to prevent headlines slowing down opening a file require("render-markdown").setup(opts)
vim.schedule(function() LazyVim.toggle.map("<leader>um", {
require("headlines").setup(opts) name = "Render Markdown",
require("headlines").refresh() get = function()
end) 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,
})
end, end,
}, },
} }

View file

@ -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,
},
},
},
},
}

View file

@ -2,11 +2,12 @@ if lazyvim_docs then
-- LSP Server to use for Python. -- LSP Server to use for Python.
-- Set to "basedpyright" to use basedpyright instead of pyright. -- Set to "basedpyright" to use basedpyright instead of pyright.
vim.g.lazyvim_python_lsp = "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 end
local lsp = vim.g.lazyvim_python_lsp or "pyright" 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 { return {
recommended = function() recommended = function()
@ -30,22 +31,22 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
pyright = { ruff = {
enabled = lsp == "pyright", cmd_env = { RUFF_TRACE = "messages" },
}, init_options = {
basedpyright = { settings = {
enabled = lsp == "basedpyright", logLevel = "error",
}, },
[lsp] = { },
enabled = true, keys = {
{
"<leader>co",
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
}, },
ruff_lsp = { ruff_lsp = {
enabled = ruff == "ruff_lsp",
},
ruff = {
enabled = ruff == "ruff",
},
[ruff] = {
keys = { keys = {
{ {
"<leader>co", "<leader>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", "nvim-neotest/neotest",
optional = true, optional = true,
@ -127,4 +138,15 @@ return {
table.insert(opts.auto_brackets, "python") table.insert(opts.auto_brackets, "python")
end, end,
}, },
-- Don't mess up DAP adapters provided by nvim-dap-python
{
"jay-babu/mason-nvim-dap.nvim",
optional = true,
opts = {
handlers = {
python = function() end,
},
},
},
} }

View file

@ -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 { return {
recommended = function() recommended = function()
return LazyVim.extras.wants({ return LazyVim.extras.wants({
@ -11,12 +25,29 @@ return {
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = { opts = {
---@type lspconfig.options
servers = { 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", "mfussenegger/nvim-dap",
optional = true, optional = true,
@ -27,6 +58,16 @@ return {
end, end,
}, },
}, },
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
ruby = { formatter },
eruby = { "erb-format" },
},
},
},
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",
optional = true, optional = true,

View file

@ -14,6 +14,13 @@ return {
end, { expr = true }) end, { expr = true })
end end
vim.api.nvim_create_autocmd("FileType", {
pattern = "grug-far",
callback = function()
vim.b.minianimate_disable = true
end,
})
LazyVim.toggle.map("<leader>ua", { LazyVim.toggle.map("<leader>ua", {
name = "Mini Animate", name = "Mini Animate",
get = function() get = function()

View file

@ -1,6 +1,6 @@
local M = {} local M = {}
---@param opts ConformOpts ---@param opts conform.setupOpts
function M.setup(_, opts) function M.setup(_, opts)
for _, key in ipairs({ "format_on_save", "format_after_save" }) do for _, key in ipairs({ "format_on_save", "format_after_save" }) do
if opts[key] then if opts[key] then
@ -10,6 +10,10 @@ function M.setup(_, opts)
opts[key] = nil opts[key] = nil
end end
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) require("conform").setup(opts)
end end
@ -37,8 +41,7 @@ return {
priority = 100, priority = 100,
primary = true, primary = true,
format = function(buf) format = function(buf)
local opts = LazyVim.opts("conform.nvim") require("conform").format({ bufnr = buf })
require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf }))
end, end,
sources = function(buf) sources = function(buf)
local ret = require("conform").list_formatters(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", "Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
}, { title = "LazyVim" }) }, { title = "LazyVim" })
end end
---@class ConformOpts ---@type conform.setupOpts
local opts = { local opts = {
-- LazyVim will use these options when formatting with the conform.nvim formatter default_format_opts = {
format = {
timeout_ms = 3000, timeout_ms = 3000,
async = false, -- not recommended to change async = false, -- not recommended to change
quiet = false, -- not recommended to change quiet = false, -- not recommended to change
lsp_format = "fallback", -- not recommended to change lsp_format = "fallback", -- not recommended to change
}, },
---@type table<string, conform.FormatterUnit[]>
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
fish = { "fish_indent" }, fish = { "fish_indent" },

View file

@ -196,6 +196,9 @@ return {
local server_opts = vim.tbl_deep_extend("force", { local server_opts = vim.tbl_deep_extend("force", {
capabilities = vim.deepcopy(capabilities), capabilities = vim.deepcopy(capabilities),
}, servers[server] or {}) }, servers[server] or {})
if server_opts.enabled == false then
return
end
if opts.setup[server] then if opts.setup[server] then
if opts.setup[server](server, server_opts) then if opts.setup[server](server, server_opts) then

View file

@ -199,24 +199,21 @@ return {
-- do not add trouble symbols if aerial is enabled -- do not add trouble symbols if aerial is enabled
-- And allow it to be overriden for some buffer types (see autocmds) -- And allow it to be overriden for some buffer types (see autocmds)
if if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
vim.g.trouble_lualine_enabled ~= false
and vim.b.trouble_lualine_enabled ~= false
and LazyVim.has("trouble.nvim")
then
local trouble = require("trouble") local trouble = require("trouble")
local symbols = trouble.statusline local symbols = trouble.statusline({
and trouble.statusline({ mode = "symbols",
mode = "symbols", groups = {},
groups = {}, title = false,
title = false, filter = { range = true },
filter = { range = true }, format = "{kind_icon}{symbol.name:Normal}",
format = "{kind_icon}{symbol.name:Normal}", hl_group = "lualine_c_normal",
hl_group = "lualine_c_normal", })
})
table.insert(opts.sections.lualine_c, { table.insert(opts.sections.lualine_c, {
symbols and symbols.get, symbols and symbols.get,
cond = symbols and symbols.has, cond = function()
return vim.b.trouble_lualine ~= false and symbols.has()
end,
}) })
end end
@ -228,28 +225,40 @@ return {
{ {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
event = "LazyFile", event = "LazyFile",
opts = { opts = function()
indent = { LazyVim.toggle.map("<leader>ug", {
char = "", name = "Indention Guides",
tab_char = "", get = function()
}, return require("ibl.config").get_config(0).enabled
scope = { show_start = false, show_end = false }, end,
exclude = { set = function(state)
filetypes = { require("ibl").setup_buffer(0, { enabled = state })
"help", end,
"alpha", })
"dashboard",
"neo-tree", return {
"Trouble", indent = {
"trouble", char = "",
"lazy", tab_char = "",
"mason",
"notify",
"toggleterm",
"lazyterm",
}, },
}, scope = { show_start = false, show_end = false },
}, exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
}
end,
main = "ibl", main = "ibl",
}, },

View file

@ -81,7 +81,11 @@ function M.open(file, opts)
vim.opt_local.signcolumn = "yes" vim.opt_local.signcolumn = "yes"
vim.opt_local.statuscolumn = " " vim.opt_local.statuscolumn = " "
vim.opt_local.conceallevel = 3 vim.opt_local.conceallevel = 3
vim.diagnostic.disable(float.buf) if vim.diagnostic.enable then
vim.diagnostic.enable(false, { bufnr = float.buf })
else
vim.diagnostic.disable(float.buf)
end
end end
return M return M

View file

@ -39,14 +39,21 @@ function M.wk(lhs, toggle)
if not LazyVim.has("which-key.nvim") then if not LazyVim.has("which-key.nvim") then
return return
end 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({ require("which-key").add({
{ {
lhs, lhs,
icon = function() 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, end,
desc = function() desc = function()
return (toggle.get() and "Disable " or "Enable ") .. toggle.name return (safe_get() and "Disable " or "Enable ") .. toggle.name
end, end,
}, },
}) })