Compare commits

..

38 Commits

Author SHA1 Message Date
ef21bea975 chore(main): release 2.4.0 (#614)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-18 20:30:46 +02:00
38ad79d548 feat(dap): add more keybindings and lualine component (#612)
* feat(dap): add more keybindings and lualine component

* refactor(dap): changed some keymaps and sorted them

* refactor(lualine): added extra space for dap icon

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2023-04-18 20:23:39 +02:00
95b86c8d1d chore(build): auto-generate vimdoc 2023-04-18 18:01:24 +00:00
01a1b8e80d feat(diagnostics): added support for setting prefix = "icons". Check the docs on how to enable 2023-04-18 20:00:02 +02:00
06c38c52a9 feat(diagnostics): show diagnostics source when more than one source is reporting diagnostics 2023-04-18 19:59:19 +02:00
77efbe8bcf chore(main): release 2.3.0 (#606)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-17 20:53:26 +02:00
cfaf3b054e feat(dap): add step out, rebind step over (#605) 2023-04-17 17:53:39 +02:00
5f6913c0db chore(main): release 2.2.1 (#601)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-17 08:51:54 +02:00
a94f7afdeb fix(telescope): typo 2023-04-17 08:49:38 +02:00
b391c37e53 chore(main): release 2.2.0 (#595)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-17 08:31:16 +02:00
338680d80a chore(build): auto-generate vimdoc 2023-04-17 05:34:39 +00:00
df9547f432 fix(telescope): consistent keymap description. Fixes #600 2023-04-17 07:33:55 +02:00
0155de00ab feat(noice): added keymap to dismiss all noice messages 2023-04-16 23:08:46 +02:00
0cb8974221 fix(lsp): gT => gy. keymap for goto type definition. Fixes #554 2023-04-16 22:35:14 +02:00
700cdaf30d chore(main): release 2.1.0 (#594)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-16 22:05:08 +02:00
feaeab9fca fix(dap): added DapInstall and DapUninstall to cmds 2023-04-16 21:56:38 +02:00
54846ff763 docs: add extras keymaps to keymaps 2023-04-16 21:50:48 +02:00
f562d1d197 feat(dap): added extra for dap nlua 2023-04-16 21:35:52 +02:00
bc14e02a1f feat: added extra for dap 2023-04-16 21:35:38 +02:00
df94a044ec feat(which-key): easier integration for which-key group names 2023-04-16 21:33:55 +02:00
29ec138f8e chore(main): release 2.0.0 (#588)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-16 14:17:09 +02:00
98775f5631 feat(telescope): add document/workspace diagnostics and todo/fixme telescope keymaps (#557) 2023-04-16 14:15:34 +02:00
36aa64bc0b build: deprecated treesitter method 2023-04-16 11:35:35 +02:00
02c5e8d953 fix(config): options cant be disabled with lazyvim config. Fixes #566 2023-04-16 11:34:35 +02:00
a9e9204dae fix(lazygit): dont use <esc><esc> for normal more for laygit to prevent delays on <esc>. Fixes #567 2023-04-16 11:18:44 +02:00
2d8116ef67 fix(lsp): gt -> gT. Fixes #554 2023-04-16 11:03:54 +02:00
bef36bb2fd fix(format): ignore vim.b.autoformat when formatting using key bindings. Fixes #575 2023-04-16 10:48:07 +02:00
a099b2d3ab feat(keymaps): Get rename command from inc_rename configuration (#579)
Gets the rename command from the inc_rename module (when installed), rather than assuming the default `IncRename`, allowing the user to modify the inc_rename options without having to create a new keymap.
2023-04-16 10:43:14 +02:00
1defd5f670 feat(autocmds): add checkhealth filetype to close_with_q list (#512) 2023-04-16 10:39:12 +02:00
6e01e8560e feat(telescope): use the new dynamic workspace symbols (#577)
`lsp_workspace_symbols` may fail or return nothing when query is empty.
Use the new `lsp_dynamic_workspace_symbols` to dynamically query symbols
in the workspace.

Related: https://github.com/nvim-telescope/telescope.nvim/issues/964
Fixes: https://github.com/LazyVim/LazyVim/issues/576
2023-04-16 10:25:20 +02:00
7691daa036 chore(build): auto-generate vimdoc 2023-04-16 05:54:27 +00:00
7476da7811 fix(autocmds): don't auto create dirs for urls. Fixes #583 2023-04-16 07:53:42 +02:00
1c06aa35ee chore(build): auto-generate vimdoc 2023-04-15 21:12:09 +00:00
078250a114 refactor(treesitter)!: rename help to vimdoc (#521) 2023-04-15 23:11:29 +02:00
7ce1b1519a chore(main): release 1.24.0 (#510)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-31 13:17:00 +02:00
79fe0455a0 feat(lualine): added lazy extension 2023-03-31 13:05:36 +02:00
a6062758d2 chore(build): auto-generate vimdoc 2023-03-31 07:41:46 +00:00
ed48b85dbe feat(autocmds): add auto create dir (#493)
* feat(autocmds): add auto create dir

* refactor: auto-create dir

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2023-03-31 09:40:57 +02:00
16 changed files with 334 additions and 39 deletions

View File

@ -1,5 +1,91 @@
# Changelog
## [2.4.0](https://github.com/LazyVim/LazyVim/compare/v2.3.0...v2.4.0) (2023-04-18)
### Features
* **dap:** add more keybindings and lualine component ([#612](https://github.com/LazyVim/LazyVim/issues/612)) ([38ad79d](https://github.com/LazyVim/LazyVim/commit/38ad79d5485c083afdb04b1fb9f9683403a6d7bd))
* **diagnostics:** added support for setting prefix = "icons". Check the docs on how to enable ([01a1b8e](https://github.com/LazyVim/LazyVim/commit/01a1b8e80db55963f281cf36674cf1c174e2f50e))
* **diagnostics:** show diagnostics source when more than one source is reporting diagnostics ([06c38c5](https://github.com/LazyVim/LazyVim/commit/06c38c52a91bb1dcc2dec2d79d6e13606324be77))
## [2.3.0](https://github.com/LazyVim/LazyVim/compare/v2.2.1...v2.3.0) (2023-04-17)
### Features
* **dap:** add step out, rebind step over ([#605](https://github.com/LazyVim/LazyVim/issues/605)) ([cfaf3b0](https://github.com/LazyVim/LazyVim/commit/cfaf3b054e1a68ea0f7a73d51a0f6c27395198e9))
## [2.2.1](https://github.com/LazyVim/LazyVim/compare/v2.2.0...v2.2.1) (2023-04-17)
### Bug Fixes
* **telescope:** typo ([a94f7af](https://github.com/LazyVim/LazyVim/commit/a94f7afdebc56338b5552de11561646d8ef4b5be))
## [2.2.0](https://github.com/LazyVim/LazyVim/compare/v2.1.0...v2.2.0) (2023-04-17)
### Features
* **noice:** added keymap to dismiss all noice messages ([0155de0](https://github.com/LazyVim/LazyVim/commit/0155de00ab76e7ffc1d8232c10121f24c4e84cd9))
### Bug Fixes
* **lsp:** gT =&gt; gy. keymap for goto type definition. Fixes [#554](https://github.com/LazyVim/LazyVim/issues/554) ([0cb8974](https://github.com/LazyVim/LazyVim/commit/0cb89742216d4c73fa944ab9e2fcd21793ed7a78))
* **telescope:** consistent keymap description. Fixes [#600](https://github.com/LazyVim/LazyVim/issues/600) ([df9547f](https://github.com/LazyVim/LazyVim/commit/df9547f43223fd89ccc7c1fa5088623ca3c2cfd4))
## [2.1.0](https://github.com/LazyVim/LazyVim/compare/v2.0.0...v2.1.0) (2023-04-16)
### Features
* added extra for dap ([bc14e02](https://github.com/LazyVim/LazyVim/commit/bc14e02a1ff43f1a69d2a6755faeec8a5ec26ac9))
* **dap:** added extra for dap nlua ([f562d1d](https://github.com/LazyVim/LazyVim/commit/f562d1d19761c3419380c3b175fd00a440ff0932))
* **which-key:** easier integration for which-key group names ([df94a04](https://github.com/LazyVim/LazyVim/commit/df94a044ec656c456067b550531a62e80a5be420))
### Bug Fixes
* **dap:** added DapInstall and DapUninstall to cmds ([feaeab9](https://github.com/LazyVim/LazyVim/commit/feaeab9fcabf005cbf18b846d2ab0129a73837a9))
## [2.0.0](https://github.com/LazyVim/LazyVim/compare/v1.24.0...v2.0.0) (2023-04-16)
### ⚠ BREAKING CHANGES
* **treesitter:** rename help to vimdoc ([#521](https://github.com/LazyVim/LazyVim/issues/521))
### Features
* **autocmds:** add checkhealth filetype to close_with_q list ([#512](https://github.com/LazyVim/LazyVim/issues/512)) ([1defd5f](https://github.com/LazyVim/LazyVim/commit/1defd5f67008c695a7d99d72bc50432de5eaed3a))
* **keymaps:** Get rename command from inc_rename configuration ([#579](https://github.com/LazyVim/LazyVim/issues/579)) ([a099b2d](https://github.com/LazyVim/LazyVim/commit/a099b2d3ab3ff3bafb075c101e2b2a48b44fe869))
* **telescope:** add document/workspace diagnostics and todo/fixme telescope keymaps ([#557](https://github.com/LazyVim/LazyVim/issues/557)) ([98775f5](https://github.com/LazyVim/LazyVim/commit/98775f56312110c640be7e9d43ecc766a116427a))
* **telescope:** use the new dynamic workspace symbols ([#577](https://github.com/LazyVim/LazyVim/issues/577)) ([6e01e85](https://github.com/LazyVim/LazyVim/commit/6e01e8560e4ca197bc56666e9b969fe75d91b310))
### Bug Fixes
* **autocmds:** don't auto create dirs for urls. Fixes [#583](https://github.com/LazyVim/LazyVim/issues/583) ([7476da7](https://github.com/LazyVim/LazyVim/commit/7476da78117b032bc34d0130e6b1f9c7eea77073))
* **config:** options cant be disabled with lazyvim config. Fixes [#566](https://github.com/LazyVim/LazyVim/issues/566) ([02c5e8d](https://github.com/LazyVim/LazyVim/commit/02c5e8d953fff68b832a8f22a83428bd229ddc59))
* **format:** ignore vim.b.autoformat when formatting using key bindings. Fixes [#575](https://github.com/LazyVim/LazyVim/issues/575) ([bef36bb](https://github.com/LazyVim/LazyVim/commit/bef36bb2fd7493828529ed49a071d240602b164d))
* **lazygit:** dont use `&lt;esc&gt;<esc>` for normal more for laygit to prevent delays on `<esc>`. Fixes [#567](https://github.com/LazyVim/LazyVim/issues/567) ([a9e9204](https://github.com/LazyVim/LazyVim/commit/a9e9204daec3355015bbe677068198cf38cd2cf3))
* **lsp:** gt -&gt; gT. Fixes [#554](https://github.com/LazyVim/LazyVim/issues/554) ([2d8116e](https://github.com/LazyVim/LazyVim/commit/2d8116ef674ad4b2a3ba62f590ff32d1c30a2f9c))
### Code Refactoring
* **treesitter:** rename help to vimdoc ([#521](https://github.com/LazyVim/LazyVim/issues/521)) ([078250a](https://github.com/LazyVim/LazyVim/commit/078250a114b45785743fcfe0482c7667f304f92c))
## [1.24.0](https://github.com/LazyVim/LazyVim/compare/v1.23.0...v1.24.0) (2023-03-31)
### Features
* **autocmds:** add auto create dir ([#493](https://github.com/LazyVim/LazyVim/issues/493)) ([ed48b85](https://github.com/LazyVim/LazyVim/commit/ed48b85dbea30a15518b4caa58cbf5d2b54f97a0))
* **lualine:** added lazy extension ([79fe045](https://github.com/LazyVim/LazyVim/commit/79fe0455a02b791eae26e9934fdbaf075d9522ae))
## [1.23.0](https://github.com/LazyVim/LazyVim/compare/v1.22.0...v1.23.0) (2023-03-25)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 March 25
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 April 18
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -51,6 +51,7 @@ vim.api.nvim_create_autocmd("FileType", {
"spectre_panel",
"startuptime",
"tsplayground",
"checkhealth",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
@ -67,3 +68,15 @@ vim.api.nvim_create_autocmd("FileType", {
vim.opt_local.spell = true
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})

View File

@ -14,10 +14,18 @@ local defaults = {
defaults = {
autocmds = true, -- lazyvim.config.autocmds
keymaps = true, -- lazyvim.config.keymaps
options = true, -- lazyvim.config.options
-- lazyvim.config.options can't be configured here since that's loaded before lazyvim setup
-- if you want to disable loading options, add `package.loaded["lazyvim.config.options"] = true` to the top of your init.lua
},
-- icons used by other plugins
icons = {
dap = {
Stopped = { "", "DiagnosticWarn", "DapStoppedLine" },
Breakpoint = "",
BreakpointCondition = "",
BreakpointRejected = { "", "DiagnosticError" },
LogPoint = ".>",
},
diagnostics = {
Error = "",
Warn = "",
@ -141,7 +149,7 @@ function M.load(name)
})
end
-- always load lazyvim, then user file
if M.defaults[name] then
if M.defaults[name] or name == "options" then
_load("lazyvim.config." .. name)
end
_load("config." .. name)

View File

@ -112,8 +112,8 @@ local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
-- lazygit
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root() }) end, { desc = "Lazygit (root dir)" })
map("n", "<leader>gG", function() Util.float_term({ "lazygit" }) end, { desc = "Lazygit (cwd)" })
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false }) end, { desc = "Lazygit (root dir)" })
map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = false}) end, { desc = "Lazygit (cwd)" })
-- quit
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
@ -126,7 +126,7 @@ end
-- floating terminal
map("n", "<leader>ft", function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = "Terminal (root dir)" })
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
map("t", "<esc><esc>", "<c-\\><c-n>", {desc = "Enter Normal Mode"})
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
-- windows
map("n", "<leader>ww", "<C-W>p", { desc = "Other window" })

View File

@ -1,5 +1,4 @@
-- This file is automatically loaded by plugins.config
vim.g.mapleader = " "
vim.g.maplocalleader = " "
@ -28,7 +27,7 @@ opt.scrolloff = 4 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append { W = true, I = true, c = true }
opt.shortmess:append({ W = true, I = true, c = true })
opt.showmode = false -- Dont show mode since we have a statusline
opt.sidescrolloff = 8 -- Columns of context
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
@ -49,7 +48,7 @@ opt.wrap = false -- Disable line wrap
if vim.fn.has("nvim-0.9.0") == 1 then
opt.splitkeep = "screen"
opt.shortmess:append { C = true }
opt.shortmess:append({ C = true })
end
-- Fix markdown indentation settings

View File

@ -73,7 +73,7 @@ return {
version = false, -- telescope did only one release, so use HEAD for now
keys = {
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
{ "<leader>/", Util.telescope("live_grep"), desc = "Find in Files (Grep)" },
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" },
-- find
@ -89,7 +89,8 @@ return {
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>sd", "<cmd>Telescope diagnostics<cr>", desc = "Diagnostics" },
{ "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" },
{ "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" },
{ "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
@ -122,7 +123,7 @@ return {
},
{
"<leader>sS",
Util.telescope("lsp_workspace_symbols", {
Util.telescope("lsp_dynamic_workspace_symbols", {
symbols = {
"Class",
"Function",
@ -217,11 +218,7 @@ return {
event = "VeryLazy",
opts = {
plugins = { spelling = true },
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
local keymaps = {
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
@ -238,11 +235,12 @@ return {
["<leader>u"] = { name = "+ui" },
["<leader>w"] = { name = "+windows" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
}
if Util.has("noice.nvim") then
keymaps["<leader>sn"] = { name = "+noice" }
end
wk.register(keymaps)
},
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
end,
},
@ -373,6 +371,7 @@ return {
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
},
},
}

View File

@ -0,0 +1,103 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
-- fancy UI for the debugger
{
"rcarriga/nvim-dap-ui",
-- stylua: ignore
keys = {
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
},
opts = {},
config = function(_, opts)
local dap = require("dap")
local dapui = require("dapui")
dapui.setup(opts)
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close({})
end
end,
},
-- virtual text for the debugger
{
"theHamsta/nvim-dap-virtual-text",
opts = {},
},
-- which key integration
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>d"] = { name = "+debug" },
["<leader>da"] = { name = "+adapters" },
},
},
},
-- mason.nvim integration
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = "mason.nvim",
cmd = { "DapInstall", "DapUninstall" },
opts = {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_setup = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
},
},
},
},
-- stylua: ignore
keys = {
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" },
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
{ "<leader>dr", function() require("dap").repl.open() end, desc = "Repl" },
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
},
config = function()
local Config = require("lazyvim.config")
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
for name, sign in pairs(Config.icons.dap) do
sign = type(sign) == "table" and sign or { sign }
vim.fn.sign_define(
"Dap" .. name,
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
)
end
end,
}

View File

@ -0,0 +1,27 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
{
"jbyuki/one-small-step-for-vimkind",
-- stylua: ignore
keys = {
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" },
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua" },
},
config = function()
local dap = require("dap")
dap.adapters.nlua = function(callback, config)
callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })
end
dap.configurations.lua = {
{
type = "nlua",
request = "attach",
name = "Attach to running Neovim instance",
},
}
end,
},
},
}

View File

@ -18,9 +18,10 @@ function M.toggle()
end
end
function M.format()
---@param opts? {force?:boolean}
function M.format(opts)
local buf = vim.api.nvim_get_current_buf()
if vim.b.autoformat == false then
if vim.b.autoformat == false and not (opts and opts.force) then
return
end
local ft = vim.bo[buf].filetype

View File

@ -21,7 +21,14 @@ return {
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = { spacing = 4, prefix = "" },
virtual_text = {
spacing = 4,
source = "if_many",
prefix = "",
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
-- prefix = "icons",
},
severity_sort = true,
},
-- Automatically format on save
@ -79,6 +86,19 @@ return {
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
if opts.diagnostics.virtual_text.prefix == "icons" then
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and ""
or function(diagnostic)
local icons = require("lazyvim.config").icons.diagnostics
for d, icon in pairs(icons) do
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
return icon
end
end
end
end
vim.diagnostic.config(opts.diagnostics)
local servers = opts.servers

View File

@ -5,7 +5,9 @@ M._keys = nil
---@return (LazyKeys|{has?:string})[]
function M.get()
local format = require("lazyvim.plugins.lsp.format").format
local format = function()
require("lazyvim.plugins.lsp.format").format({ force = true })
end
if not M._keys then
---@class PluginLspKeys
-- stylua: ignore
@ -16,7 +18,7 @@ function M.get()
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
{ "gI", "<cmd>Telescope lsp_implementations<cr>", desc = "Goto Implementation" },
{ "gt", "<cmd>Telescope lsp_type_definitions<cr>", desc = "Goto Type Definition" },
{ "gy", "<cmd>Telescope lsp_type_definitions<cr>", desc = "Goto T[y]pe Definition" },
{ "K", vim.lsp.buf.hover, desc = "Hover" },
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
@ -49,8 +51,8 @@ function M.get()
M._keys[#M._keys + 1] = {
"<leader>cr",
function()
require("inc_rename")
return ":IncRename " .. vim.fn.expand("<cword>")
local inc_rename = require("inc_rename")
return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("<cword>")
end,
expr = true,
desc = "Rename",

View File

@ -38,7 +38,6 @@ return {
ensure_installed = {
"bash",
"c",
"help",
"html",
"javascript",
"json",
@ -53,6 +52,7 @@ return {
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
},
incremental_selection = {

View File

@ -83,7 +83,7 @@ return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(plugin)
opts = function()
local icons = require("lazyvim.config").icons
local function fg(name)
@ -98,7 +98,7 @@ return {
options = {
theme = "auto",
globalstatus = true,
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
disabled_filetypes = { statusline = { "dashboard", "alpha" } },
},
sections = {
lualine_a = { "mode" },
@ -122,17 +122,23 @@ return {
},
},
lualine_x = {
-- stylua: ignore
{
function() return "" .. require("dap").status() end,
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
color = fg("Debug"),
},
-- stylua: ignore
{
function() return require("noice").api.status.command.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
color = fg("Statement")
color = fg("Statement"),
},
-- stylua: ignore
{
function() return require("noice").api.status.mode.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
color = fg("Constant") ,
color = fg("Constant"),
},
{ require("lazy.status").updates, cond = require("lazy.status").has_updates, color = fg("Special") },
{
@ -154,7 +160,7 @@ return {
end,
},
},
extensions = { "neo-tree" },
extensions = { "neo-tree", "lazy" },
}
end,
},
@ -199,6 +205,17 @@ return {
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
-- which key integration
{
"folke/which-key.nvim",
opts = function(_, opts)
if require("lazyvim.util").has("noice.nvim") then
opts.defaults["<leader>sn"] = { name = "+noice" }
end
end,
},
},
opts = {
lsp = {
override = {
@ -218,6 +235,7 @@ return {
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
{ "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
{ "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} },
{ "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}},
},

View File

@ -54,6 +54,23 @@ function M.keymaps()
end
end)
Util.walk(root .. "/lua/lazyvim/plugins/extras", function(path, name, t)
if t == "file" and name:find("%.lua$") then
local modname = path:gsub(".*/lua/", ""):gsub("/", "."):gsub("%.lua$", "")
local extra_doc = "/plugins/extras/" .. modname:gsub("lazyvim%.plugins%.extras%.", "")
local extra = require("lazy.core.plugin").Spec.new({ import = modname })
Util.foreach(extra.plugins, function(name, plugin)
group = ("[%s](%s)\nPart of [%s](%s)"):format(plugin.name, plugin.url, modname, extra_doc)
for _, key in ipairs(plugin.keys or {}) do
if type(key) == "table" and key.desc then
local desc = key.desc or ""
map(key.mode or "n", key[1], key[2], { desc = desc })
end
end
end)
end
end)
---@type string[]
local lines = {}
@ -256,7 +273,7 @@ function M.plugins(path)
local function find_plugins(node)
if node:type() == "string" then
local text = vim.treesitter.query.get_node_text(node, source):sub(2, -2)
local text = vim.treesitter.get_node_text(node, source):sub(2, -2)
if text:find("/") and #node:parent():field("name") == 0 then
local plugin_node = node:parent():parent()
if plugin_node:named_child(0):field("value")[1]:id() ~= node:id() then

View File

@ -102,15 +102,17 @@ function M.telescope(builtin, opts)
end
end
-- FIXME: create a togglable terminal
-- Opens a floating terminal (interactive by default)
---@param cmd? string[]|string
---@param opts? LazyCmdOptions|{interactive?:boolean}
---@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false}
function M.float_term(cmd, opts)
opts = vim.tbl_deep_extend("force", {
size = { width = 0.9, height = 0.9 },
}, opts or {})
require("lazy.util").float_term(cmd, opts)
local float = require("lazy.util").float_term(cmd, opts)
if opts.esc_esc == false then
vim.keymap.set("t", "<esc>", "<esc>", { buffer = float.buf, nowait = true })
end
end
---@param silent boolean?