Compare commits

..

9 Commits

23 changed files with 124 additions and 516 deletions

View File

@ -1,6 +1,7 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

View File

@ -1,3 +1,3 @@
{
".": "12.35.0"
".": "12.29.2"
}

View File

@ -1,93 +1,5 @@
# Changelog
## [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)
### Features
* **edgy:** added support for grug-far.nvim ([b1a4740](https://github.com/LazyVim/LazyVim/commit/b1a47405b9fa5eb9f5222876e81be73206b80792))
* **terminal:** clear search highlight when opening a terminal ([#4090](https://github.com/LazyVim/LazyVim/issues/4090)) ([b5290fd](https://github.com/LazyVim/LazyVim/commit/b5290fd92935d2e96fa2249cfd09bdd853972869))
* **toggle:** move toggle notifs to toggle function ([c1b76ee](https://github.com/LazyVim/LazyVim/commit/c1b76ee235a2cccff6370ecfca57bdacd5fe6258))
### Bug Fixes
* **autcmds:** desc for close_with_q ([d6561fd](https://github.com/LazyVim/LazyVim/commit/d6561fd27c17806ca972cbfc18573ca81d13e346))
* **ui:** another typo ([b8bdebe](https://github.com/LazyVim/LazyVim/commit/b8bdebe5be7eba91db23e43575fc1226075f6a56))
* **ui:** typo ([4ac249b](https://github.com/LazyVim/LazyVim/commit/4ac249beaae3462d606128ca21db79cb85a8c65b))
## [12.31.0](https://github.com/LazyVim/LazyVim/compare/v12.30.0...v12.31.0) (2024-07-17)
### Features
* **keymaps:** proxy leader-w to ctrl-w ([bab5440](https://github.com/LazyVim/LazyVim/commit/bab54406dc312947e4e03bb728498503c09231ca))
* **R:** added new which-key group for new install feature ([#4078](https://github.com/LazyVim/LazyVim/issues/4078)) ([5339aca](https://github.com/LazyVim/LazyVim/commit/5339acacec0996968d64fdbaf9fe8187bfea1b47))
* **toggle:** make toggles callable. Fixes [#4081](https://github.com/LazyVim/LazyVim/issues/4081) ([150523b](https://github.com/LazyVim/LazyVim/commit/150523b77b6e848c4135a97a5fd8f6f79a6f4443))
* **treesitter-context:** which-key toggle ([#4059](https://github.com/LazyVim/LazyVim/issues/4059)) ([ab01350](https://github.com/LazyVim/LazyVim/commit/ab0135093bc18ccf82325bc8ee14c25230a71786))
* **which-key:** dynamic buffer mappings under leader-b ([8d9f2ad](https://github.com/LazyVim/LazyVim/commit/8d9f2ad97ee0d495135380975438ab8a8ae62b14))
* **which-key:** dynamic window mappings under leader-w ([66bba78](https://github.com/LazyVim/LazyVim/commit/66bba787b83afdd85b5ee95aa589fbe9fbb95535))
* **which-key:** leader-w-space starts hydra mode for window mappings ([865bf15](https://github.com/LazyVim/LazyVim/commit/865bf15f1cf4d4f6a3eda6d7509f94a59752fb36))
## [12.30.0](https://github.com/LazyVim/LazyVim/compare/v12.29.2...v12.30.0) (2024-07-15)
### Features
* **keymaps:** dynamic which-key icons/descriptions for toggles ([#4050](https://github.com/LazyVim/LazyVim/issues/4050)) ([78cf032](https://github.com/LazyVim/LazyVim/commit/78cf0320bfc34050883cde5e7af267184dc60ee9))
* **util.mini:** follow the user's mappings instead of hardcoded values ([#4043](https://github.com/LazyVim/LazyVim/issues/4043)) ([8506cb5](https://github.com/LazyVim/LazyVim/commit/8506cb5a98a528651a5557d8e447fa13bd8ac0cb))
### Bug Fixes
* **lsp:** lsp keymaps. Fixes [#4051](https://github.com/LazyVim/LazyVim/issues/4051) ([706ec4b](https://github.com/LazyVim/LazyVim/commit/706ec4b6b6be4265cbcfd326d3216f2a29952b55))
* **yanky:** enable yank history in visual mode ([#4048](https://github.com/LazyVim/LazyVim/issues/4048)) ([6911327](https://github.com/LazyVim/LazyVim/commit/6911327a5edca85ce3bc71229236494d9af7fafa))
### Performance Improvements
* **luasnip:** luasnip wasn't lazyloaded ([#4032](https://github.com/LazyVim/LazyVim/issues/4032)) ([e80ed32](https://github.com/LazyVim/LazyVim/commit/e80ed322a79a8b9857c6ab0ad76545654917ddcb))
## [12.29.2](https://github.com/LazyVim/LazyVim/compare/v12.29.1...v12.29.2) (2024-07-14)

View File

@ -2,9 +2,6 @@
## 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

View File

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

View File

@ -55,7 +55,6 @@ vim.api.nvim_create_autocmd("FileType", {
group = augroup("close_with_q"),
pattern = {
"PlenaryTestPopup",
"grug-far",
"help",
"lspinfo",
"notify",
@ -72,11 +71,7 @@ vim.api.nvim_create_autocmd("FileType", {
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", {
buffer = event.buf,
silent = true,
desc = "Quit buffer",
})
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})

View File

@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.version = "12.35.0" -- x-release-please-version
M.version = "12.29.2" -- x-release-please-version
LazyVim.config = M
---@class LazyVimOptions
@ -161,7 +161,6 @@ end
---@type LazyVimOptions
local options
local lazy_clipboard
---@param opts? LazyVimOptions
function M.setup(opts)
@ -182,9 +181,6 @@ 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()
@ -289,9 +285,6 @@ 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

View File

@ -174,11 +174,13 @@ map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
-- windows
map("n", "<leader>w", "<c-w>", { desc = "Windows", remap = true })
map("n", "<leader>ww", "<C-W>p", { desc = "Other Window", remap = true })
map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
map("n", "<leader>w-", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>w|", "<C-W>v", { desc = "Split Window Right", 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", "<c-w>d", "<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
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })

View File

@ -47,7 +47,6 @@ vim.g.deprecation_warnings = false
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
-- 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
local opt = vim.opt

View File

@ -128,25 +128,13 @@ return {
-- search/replace in multiple files
{
"MagicDuck/grug-far.nvim",
opts = { headerMaxWidth = 80 },
cmd = "GrugFar",
"nvim-pack/nvim-spectre",
build = false,
cmd = "Spectre",
opts = { open_cmd = "noswapfile vnew" },
-- stylua: ignore
keys = {
{
"<leader>sr",
function()
local is_visual = vim.fn.mode():lower():find("v")
if is_visual then -- needed to make visual selection work
vim.cmd([[normal! v]])
end
local grug = require("grug-far");
(is_visual and grug.with_visual_selection or grug.grug_far)({
prefills = { filesFilter = "*." .. vim.fn.expand("%:e") },
})
end,
mode = { "n", "v" },
desc = "Search and Replace",
},
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" },
},
},
@ -181,6 +169,7 @@ return {
{
mode = { "n", "v" },
{ "<leader><tab>", group = "tabs" },
{ "<leader>b", group = "buffer" },
{ "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
@ -188,29 +177,13 @@ return {
{ "<leader>q", group = "quit/session" },
{ "<leader>s", group = "search" },
{ "<leader>u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } },
{ "<leader>w", group = "windows" },
{ "<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",
group = "windows",
proxy = "<c-w>",
expand = function()
return require("which-key.extras").expand.win()
end,
},
-- better descriptions
{ "gx", desc = "Open with system app" },
},
},
},
@ -222,13 +195,6 @@ return {
end,
desc = "Buffer Keymaps (which-key)",
},
{
"<c-w><space>",
function()
require("which-key").show({ keys = "<c-w>", loop = true })
end,
desc = "Window Hydra Mode (which-key)",
},
},
config = function(_, opts)
local wk = require("which-key")

View File

@ -1,125 +0,0 @@
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

@ -1,39 +0,0 @@
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,12 +2,11 @@ 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"
-- Set to "ruff_lsp" to use the old LSP implementation version.
vim.g.lazyvim_python_ruff = "ruff"
vim.g.lazyvim_python_ruff = "ruff_lsp"
end
local lsp = vim.g.lazyvim_python_lsp or "pyright"
local ruff = vim.g.lazyvim_python_ruff or "ruff"
local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp"
return {
recommended = function()
@ -31,22 +30,22 @@ return {
"neovim/nvim-lspconfig",
opts = {
servers = {
ruff = {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
},
},
keys = {
{
"<leader>co",
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
pyright = {
enabled = lsp == "pyright",
},
basedpyright = {
enabled = lsp == "basedpyright",
},
[lsp] = {
enabled = true,
},
ruff_lsp = {
enabled = ruff == "ruff_lsp",
},
ruff = {
enabled = ruff == "ruff",
},
[ruff] = {
keys = {
{
"<leader>co",
@ -66,16 +65,6 @@ 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,

View File

@ -19,15 +19,14 @@ return {
vim.keymap.set("n", "<Enter>", "<Plug>RDSendLine", { buffer = true })
vim.keymap.set("v", "<Enter>", "<Plug>RSendSelection", { buffer = true })
-- Increase the width of which-key to handle the longer r-nvim descriptions
local wk = require("which-key")
wk.add({
buffer = true,
{ "<localleader>a", group = "all" },
{ "<localleader>b", group = "between marks" },
{ "<localleader>c", group = "chunks" },
{ "<localleader>f", group = "functions" },
{ "<localleader>g", group = "goto" },
{ "<localleader>i", group = "install" },
{ "<localleader>k", group = "knit" },
{ "<localleader>p", group = "paragraph" },
{ "<localleader>q", group = "quarto" },

View File

@ -1,17 +1,3 @@
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({
@ -25,29 +11,12 @@ return {
},
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
ruby_lsp = {
enabled = lsp == "ruby_lsp",
},
solargraph = {
enabled = lsp == "solargraph",
},
rubocop = {
enabled = formatter == "rubocop",
},
standardrb = {
enabled = formatter == "standardrb",
},
solargraph = {},
},
},
},
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "erb-formatter", "erb-lint" } },
},
{
"mfussenegger/nvim-dap",
optional = true,
@ -58,16 +27,6 @@ return {
end,
},
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
ruby = { formatter },
eruby = { "erb-format" },
},
},
},
{
"nvim-neotest/neotest",
optional = true,

View File

@ -56,9 +56,6 @@ return {
{ title = "Neotest Summary", ft = "neotest-summary" },
-- "neo-tree",
},
right = {
{ title = "Grug Far", ft = "grug-far", size = { width = 0.4 } },
},
keys = {
-- increase width
["<c-Right>"] = function(win)

View File

@ -14,13 +14,6 @@ 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("<leader>ua", {
name = "Mini Animate",
get = function()

View File

@ -1,22 +1,21 @@
-- Show context of the current function
return {
"nvim-treesitter/nvim-treesitter-context",
event = "VeryLazy",
opts = function()
local tsc = require("treesitter-context")
LazyVim.toggle.map("<leader>ut", {
name = "Treesitter Context",
get = tsc.enabled,
set = function(state)
if state then
tsc.enable()
event = "LazyFile",
opts = { mode = "cursor", max_lines = 3 },
keys = {
{
"<leader>ut",
function()
local tsc = require("treesitter-context")
tsc.toggle()
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
else
tsc.disable()
LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
end
end,
})
return { mode = "cursor", max_lines = 3 }
end,
desc = "Toggle Treesitter Context",
},
},
}

View File

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

View File

@ -196,9 +196,6 @@ 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

View File

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

View File

@ -87,8 +87,6 @@ function M.open(cmd, opts)
vim.cmd.startinsert()
end,
})
vim.cmd("noh")
end
return terminals[termkey]

View File

@ -5,33 +5,22 @@ local M = {}
---@field name string
---@field get fun():boolean
---@field set fun(state:boolean)
---@class lazyvim.Toggle.wrap: lazyvim.Toggle
---@operator call:boolean
---@param toggle lazyvim.Toggle
function M.wrap(toggle)
return setmetatable(toggle, {
__call = function()
toggle.set(not toggle.get())
local state = toggle.get()
if state then
LazyVim.info("Enabled " .. toggle.name, { title = toggle.name })
else
LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name })
end
return state
end,
}) --[[@as lazyvim.Toggle.wrap]]
end
---@overload fun()
local T = {}
T.__index = T
---@param lhs string
---@param toggle lazyvim.Toggle
function M.map(lhs, toggle)
local t = M.wrap(toggle)
LazyVim.safe_keymap_set("n", lhs, function()
t()
end, { desc = "Toggle " .. toggle.name })
local state = not toggle.get()
toggle.set(state)
if state then
LazyVim.info("Enabled " .. toggle.name, { title = toggle.name })
else
LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name })
end
end, { desc = "Toggle" .. toggle.name })
M.wk(lhs, toggle)
end
@ -39,27 +28,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 safe_get() and { icon = "", color = "green" } or { icon = "", color = "yellow" }
return toggle.get() and { icon = "", color = "green" } or { icon = "", color = "yellow" }
end,
desc = function()
return (safe_get() and "Disable " or "Enable ") .. toggle.name
return (toggle.get() and "Disable " or "Enable ") .. toggle.name
end,
},
})
end
M.treesitter = M.wrap({
---@type lazyvim.Toggle
M.treesitter = {
name = "Treesitter Highlight",
get = function()
return vim.b.ts_highlight
@ -71,11 +54,12 @@ M.treesitter = M.wrap({
vim.treesitter.stop()
end
end,
})
}
---@param buf? boolean
function M.format(buf)
return M.wrap({
---@type lazyvim.Toggle
local ret = {
name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")",
get = function()
if not buf then
@ -86,7 +70,8 @@ function M.format(buf)
set = function(state)
LazyVim.format.enable(state, buf)
end,
})
}
return ret
end
---@param opts? {values?: {[1]:any, [2]:any}, name?: string}
@ -95,7 +80,8 @@ function M.option(option, opts)
local name = opts.name or option
local on = opts.values and opts.values[2] or true
local off = opts.values and opts.values[1] or false
return M.wrap({
---@type lazyvim.Toggle
local ret = {
name = name,
get = function()
return vim.opt_local[option]:get() == on
@ -103,11 +89,13 @@ function M.option(option, opts)
set = function(state)
vim.opt_local[option] = state and on or off
end,
})
}
return ret
end
local nu = { number = true, relativenumber = true }
M.number = M.wrap({
---@type lazyvim.Toggle
M.number = {
name = "Line Numbers",
get = function()
return vim.opt_local.number:get() or vim.opt_local.relativenumber:get()
@ -122,17 +110,19 @@ M.number = M.wrap({
vim.opt_local.relativenumber = false
end
end,
})
}
M.diagnostics = M.wrap({
---@type lazyvim.Toggle
M.diagnostics = {
name = "Diagnostics",
get = function()
return vim.diagnostic.is_enabled and vim.diagnostic.is_enabled()
end,
set = vim.diagnostic.enable,
})
}
M.inlay_hints = M.wrap({
---@type lazyvim.Toggle
M.inlay_hints = {
name = "Inlay Hints",
get = function()
return vim.lsp.inlay_hint.is_enabled({ bufnr = 0 })
@ -140,11 +130,12 @@ M.inlay_hints = M.wrap({
set = function(state)
vim.lsp.inlay_hint.enable(state, { bufnr = 0 })
end,
})
}
---@type {k:string, v:any}[]
M._maximized = nil
M.maximize = M.wrap({
---@type lazyvim.Toggle
M.maximize = {
name = "Maximize",
get = function()
return M._maximized ~= nil
@ -179,7 +170,7 @@ M.maximize = M.wrap({
vim.cmd("wincmd =")
end
end,
})
}
setmetatable(M, {
__call = function(m, ...)