Compare commits

...

25 Commits

Author SHA1 Message Date
ba7fb0d0e4 Merge branch 'main' into toggles 2024-07-15 15:46:48 +02:00
a8e80d819a fix: shorter descriptions for ts 2024-07-15 15:44:53 +02:00
b7bcac9c9d refactor: diag 2024-07-15 15:32:01 +02:00
4e52d31187 feat: more wk icons 2024-07-15 15:21:57 +02:00
24918c2565 refactor: option names 2024-07-15 15:13:07 +02:00
4d9407dc22 feat: mini.pairs toggle 2024-07-15 15:08:13 +02:00
50b3050d30 feat: animate toggle 2024-07-15 15:07:56 +02:00
4ca9cb6a1c fix: option with values array 2024-07-15 15:07:46 +02:00
706ec4b6b6 fix(lsp): lsp keymaps. Fixes #4051 2024-07-15 14:05:49 +02:00
82a3ccc4d6 feat(keymaps): dynamic which-key icons/descriptions for toggles 2024-07-15 13:25:32 +02:00
6911327a5e fix(yanky): enable yank history in visual mode (#4048)
## Description

Being able to select from the yank history is useful if you want to
paste over something else by first selecting the stuff you want to
remove in visual mode.

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-07-15 11:48:58 +02:00
0f2d01dd01 chore(update): update repository (#4047)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action

Co-authored-by: folke <292349+folke@users.noreply.github.com>
2024-07-15 11:19:44 +02:00
448e15862a chore(build): auto-generate docs 2024-07-15 07:07:24 +00:00
8506cb5a98 feat(util.mini): follow the user's mappings instead of hardcoded values (#4043)
Because I use the Colemak-DH keyboard layout, I have mapped 'i' to 'h'.
Therefore, the current mini.ai which_key prompts are inconsistent with
my keymap.


## Description

The names and prefixes used in mini.ai_whichkey() are hardcoded and
should follow the user's mappings.

## Related Issue(s)

No

## Screenshots

No

## Checklist

- [ x ] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2024-07-15 09:06:34 +02:00
e80ed322a7 perf(luasnip): luasnip wasn't lazyloaded (#4032)
## Description

this makes the extra luasnip lazy load at the same time as nvim cmp.
just putting `lazy = true` works because `nvim-cmp` when being loaded
with `InsertEnter` also load `cmp-luasnip`, which itself load `LUASNIP`.

you can see the problem in the following discussion
https://github.com/LazyVim/LazyVim/discussions/3966 where luasnip was
not lazy loaded when starting lazyvim. This was also loading nvim-cmp
and all its dep when starting lazyvim, which negatively impacted
performance.

## Related Issue(s)

https://github.com/LazyVim/LazyVim/discussions/3966

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-07-14 18:19:28 +02:00
29e285d882 style(persistence): remove unused option 2024-07-14 18:11:24 +02:00
b20be638b3 chore(main): release 12.29.2 (#4035)
🤖 I have created a release *beep* *boop*
---


##
[12.29.2](https://github.com/LazyVim/LazyVim/compare/v12.29.1...v12.29.2)
(2024-07-14)


### Bug Fixes

* **telescope:** better find_command. Fixes
[#4031](https://github.com/LazyVim/LazyVim/issues/4031)
([d39cdb0](d39cdb0596))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-14 18:08:14 +02:00
d39cdb0596 fix(telescope): better find_command. Fixes #4031 2024-07-14 18:06:40 +02:00
45af7e1fed chore(main): release 12.29.1 (#4026)
🤖 I have created a release *beep* *boop*
---


##
[12.29.1](https://github.com/LazyVim/LazyVim/compare/v12.29.0...v12.29.1)
(2024-07-14)


### Bug Fixes

* **omnisharp:** don't detach coreclr debug adapter
([#4023](https://github.com/LazyVim/LazyVim/issues/4023))
([b3e746b](b3e746b637))
* **pick:** get rid of "auto" picker and set better defaults for
telescope find_files
([#4024](https://github.com/LazyVim/LazyVim/issues/4024))
([337e9dd](337e9ddc00))
* **tailwind:** additional tailwind completion settings for phoenix
projects ([#3961](https://github.com/LazyVim/LazyVim/issues/3961))
([9bce054](9bce054faf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-14 07:54:09 +02:00
9bce054faf fix(tailwind): additional tailwind completion settings for phoenix projects (#3961)
## Description

Tailwind completions stopped working in Phoenix projects that have
`HTML`, `HEEX` or `Elixir files with ~H sigils`.

Broader discussion and recommended solution:
https://github.com/tailwindlabs/tailwindcss-intellisense/issues/1002

## Related Issue(s)


## Screenshots

![Screenshot 2024-07-08 at 9 05
45 PM](https://github.com/LazyVim/LazyVim/assets/379021/8572e6c1-12dd-454c-b60e-3b33ae448284)
![Screenshot 2024-07-08 at 9 05
08 PM](https://github.com/LazyVim/LazyVim/assets/379021/f93bdc28-813e-4485-b40d-146c1670b8c2)


## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-07-14 07:53:18 +02:00
b3e746b637 fix(omnisharp): don't detach coreclr debug adapter (#4023)
## Description

Debugging c# with the Omnisharp plugin doesn't work, as described by
myself in #4004. Turns out this is a known issue with how nvim-dap calls
the mason netcoredbg cmd script. [The
solution](https://github.com/jay-babu/mason-nvim-dap.nvim/issues/132) is
to pass `detach = false` as an option to the debug adapter. I've tested
and it works on my windows machine.

## Related Issue(s)

#4004

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-07-14 07:52:53 +02:00
337e9ddc00 fix(pick): get rid of "auto" picker and set better defaults for telescope find_files (#4024)
## Description

Changes telescope's `find_files` options to match `fzf-lua` that matches
what `git_files` does including untracked files.

## Related Issue(s)

Fixes #3974

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-07-14 07:52:00 +02:00
065d72320d chore(main): release 12.29.0 (#4015)
🤖 I have created a release *beep* *boop*
---


##
[12.29.0](https://github.com/LazyVim/LazyVim/compare/v12.28.0...v12.29.0)
(2024-07-14)


### Features

* **java:** new java mappings format for which-key v3
([#4013](https://github.com/LazyVim/LazyVim/issues/4013))
([28a7f81](28a7f8126c))
* shorter keymap descriptions for mini.ai / yanky
([75ff149](75ff1496bd))


### Bug Fixes

* **flit:** use which-key preset keymap descriptions
([#4000](https://github.com/LazyVim/LazyVim/issues/4000))
([ca37162](ca37162cb7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-14 07:50:40 +02:00
d01a58ef90 chore(build): auto-generate docs 2024-07-14 05:09:15 +00:00
75ff1496bd feat: shorter keymap descriptions for mini.ai / yanky 2024-07-14 07:08:17 +02:00
23 changed files with 346 additions and 192 deletions

View File

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

View File

@ -17,6 +17,8 @@ body:
options:
- label: I have read all the LazyVim docs
required: true
- label: I have updated the plugin to the latest version before submitting this issue
required: true
- label: I have searched the existing issues of LazyVim
required: true
- label: I have searched the existing issues of plugins related to this issue

View File

@ -1,5 +1,34 @@
# Changelog
## [12.29.2](https://github.com/LazyVim/LazyVim/compare/v12.29.1...v12.29.2) (2024-07-14)
### Bug Fixes
* **telescope:** better find_command. Fixes [#4031](https://github.com/LazyVim/LazyVim/issues/4031) ([d39cdb0](https://github.com/LazyVim/LazyVim/commit/d39cdb059624b1200f2ef762f30c6e3b74066bc5))
## [12.29.1](https://github.com/LazyVim/LazyVim/compare/v12.29.0...v12.29.1) (2024-07-14)
### Bug Fixes
* **omnisharp:** don't detach coreclr debug adapter ([#4023](https://github.com/LazyVim/LazyVim/issues/4023)) ([b3e746b](https://github.com/LazyVim/LazyVim/commit/b3e746b637a0d43aa0195cc1ff3d8adf1fedfaf6))
* **pick:** get rid of "auto" picker and set better defaults for telescope find_files ([#4024](https://github.com/LazyVim/LazyVim/issues/4024)) ([337e9dd](https://github.com/LazyVim/LazyVim/commit/337e9ddc007d32c624433b5c6f0af6e8697dfcc6))
* **tailwind:** additional tailwind completion settings for phoenix projects ([#3961](https://github.com/LazyVim/LazyVim/issues/3961)) ([9bce054](https://github.com/LazyVim/LazyVim/commit/9bce054fafcd631ec133a82ada1ecbbd23ca5510))
## [12.29.0](https://github.com/LazyVim/LazyVim/compare/v12.28.0...v12.29.0) (2024-07-14)
### Features
* **java:** new java mappings format for which-key v3 ([#4013](https://github.com/LazyVim/LazyVim/issues/4013)) ([28a7f81](https://github.com/LazyVim/LazyVim/commit/28a7f8126c1b46b41ca58845ee081b67ce6981f2))
* shorter keymap descriptions for mini.ai / yanky ([75ff149](https://github.com/LazyVim/LazyVim/commit/75ff1496bd4209784a4250e59920d24d75a3e3b0))
### Bug Fixes
* **flit:** use which-key preset keymap descriptions ([#4000](https://github.com/LazyVim/LazyVim/issues/4000)) ([ca37162](https://github.com/LazyVim/LazyVim/commit/ca37162cb7452dce32cf3f0ad661bcd1245286c0))
## [12.28.0](https://github.com/LazyVim/LazyVim/compare/v12.27.0...v12.28.0) (2024-07-12)

View File

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

View File

@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.version = "12.28.0" -- x-release-please-version
M.version = "12.29.2" -- x-release-please-version
LazyVim.config = M
---@class LazyVimOptions

View File

@ -115,20 +115,19 @@ map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
-- stylua: ignore start
-- toggle options
map("n", "<leader>uf", function() LazyVim.format.toggle() end, { desc = "Toggle Auto Format (Global)" })
map("n", "<leader>uF", function() LazyVim.format.toggle(true) end, { desc = "Toggle Auto Format (Buffer)" })
map("n", "<leader>us", function() LazyVim.toggle("spell") end, { desc = "Toggle Spelling" })
map("n", "<leader>uw", function() LazyVim.toggle("wrap") end, { desc = "Toggle Word Wrap" })
map("n", "<leader>uL", function() LazyVim.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
map("n", "<leader>ul", function() LazyVim.toggle.number() end, { desc = "Toggle Line Numbers" })
map("n", "<leader>ud", function() LazyVim.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
map("n", "<leader>uc", function() LazyVim.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
map( "n", "<leader>uh", function() LazyVim.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
LazyVim.toggle.map("<leader>uf", LazyVim.toggle.format())
LazyVim.toggle.map("<leader>uF", LazyVim.toggle.format(true))
LazyVim.toggle.map("<leader>us", LazyVim.toggle("spell", { name = "Spelling" }))
LazyVim.toggle.map("<leader>uw", LazyVim.toggle("wrap", { name = "Wrap" }))
LazyVim.toggle.map("<leader>uL", LazyVim.toggle("relativenumber", { name = "Relative Number" }))
LazyVim.toggle.map("<leader>ud", LazyVim.toggle.diagnostics)
LazyVim.toggle.map("<leader>ul", LazyVim.toggle.number)
LazyVim.toggle.map( "<leader>uc", LazyVim.toggle("conceallevel", { values = { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 } }))
LazyVim.toggle.map("<leader>uT", LazyVim.toggle.treesitter)
LazyVim.toggle.map("<leader>ub", LazyVim.toggle("background", { values = { "light", "dark" }, name = "Background" }))
if vim.lsp.inlay_hint then
LazyVim.toggle.map("<leader>uh", LazyVim.toggle.inlay_hints)
end
map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" })
map("n", "<leader>ub", function() LazyVim.toggle("background", false, {"light", "dark"}) end, { desc = "Toggle Background" })
-- lazygit
map("n", "<leader>gg", function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
@ -181,7 +180,7 @@ 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", "<leader>wm", function() LazyVim.toggle.maximize() end, { desc = "Maximize Toggle" })
LazyVim.toggle.map("<leader>wm", LazyVim.toggle.maximize)
-- tabs
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })

View File

@ -140,20 +140,6 @@ return {
-- better deal with markdown code blocks
markdown = true,
},
keys = {
{
"<leader>up",
function()
vim.g.minipairs_disable = not vim.g.minipairs_disable
if vim.g.minipairs_disable then
LazyVim.warn("Disabled auto pairs", { title = "Option" })
else
LazyVim.info("Enabled auto pairs", { title = "Option" })
end
end,
desc = "Toggle Auto Pairs",
},
},
config = function(_, opts)
LazyVim.mini.pairs(opts)
end,
@ -171,9 +157,6 @@ return {
"echasnovski/mini.ai",
event = "VeryLazy",
opts = function()
LazyVim.on_load("which-key.nvim", function()
vim.schedule(LazyVim.mini.ai_whichkey)
end)
local ai = require("mini.ai")
return {
n_lines = 500,
@ -197,6 +180,14 @@ return {
},
}
end,
config = function(_, opts)
require("mini.ai").setup(opts)
LazyVim.on_load("which-key.nvim", function()
vim.schedule(function()
LazyVim.mini.ai_whichkey(opts)
end)
end)
end,
},
{

View File

@ -176,9 +176,9 @@ return {
{ "<leader>gh", group = "hunks" },
{ "<leader>q", group = "quit/session" },
{ "<leader>s", group = "search" },
{ "<leader>u", group = "ui" },
{ "<leader>u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } },
{ "<leader>w", group = "windows" },
{ "<leader>x", group = "diagnostics/quickfix" },
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
@ -193,7 +193,7 @@ return {
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
desc = "Buffer Keymaps (which-key)",
},
},
config = function(_, opts)

View File

@ -1,6 +1,7 @@
return {
{
"L3MON4D3/LuaSnip",
lazy = true,
build = (not LazyVim.is_win())
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
or nil,

View File

@ -17,14 +17,15 @@ return {
vim.cmd([[YankyRingHistory]])
end
end,
mode = { "n", "x" },
desc = "Open Yank History",
},
-- stylua: ignore
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" },
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Cursor" },
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Cursor" },
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Selection" },
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Selection" },
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" },
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" },
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" },
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" },
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle Forward Through Yank History" },
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },

View File

@ -211,12 +211,12 @@ return {
},
{ "<leader>/", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>:", "<cmd>FzfLua command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
-- find
{ "<leader>fb", "<cmd>FzfLua buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
{ "<leader>ff", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("auto", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>fg", "<cmd>FzfLua git_files<cr>", desc = "Find Files (git-files)" },
{ "<leader>fr", "<cmd>FzfLua oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },

View File

@ -92,12 +92,12 @@ return {
},
{ "<leader>/", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
-- find
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
{ "<leader>ff", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("auto", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>fg", "<cmd>Telescope git_files<cr>", desc = "Find Files (git-files)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },
@ -165,6 +165,20 @@ return {
LazyVim.pick("find_files", { hidden = true, default_text = line })()
end
local function find_command()
if 1 == vim.fn.executable("rg") then
return { "rg", "--files", "--color", "never", "-g", "!.git" }
elseif 1 == vim.fn.executable("fd") then
return { "fd", "--type", "f", "--color", "never", "-E", ".git" }
elseif 1 == vim.fn.executable("fdfind") then
return { "fdfind", "--type", "f", "--color", "never", "-E", ".git" }
elseif 1 == vim.fn.executable("find") and vim.fn.has("win32") == 0 then
return { "find", ".", "-type", "f" }
elseif 1 == vim.fn.executable("where") then
return { "where", "/r", ".", "*" }
end
end
return {
defaults = {
prompt_prefix = "",
@ -198,6 +212,12 @@ return {
},
},
},
pickers = {
find_files = {
find_command = find_command,
hidden = true,
},
},
}
end,
},

View File

@ -75,6 +75,9 @@ return {
type = "executable",
command = vim.fn.exepath("netcoredbg"),
args = { "--interpreter=vscode" },
options = {
detached = false,
},
}
end
for _, lang in ipairs({ "cs", "fsharp", "vb" }) do

View File

@ -40,6 +40,17 @@ return {
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,

View File

@ -14,6 +14,16 @@ return {
end, { expr = true })
end
LazyVim.toggle.map("<leader>ua", {
name = "Mini Animate",
get = function()
return not vim.g.minianimate_disable
end,
set = function(state)
vim.g.minianimate_disable = not state
end,
})
local animate = require("mini.animate")
return {
resize = {

View File

@ -7,9 +7,9 @@ return {
"mason.nvim",
{ "williamboman/mason-lspconfig.nvim", config = function() end },
},
---@class PluginLspOpts
opts = function()
return {
---@class PluginLspOpts
local ret = {
-- options for vim.diagnostic.config()
---@type vim.diagnostic.Opts
diagnostics = {
@ -114,6 +114,7 @@ return {
-- ["*"] = function(server, opts) end,
},
}
return ret
end,
---@param opts PluginLspOpts
config = function(_, opts)
@ -150,7 +151,7 @@ return {
and vim.bo[buffer].buftype == ""
and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype)
then
LazyVim.toggle.inlay_hints(buffer, true)
vim.lsp.inlay_hint.enable(true, { bufnr = buffer })
end
end)
end

View File

@ -14,10 +14,10 @@ function M.get()
-- stylua: ignore
M._keys = {
{ "<leader>cl", "<cmd>LspInfo<cr>", 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.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", vim.lsp.buf.hover, desc = "Hover" },
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },

View File

@ -1,4 +1,14 @@
return {
{
"folke/which-key.nvim",
opts = {
spec = {
{ "<BS>", desc = "Decrement Selection", mode = "x" },
{ "<c-space>", desc = "Increment Selection", mode = { "x", "n" } },
},
},
},
-- Treesitter is a new parser generator tool that we can
-- use in Neovim to power faster and more accurate
-- syntax highlighting.

View File

@ -6,7 +6,7 @@ return {
{
"folke/persistence.nvim",
event = "BufReadPre",
opts = { options = vim.opt.sessionoptions:get() },
opts = {},
-- stylua: ignore
keys = {
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore Session" },

View File

@ -97,10 +97,19 @@ end
---@param buf? boolean
function M.toggle(buf)
M.enable(not M.enabled(), buf)
end
---@param enable? boolean
---@param buf? boolean
function M.enable(enable, buf)
if enable == nil then
enable = true
end
if buf then
vim.b.autoformat = not M.enabled()
vim.b.autoformat = enable
else
vim.g.autoformat = not M.enabled()
vim.g.autoformat = enable
vim.b.autoformat = nil
end
M.info()

View File

@ -60,48 +60,59 @@ function M.ai_buffer(ai_type)
end
-- register all text objects with which-key
function M.ai_whichkey()
---@param opts table
function M.ai_whichkey(opts)
local objects = {
{ " ", desc = "whitespace" },
{ '"', desc = 'balanced "' },
{ "'", desc = "balanced '" },
{ "(", desc = "balanced (" },
{ ")", desc = "balanced ) including white-space" },
{ "<", desc = "balanced <" },
{ ">", desc = "balanced > including white-space" },
{ '"', desc = '" string' },
{ "'", desc = "' string" },
{ "(", desc = "() block" },
{ ")", desc = "() block with ws" },
{ "<", desc = "<> block" },
{ ">", desc = "<> block with ws" },
{ "?", desc = "user prompt" },
{ "U", desc = "use/call without dot in name" },
{ "[", desc = "balanced [" },
{ "]", desc = "balanced ] including white-space" },
{ "U", desc = "use/call without dot" },
{ "[", desc = "[] block" },
{ "]", desc = "[] block with ws" },
{ "_", desc = "underscore" },
{ "`", desc = "balanced `" },
{ "`", desc = "` string" },
{ "a", desc = "argument" },
{ "b", desc = "balanced )]}" },
{ "b", desc = ")]} block" },
{ "c", desc = "class" },
{ "d", desc = "digit(s)" },
{ "e", desc = "word in CamelCase & snake_case" },
{ "e", desc = "CamelCase / snake_case" },
{ "f", desc = "function" },
{ "g", desc = "entire file" },
{ "i", desc = "indent" },
{ "o", desc = "block, conditional, loop" },
{ "q", desc = "quote `\"'" },
{ "t", desc = "tag" },
{ "u", desc = "use/call function & method" },
{ "{", desc = "balanced {" },
{ "}", desc = "balanced } including white-space" },
{ "u", desc = "use/call" },
{ "{", desc = "{} block" },
{ "}", desc = "{} with ws" },
}
local ret = { mode = { "o", "x" } }
for prefix, name in pairs({
i = "inside",
a = "around",
il = "last",
["in"] = "next",
al = "last",
an = "next",
}) do
---@type table<string, string>
local mappings = vim.tbl_extend("force", {}, {
around = "a",
inside = "i",
around_next = "an",
inside_next = "in",
around_last = "al",
inside_last = "il",
}, opts.mappings or {})
mappings.goto_left = nil
mappings.goto_right = nil
for name, prefix in pairs(mappings) do
name = name:gsub("^around_", ""):gsub("^inside_", "")
ret[#ret + 1] = { prefix, group = name }
for _, obj in ipairs(objects) do
local desc = obj.desc
if prefix:sub(1, 1) == "i" then
desc = desc:gsub(" with ws", "")
end
ret[#ret + 1] = { prefix .. obj[1], desc = obj.desc }
end
end
@ -110,6 +121,15 @@ end
---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean}
function M.pairs(opts)
LazyVim.toggle.map("<leader>up", {
name = "Mini Pairs",
get = function()
return not vim.g.minipairs_disable
end,
set = function(state)
vim.g.minipairs_disable = not state
end,
})
local pairs = require("mini.pairs")
pairs.setup(opts)
local open = pairs.open

View File

@ -57,7 +57,7 @@ function M.open(command, opts)
return LazyVim.error("LazyVim.pick: picker not set")
end
command = command or "auto"
command = command ~= "auto" and command or "files"
opts = opts or {}
opts = vim.deepcopy(opts)
@ -71,21 +71,6 @@ function M.open(command, opts)
opts.cwd = LazyVim.root({ buf = opts.buf })
end
local cwd = opts.cwd or vim.uv.cwd()
if command == "auto" then
command = "files"
if
vim.uv.fs_stat(cwd .. "/.git")
and not vim.uv.fs_stat(cwd .. "/.ignore")
and not vim.uv.fs_stat(cwd .. "/.rgignore")
then
command = "git_files"
if opts.show_untracked == nil then
opts.show_untracked = true
opts.recurse_submodules = false
end
end
end
command = M.picker.commands[command] or command
M.picker.open(command, opts)
end

View File

@ -1,114 +1,176 @@
---@class lazyvim.util.toggle
local M = {}
---@param silent boolean?
---@param values? {[1]:any, [2]:any}
function M.option(option, silent, values)
if values then
if vim.opt_local[option]:get() == values[1] then
---@diagnostic disable-next-line: no-unknown
vim.opt_local[option] = values[2]
---@class lazyvim.Toggle
---@field name string
---@field get fun():boolean
---@field set fun(state:boolean)
---@overload fun()
local T = {}
T.__index = T
---@param lhs string
---@param toggle lazyvim.Toggle
function M.map(lhs, toggle)
LazyVim.safe_keymap_set("n", lhs, function()
local state = not toggle.get()
toggle.set(state)
if state then
LazyVim.info("Enabled " .. toggle.name, { title = toggle.name })
else
---@diagnostic disable-next-line: no-unknown
vim.opt_local[option] = values[1]
LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name })
end
return LazyVim.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" })
end, { desc = "Toggle" .. toggle.name })
M.wk(lhs, toggle)
end
function M.wk(lhs, toggle)
if not LazyVim.has("which-key.nvim") then
return
end
---@diagnostic disable-next-line: no-unknown
vim.opt_local[option] = not vim.opt_local[option]:get()
if not silent then
if vim.opt_local[option]:get() then
LazyVim.info("Enabled " .. option, { title = "Option" })
require("which-key").add({
{
lhs,
icon = function()
return toggle.get() and { icon = "", color = "green" } or { icon = "", color = "yellow" }
end,
desc = function()
return (toggle.get() and "Disable " or "Enable ") .. toggle.name
end,
},
})
end
---@type lazyvim.Toggle
M.treesitter = {
name = "Treesitter Highlight",
get = function()
return vim.b.ts_highlight
end,
set = function(state)
if state then
vim.treesitter.start()
else
LazyVim.warn("Disabled " .. option, { title = "Option" })
vim.treesitter.stop()
end
end
end,
}
---@param buf? boolean
function M.format(buf)
---@type lazyvim.Toggle
local ret = {
name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")",
get = function()
if not buf then
return vim.g.autoformat == nil or vim.g.autoformat
end
return LazyVim.format.enabled()
end,
set = function(state)
LazyVim.format.enable(state, buf)
end,
}
return ret
end
---@param opts? {values?: {[1]:any, [2]:any}, name?: string}
function M.option(option, opts)
opts = opts or {}
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
---@type lazyvim.Toggle
local ret = {
name = name,
get = function()
return vim.opt_local[option]:get() == on
end,
set = function(state)
vim.opt_local[option] = state and on or off
end,
}
return ret
end
local nu = { number = true, relativenumber = true }
function M.number()
if vim.opt_local.number:get() or vim.opt_local.relativenumber:get() then
nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() }
vim.opt_local.number = false
vim.opt_local.relativenumber = false
LazyVim.warn("Disabled line numbers", { title = "Option" })
else
vim.opt_local.number = nu.number
vim.opt_local.relativenumber = nu.relativenumber
LazyVim.info("Enabled line numbers", { title = "Option" })
end
end
local enabled = true
function M.diagnostics()
-- if this Neovim version supports checking if diagnostics are enabled
-- then use that for the current state
if vim.diagnostic.is_enabled then
enabled = vim.diagnostic.is_enabled()
elseif vim.diagnostic.is_disabled then
enabled = not vim.diagnostic.is_disabled()
end
enabled = not enabled
if enabled then
vim.diagnostic.enable()
LazyVim.info("Enabled diagnostics", { title = "Diagnostics" })
else
vim.diagnostic.disable()
LazyVim.warn("Disabled diagnostics", { title = "Diagnostics" })
end
end
---@param buf? number
---@param value? boolean
function M.inlay_hints(buf, value)
local ih = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
if type(ih) == "function" then
ih(buf, value)
elseif type(ih) == "table" and ih.enable then
if value == nil then
value = not ih.is_enabled({ bufnr = buf or 0 })
---@type lazyvim.Toggle
M.number = {
name = "Line Numbers",
get = function()
return vim.opt_local.number:get() or vim.opt_local.relativenumber:get()
end,
set = function(state)
if state then
vim.opt_local.number = nu.number
vim.opt_local.relativenumber = nu.relativenumber
else
nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() }
vim.opt_local.number = false
vim.opt_local.relativenumber = false
end
ih.enable(value, { bufnr = buf })
end
end
end,
}
---@type lazyvim.Toggle
M.diagnostics = {
name = "Diagnostics",
get = function()
return vim.diagnostic.is_enabled and vim.diagnostic.is_enabled()
end,
set = vim.diagnostic.enable,
}
---@type lazyvim.Toggle
M.inlay_hints = {
name = "Inlay Hints",
get = function()
return vim.lsp.inlay_hint.is_enabled({ bufnr = 0 })
end,
set = function(state)
vim.lsp.inlay_hint.enable(state, { bufnr = 0 })
end,
}
---@type {k:string, v:any}[]
M._maximized = nil
---@param state boolean?
function M.maximize(state)
if state == (M._maximized ~= nil) then
return
end
if M._maximized then
for _, opt in ipairs(M._maximized) do
vim.o[opt.k] = opt.v
---@type lazyvim.Toggle
M.maximize = {
name = "Maximize",
get = function()
return M._maximized ~= nil
end,
set = function(state)
if state then
M._maximized = {}
local function set(k, v)
table.insert(M._maximized, 1, { k = k, v = vim.o[k] })
vim.o[k] = v
end
set("winwidth", 999)
set("winheight", 999)
set("winminwidth", 10)
set("winminheight", 4)
vim.cmd("wincmd =")
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
vim.api.nvim_create_autocmd("ExitPre", {
once = true,
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
desc = "Restore width/height when close Neovim while maximized",
callback = function()
M.maximize.set(false)
end,
})
else
for _, opt in ipairs(M._maximized) do
vim.o[opt.k] = opt.v
end
M._maximized = nil
vim.cmd("wincmd =")
end
M._maximized = nil
vim.cmd("wincmd =")
else
M._maximized = {}
local function set(k, v)
table.insert(M._maximized, 1, { k = k, v = vim.o[k] })
vim.o[k] = v
end
set("winwidth", 999)
set("winheight", 999)
set("winminwidth", 10)
set("winminheight", 4)
vim.cmd("wincmd =")
end
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
vim.api.nvim_create_autocmd("ExitPre", {
once = true,
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
desc = "Restore width/height when close Neovim while maximized",
callback = function()
M.maximize(false)
end,
})
end
end,
}
setmetatable(M, {
__call = function(m, ...)