Compare commits
220 Commits
Author | SHA1 | Date | |
---|---|---|---|
28b7a5add2 | |||
e8c26c70e2 | |||
599798a366 | |||
b1c9fd15bd | |||
4719dadfda | |||
88d465c3ef | |||
23a0004a86 | |||
02bc41412a | |||
44984dcbe2 | |||
0955129796 | |||
4e8a88fc1f | |||
9a4b9aa804 | |||
9357ea2881 | |||
fb70170058 | |||
c0ce89fe62 | |||
5d44c976a7 | |||
6b857f1de6 | |||
9670c8a400 | |||
2abb5907ef | |||
2c658a374d | |||
4fe7ccae73 | |||
0a05888d99 | |||
d894556c37 | |||
efbe4e5793 | |||
1779858426 | |||
cc8397ade3 | |||
b05783de8c | |||
22271cdbbc | |||
bff3a99697 | |||
302c1ff66e | |||
eddd3af351 | |||
dd55cbdc99 | |||
838ce85ad6 | |||
5219cad564 | |||
de93848f58 | |||
502d32490b | |||
51e25a94b4 | |||
1eac633c4f | |||
3f67ac3c73 | |||
33c677a55e | |||
e11a3cbe80 | |||
639a6e7545 | |||
80e6696343 | |||
eebdceca17 | |||
c9bbb922e5 | |||
6e3fb589d5 | |||
4e0a05808c | |||
6b837e9165 | |||
21ee35f710 | |||
25f3587f3f | |||
0cdc23a51d | |||
89d0805fb8 | |||
1bc78272da | |||
af9e452854 | |||
9372d78e7e | |||
30d573502a | |||
3c92fa4eb0 | |||
8c20e0b588 | |||
862e140a7a | |||
1935486ff1 | |||
237be9e3a7 | |||
75a26e8509 | |||
0fcdbe20da | |||
fb110e76d8 | |||
8bcc241b72 | |||
d8f4382dd3 | |||
11c9084ec5 | |||
54df3e26ac | |||
e1f5484c82 | |||
6b4c872f2d | |||
6e0e01f5b4 | |||
a1c5886947 | |||
8a1de2b90a | |||
3823f177e9 | |||
f1ea518e29 | |||
cce46cd640 | |||
337cfdbec4 | |||
b2af941290 | |||
f219364656 | |||
6f1cdfe4bd | |||
1eb019274b | |||
d6b56c075e | |||
6f6d587998 | |||
d3e7f7717e | |||
49b91b6b1f | |||
86de423ef0 | |||
0cc80b1b05 | |||
7272b3e4b5 | |||
b58446f7b3 | |||
d989ecc943 | |||
3849e0150b | |||
1abcffbfd9 | |||
c490c61d07 | |||
79010ae671 | |||
f4750859f2 | |||
9f034ab106 | |||
2f16a7b2d9 | |||
3833a7d1ce | |||
bd2ac542a0 | |||
35053290bf | |||
417de0193d | |||
a12d4bd4e4 | |||
afc8e7f8ca | |||
936d74bb61 | |||
f15dd301e5 | |||
d28c69e49e | |||
0e66ef8393 | |||
626ae1338a | |||
5f0713d2b6 | |||
758520dcbb | |||
ccff8683ba | |||
0e16033e9c | |||
6cf6b0a624 | |||
e08813fa11 | |||
e105c9daf6 | |||
1b74d67a0d | |||
b1ad48067e | |||
63467c1f21 | |||
13e9f6e6b5 | |||
6428fc167c | |||
762017dc35 | |||
afbe2043a7 | |||
f1ce07510d | |||
364bcf325d | |||
3f868aa825 | |||
fecc5faca2 | |||
19926d2848 | |||
450e0c6beb | |||
4e277fcb8f | |||
86d3694672 | |||
7c5a458761 | |||
ecac59c982 | |||
4ff51cd678 | |||
fe341e6b97 | |||
0ca732e0ef | |||
766d5e5bf7 | |||
9b16770573 | |||
e36f7d811c | |||
0b04e3908c | |||
e8ab2ff5b6 | |||
3acdac917b | |||
2ffd629cc7 | |||
dd95de5dbe | |||
9d17c43087 | |||
2aea5c7210 | |||
9935dc3944 | |||
b8ffa5261a | |||
bfe04222fe | |||
f7655a83c5 | |||
9bb4e8755f | |||
4a2c89cd1d | |||
964dd6c4b2 | |||
0136bfa4b5 | |||
5eca3dc3bb | |||
7821c0e851 | |||
bd48536335 | |||
1c878b9d06 | |||
6f9adbd4fb | |||
ff5f5886db | |||
300350686f | |||
718c5c6036 | |||
31d913697b | |||
6bb0d1b66f | |||
0e5ff5c0ab | |||
886d49eb89 | |||
0f7a009d1c | |||
05f45bb720 | |||
9762e7e431 | |||
aab365a9f8 | |||
f61a243d1a | |||
6b05ed7dcd | |||
a7f68e5e37 | |||
3c448a1be1 | |||
7cac6f064c | |||
274649e923 | |||
a3011daf40 | |||
fa6cbfc602 | |||
d012a1acb8 | |||
d03f708cd3 | |||
017582c05a | |||
13bf7977a4 | |||
74786c21d7 | |||
7f5051ef72 | |||
b220e54159 | |||
b25559d397 | |||
ee068d8399 | |||
db86635e32 | |||
a1ab7c6e32 | |||
b30ff44af5 | |||
36d6a7fe4f | |||
50401d358b | |||
7c79cfe073 | |||
f1af34e885 | |||
5dc4ce3e4a | |||
ea930e3545 | |||
a7f971f30e | |||
e54d0dde62 | |||
0bff29c07a | |||
afdcec5b4a | |||
f892ba5cff | |||
a180c3097c | |||
b8d3a1c2cd | |||
a72a84972d | |||
6045a52d82 | |||
a910b871d1 | |||
15022f4892 | |||
f9dadc11b3 | |||
ec0ddd481c | |||
64c5848fe8 | |||
23e2b073e6 | |||
451bde5b41 | |||
377c0e397c | |||
971ed5c148 | |||
73dc5a503f | |||
566049aa4a | |||
c1fc996ccd | |||
a62a5942de | |||
9264c54ae9 | |||
549baee224 | |||
d7ca822d41 |
.github/ISSUE_TEMPLATE
CHANGELOG.mdREADME-CN.mdREADME.mddoc
lua/lazyvim
config
health.luaplugins
coding.luaeditor.luainit.lua
extras
coding
dap
editor
formatting
lang
clangd.luacmake.luadocker.luaelixir.luago.luajava.luajson.luaomnisharp.luapython.luarust.luatailwind.luaterraform.luatypescript.luayaml.lua
linting
ui
util
vscode.lualsp
treesitter.luaui.luautil
queries/lua
stylua.toml
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
450
CHANGELOG.md
450
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,7 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性,
|
||||
|
||||
## ⚡️ 要求
|
||||
|
||||
- Neovim >= **0.8.0** (需要用 **LuaJIT** 构建)
|
||||
- Neovim >= **0.9.0** (需要用 **LuaJIT** 构建)
|
||||
- Git >= **2.19.0** (用于部分克隆支持)
|
||||
- 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_**
|
||||
- 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
@ -56,7 +56,7 @@ to tweak your config as needed, along with the convenience of a pre-configured s
|
||||
|
||||
## ⚡️ Requirements
|
||||
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Neovim >= **0.9.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
|
||||
- a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 25
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 10
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
@ -52,7 +52,7 @@ FEATURES *LazyVim-features*
|
||||
|
||||
REQUIREMENTS *LazyVim-requirements*
|
||||
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Neovim >= **0.9.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a Nerd Font <https://www.nerdfonts.com/> **(optional)**
|
||||
- a **C** compiler for `nvim-treesitter`. See here <https://github.com/nvim-treesitter/nvim-treesitter#requirements>
|
||||
|
@ -22,19 +22,22 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||
group = augroup("resize_splits"),
|
||||
callback = function()
|
||||
local current_tab = vim.fn.tabpagenr()
|
||||
vim.cmd("tabdo wincmd =")
|
||||
vim.cmd("tabnext " .. current_tab)
|
||||
end,
|
||||
})
|
||||
|
||||
-- go to last loc when opening a buffer
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
group = augroup("last_loc"),
|
||||
callback = function()
|
||||
callback = function(event)
|
||||
local exclude = { "gitcommit" }
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
|
||||
local buf = event.buf
|
||||
if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then
|
||||
return
|
||||
end
|
||||
vim.b[buf].lazyvim_last_loc = true
|
||||
local mark = vim.api.nvim_buf_get_mark(buf, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(buf)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
@ -53,6 +56,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
"man",
|
||||
"notify",
|
||||
"qf",
|
||||
"query",
|
||||
"spectre_panel",
|
||||
"startuptime",
|
||||
"tsplayground",
|
||||
|
@ -1,9 +1,13 @@
|
||||
---@type LazyVimConfig
|
||||
local Util = require("lazy.core.util")
|
||||
|
||||
---@class LazyVimConfig: LazyVimOptions
|
||||
local M = {}
|
||||
|
||||
M.lazy_version = ">=9.1.0"
|
||||
M.lazy_version = ">=10.8.0"
|
||||
M.use_lazy_file = true
|
||||
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
|
||||
|
||||
---@class LazyVimConfig
|
||||
---@class LazyVimOptions
|
||||
local defaults = {
|
||||
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
|
||||
---@type string|fun()
|
||||
@ -19,6 +23,9 @@ local defaults = {
|
||||
},
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
misc = {
|
||||
dots = "",
|
||||
},
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
@ -41,10 +48,11 @@ local defaults = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Codeium = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
@ -79,42 +87,83 @@ local defaults = {
|
||||
|
||||
M.renames = {
|
||||
["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre",
|
||||
["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim",
|
||||
["null-ls.nvim"] = "none-ls.nvim",
|
||||
}
|
||||
|
||||
---@type LazyVimConfig
|
||||
---@type LazyVimOptions
|
||||
local options
|
||||
|
||||
---@param opts? LazyVimConfig
|
||||
---@param lines {[1]:string, [2]:string}[]
|
||||
function M.msg(lines)
|
||||
vim.cmd([[clear]])
|
||||
vim.api.nvim_echo(lines, true, {})
|
||||
vim.fn.getchar()
|
||||
end
|
||||
|
||||
---@param opts? LazyVimOptions
|
||||
function M.setup(opts)
|
||||
options = vim.tbl_deep_extend("force", defaults, opts or {})
|
||||
if not M.has() then
|
||||
require("lazy.core.util").error(
|
||||
"**LazyVim** needs **lazy.nvim** version "
|
||||
.. M.lazy_version
|
||||
.. " to work properly.\n"
|
||||
.. "Please upgrade **lazy.nvim**",
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
error("Exiting")
|
||||
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 0 then
|
||||
M.msg({
|
||||
{
|
||||
"LazyVim requires Neovim >= 0.9.0\n",
|
||||
"ErrorMsg",
|
||||
},
|
||||
{ "Press any key to exit", "MoreMsg" },
|
||||
})
|
||||
vim.cmd([[quit]])
|
||||
return
|
||||
end
|
||||
|
||||
if vim.fn.argc(-1) == 0 then
|
||||
-- autocmds and keymaps can wait to load
|
||||
if not M.has() then
|
||||
M.msg({
|
||||
{
|
||||
"LazyVim requires lazy.nvim " .. M.lazy_version .. "\n",
|
||||
"WarningMsg",
|
||||
},
|
||||
{ "Press any key to attempt an upgrade", "MoreMsg" },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
||||
pattern = "VeryLazy",
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
M.load("autocmds")
|
||||
M.load("keymaps")
|
||||
require("lazy").update({ plugins = { "lazy.nvim" }, wait = true })
|
||||
M.msg({
|
||||
{
|
||||
"**lazy.nvim** has been upgraded.\nPlease restart **Neovim**",
|
||||
"WarningMsg",
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
else
|
||||
-- load them now so they affect the opened buffers
|
||||
M.load("autocmds")
|
||||
M.load("keymaps")
|
||||
end
|
||||
|
||||
require("lazy.core.util").try(function()
|
||||
-- autocmds can be loaded lazily when not opening a file
|
||||
local lazy_autocmds = vim.fn.argc(-1) == 0
|
||||
if not lazy_autocmds then
|
||||
M.load("autocmds")
|
||||
end
|
||||
|
||||
local group = vim.api.nvim_create_augroup("LazyVim", { clear = true })
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = group,
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
if lazy_autocmds then
|
||||
M.load("autocmds")
|
||||
end
|
||||
M.load("keymaps")
|
||||
end,
|
||||
})
|
||||
|
||||
if M.use_lazy_file then
|
||||
M.lazy_file()
|
||||
end
|
||||
|
||||
Util.track("colorscheme")
|
||||
Util.try(function()
|
||||
if type(M.colorscheme) == "function" then
|
||||
M.colorscheme()
|
||||
else
|
||||
@ -123,10 +172,63 @@ function M.setup(opts)
|
||||
end, {
|
||||
msg = "Could not load your colorscheme",
|
||||
on_error = function(msg)
|
||||
require("lazy.core.util").error(msg)
|
||||
Util.error(msg)
|
||||
vim.cmd.colorscheme("habamax")
|
||||
end,
|
||||
})
|
||||
Util.track()
|
||||
end
|
||||
|
||||
-- Properly load file based plugins without blocking the UI
|
||||
function M.lazy_file()
|
||||
local events = {} ---@type {event: string, buf: number, data?: any}[]
|
||||
|
||||
local function load()
|
||||
if #events == 0 then
|
||||
return
|
||||
end
|
||||
local Event = require("lazy.core.handler.event")
|
||||
vim.api.nvim_del_augroup_by_name("lazy_file")
|
||||
|
||||
Util.track({ event = "LazyVim.lazy_file" })
|
||||
|
||||
---@type table<string,string[]>
|
||||
local skips = {}
|
||||
for _, event in ipairs(events) do
|
||||
skips[event.event] = skips[event.event] or Event.get_augroups(event.event)
|
||||
end
|
||||
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
|
||||
for _, event in ipairs(events) do
|
||||
Event.trigger({
|
||||
event = event.event,
|
||||
exclude = skips[event.event],
|
||||
data = event.data,
|
||||
buf = event.buf,
|
||||
})
|
||||
if vim.bo[event.buf].filetype then
|
||||
Event.trigger({
|
||||
event = "FileType",
|
||||
buf = event.buf,
|
||||
})
|
||||
end
|
||||
end
|
||||
vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false })
|
||||
events = {}
|
||||
Util.track()
|
||||
end
|
||||
|
||||
-- schedule wrap so that nested autocmds are executed
|
||||
-- and the UI can continue rendering without blocking
|
||||
load = vim.schedule_wrap(load)
|
||||
|
||||
vim.api.nvim_create_autocmd(M.lazy_file_events, {
|
||||
group = vim.api.nvim_create_augroup("lazy_file", { clear = true }),
|
||||
callback = function(event)
|
||||
table.insert(events, event)
|
||||
load()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
---@param range? string
|
||||
@ -137,7 +239,6 @@ end
|
||||
|
||||
---@param name "autocmds" | "options" | "keymaps"
|
||||
function M.load(name)
|
||||
local Util = require("lazy.core.util")
|
||||
local function _load(mod)
|
||||
Util.try(function()
|
||||
require(mod)
|
||||
@ -169,6 +270,15 @@ M.did_init = false
|
||||
function M.init()
|
||||
if not M.did_init then
|
||||
M.did_init = true
|
||||
local plugin = require("lazy.core.config").spec.plugins.LazyVim
|
||||
if plugin then
|
||||
vim.opt.rtp:append(plugin.dir)
|
||||
end
|
||||
|
||||
M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil
|
||||
|
||||
-- delay notifications till vim.notify was replaced or after 500ms
|
||||
require("lazyvim.util").lazy_notify()
|
||||
|
||||
@ -178,12 +288,45 @@ function M.init()
|
||||
require("lazyvim.config").load("options")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
local add = Plugin.Spec.add
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
Plugin.Spec.add = function(self, plugin, ...)
|
||||
if type(plugin) == "table" and M.renames[plugin[1]] then
|
||||
plugin[1] = M.renames[plugin[1]]
|
||||
if type(plugin) == "table" then
|
||||
if M.renames[plugin[1]] then
|
||||
Util.warn(
|
||||
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
|
||||
plugin[1],
|
||||
M.renames[plugin[1]],
|
||||
self.importing or "LazyVim"
|
||||
),
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
plugin[1] = M.renames[plugin[1]]
|
||||
end
|
||||
if not M.use_lazy_file and plugin.event then
|
||||
if plugin.event == "LazyFile" then
|
||||
plugin.event = M.lazy_file_events
|
||||
elseif type(plugin.event) == "table" then
|
||||
local events = {} ---@type string[]
|
||||
for _, event in ipairs(plugin.event) do
|
||||
if event == "LazyFile" then
|
||||
vim.list_extend(events, M.lazy_file_events)
|
||||
else
|
||||
events[#events + 1] = event
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return add(self, plugin, ...)
|
||||
end
|
||||
|
||||
-- Add support for the LazyFile event
|
||||
local Event = require("lazy.core.handler.event")
|
||||
local _event = Event._event
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
Event._event = function(self, value)
|
||||
return value == "LazyFile" and "User LazyFile" or _event(self, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,19 +1,9 @@
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the keymap if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
-- DO NOT USE THIS IN YOU OWN CONFIG!!
|
||||
-- use `vim.keymap.set` instead
|
||||
local map = Util.safe_keymap_set
|
||||
|
||||
-- better up/down
|
||||
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
@ -66,8 +56,6 @@ map(
|
||||
{ desc = "Redraw / clear hlsearch / diff update" }
|
||||
)
|
||||
|
||||
map({ "n", "x" }, "gw", "*N", { desc = "Search word under cursor" })
|
||||
|
||||
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
|
||||
map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
@ -82,7 +70,7 @@ map("i", ".", ".<c-g>u")
|
||||
map("i", ";", ";<c-g>u")
|
||||
|
||||
-- save file
|
||||
map({ "i", "v", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
|
||||
--keywordprg
|
||||
map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" })
|
||||
@ -105,12 +93,18 @@ if not Util.has("trouble.nvim") then
|
||||
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
||||
end
|
||||
|
||||
-- formatting
|
||||
map({ "n", "v" }, "<leader>cf", function()
|
||||
require("lazyvim.plugins.lsp.format").format({ force = true })
|
||||
end, { desc = "Format" })
|
||||
|
||||
-- stylua: ignore start
|
||||
|
||||
-- toggle options
|
||||
map("n", "<leader>uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
|
||||
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" })
|
||||
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||
map("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
|
||||
map("n", "<leader>ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
@ -127,9 +121,7 @@ map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = fals
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
|
||||
-- highlights under cursor
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
end
|
||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
|
||||
-- LazyVim Changelog
|
||||
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||
|
@ -16,7 +16,7 @@ opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||
opt.laststatus = 0
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.list = true -- Show some invisible characters (tabs...
|
||||
opt.mouse = "a" -- Enable mouse mode
|
||||
opt.number = true -- Print line number
|
||||
@ -24,10 +24,10 @@ opt.pumblend = 10 -- Popup blend
|
||||
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" }
|
||||
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, 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
|
||||
@ -35,6 +35,7 @@ opt.smartcase = true -- Don't ignore case with capitals
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitkeep = "screen"
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
@ -42,13 +43,38 @@ opt.timeoutlen = 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode
|
||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
opt.fillchars = {
|
||||
foldopen = "",
|
||||
foldclose = "",
|
||||
-- fold = "⸱",
|
||||
fold = " ",
|
||||
foldsep = " ",
|
||||
diff = "╱",
|
||||
eob = " ",
|
||||
}
|
||||
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
opt.smoothscroll = true
|
||||
end
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
opt.splitkeep = "screen"
|
||||
opt.shortmess:append({ C = true })
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||
end
|
||||
|
||||
-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
else
|
||||
vim.opt.foldmethod = "indent"
|
||||
end
|
||||
|
||||
-- Fix markdown indentation settings
|
||||
|
@ -8,10 +8,10 @@ local error = vim.health.error or vim.health.report_error
|
||||
function M.check()
|
||||
start("LazyVim")
|
||||
|
||||
if vim.fn.has("nvim-0.8.0") == 1 then
|
||||
ok("Using Neovim >= 0.8.0")
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
ok("Using Neovim >= 0.9.0")
|
||||
else
|
||||
error("Neovim >= 0.8.0 is required")
|
||||
error("Neovim >= 0.9.0 is required")
|
||||
end
|
||||
|
||||
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
||||
|
@ -66,12 +66,17 @@ return {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<C-CR>"] = function(fallback)
|
||||
cmp.abort()
|
||||
fallback()
|
||||
end,
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
formatting = {
|
||||
format = function(_, item)
|
||||
@ -90,6 +95,13 @@ return {
|
||||
sorting = defaults.sorting,
|
||||
}
|
||||
end,
|
||||
---@param opts cmp.ConfigSchema
|
||||
config = function(_, opts)
|
||||
for _, source in ipairs(opts.sources) do
|
||||
source.group_index = source.group_index or 1
|
||||
end
|
||||
require("cmp").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- auto pairs
|
||||
@ -97,6 +109,21 @@ return {
|
||||
"echasnovski/mini.pairs",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>up",
|
||||
function()
|
||||
local Util = require("lazy.core.util")
|
||||
vim.g.minipairs_disable = not vim.g.minipairs_disable
|
||||
if vim.g.minipairs_disable then
|
||||
Util.warn("Disabled auto pairs", { title = "Option" })
|
||||
else
|
||||
Util.info("Enabled auto pairs", { title = "Option" })
|
||||
end
|
||||
end,
|
||||
desc = "Toggle auto pairs",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Fast and feature-rich surround actions. For text that includes
|
||||
@ -125,19 +152,25 @@ return {
|
||||
end,
|
||||
opts = {
|
||||
mappings = {
|
||||
add = "gza", -- Add surrounding in Normal and Visual modes
|
||||
delete = "gzd", -- Delete surrounding
|
||||
find = "gzf", -- Find surrounding (to the right)
|
||||
find_left = "gzF", -- Find surrounding (to the left)
|
||||
highlight = "gzh", -- Highlight surrounding
|
||||
replace = "gzr", -- Replace surrounding
|
||||
update_n_lines = "gzn", -- Update `n_lines`
|
||||
add = "gsa", -- Add surrounding in Normal and Visual modes
|
||||
delete = "gsd", -- Delete surrounding
|
||||
find = "gsf", -- Find surrounding (to the right)
|
||||
find_left = "gsF", -- Find surrounding (to the left)
|
||||
highlight = "gsh", -- Highlight surrounding
|
||||
replace = "gsr", -- Replace surrounding
|
||||
update_n_lines = "gsn", -- Update `n_lines`
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- comments
|
||||
{ "JoosepAlviste/nvim-ts-context-commentstring", lazy = true },
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_autocmd = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.comment",
|
||||
event = "VeryLazy",
|
||||
@ -158,7 +191,6 @@ return {
|
||||
-- { "i", mode = { "x", "o" } },
|
||||
-- },
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-treesitter-textobjects" },
|
||||
opts = function()
|
||||
local ai = require("mini.ai")
|
||||
return {
|
||||
@ -170,6 +202,7 @@ return {
|
||||
}, {}),
|
||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
||||
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
||||
t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" },
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
@ -59,6 +59,16 @@ return {
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
Util.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
opts.event_handlers = opts.event_handlers or {}
|
||||
vim.list_extend(opts.event_handlers, {
|
||||
{ event = events.FILE_MOVED, handler = on_move },
|
||||
{ event = events.FILE_RENAMED, handler = on_move },
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
@ -82,12 +92,26 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- fuzzy finder
|
||||
-- Fuzzy finder.
|
||||
-- The default key bindings to find files will use Telescope's
|
||||
-- `find_files` or `git_files` depending on whether the
|
||||
-- directory is a git repo.
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = vim.fn.has("nvim-0.9.0") == 0 and "057ee0f8783" or nil,
|
||||
cmd = "Telescope",
|
||||
version = false, -- telescope did only one release, so use HEAD for now
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
enabled = vim.fn.executable("make") == 1,
|
||||
config = function()
|
||||
Util.on_load("telescope.nvim", function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end)
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
|
||||
@ -138,6 +162,8 @@ return {
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol",
|
||||
@ -156,79 +182,69 @@ return {
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol (Workspace)",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-t>"] = function(...)
|
||||
return require("trouble.providers.telescope").open_with_trouble(...)
|
||||
end,
|
||||
["<a-t>"] = function(...)
|
||||
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||
end,
|
||||
["<a-i>"] = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||
end,
|
||||
["<a-h>"] = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||
end,
|
||||
["<C-Down>"] = function(...)
|
||||
return require("telescope.actions").cycle_history_next(...)
|
||||
end,
|
||||
["<C-Up>"] = function(...)
|
||||
return require("telescope.actions").cycle_history_prev(...)
|
||||
end,
|
||||
["<C-f>"] = function(...)
|
||||
return require("telescope.actions").preview_scrolling_down(...)
|
||||
end,
|
||||
["<C-b>"] = function(...)
|
||||
return require("telescope.actions").preview_scrolling_up(...)
|
||||
end,
|
||||
},
|
||||
n = {
|
||||
["q"] = function(...)
|
||||
return require("telescope.actions").close(...)
|
||||
end,
|
||||
opts = function()
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local open_with_trouble = function(...)
|
||||
return require("trouble.providers.telescope").open_with_trouble(...)
|
||||
end
|
||||
local open_selected_with_trouble = function(...)
|
||||
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||
end
|
||||
local find_files_no_ignore = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||
end
|
||||
local find_files_with_hidden = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||
end
|
||||
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
-- open files in the first window that is an actual file.
|
||||
-- use the current window if no other window is available.
|
||||
get_selection_window = function()
|
||||
local wins = vim.api.nvim_list_wins()
|
||||
table.insert(wins, 1, vim.api.nvim_get_current_win())
|
||||
for _, win in ipairs(wins) do
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
if vim.bo[buf].buftype == "" then
|
||||
return win
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-t>"] = open_with_trouble,
|
||||
["<a-t>"] = open_selected_with_trouble,
|
||||
["<a-i>"] = find_files_no_ignore,
|
||||
["<a-h>"] = find_files_with_hidden,
|
||||
["<C-Down>"] = actions.cycle_history_next,
|
||||
["<C-Up>"] = actions.cycle_history_prev,
|
||||
["<C-f>"] = actions.preview_scrolling_down,
|
||||
["<C-b>"] = actions.preview_scrolling_up,
|
||||
},
|
||||
n = {
|
||||
["q"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
enabled = function()
|
||||
vim.schedule(function()
|
||||
local Config = require("lazy.core.config")
|
||||
if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then
|
||||
require("lazy.core.util").warn(
|
||||
[[`flash.nvim` is now the default **LazyVim** jump plugin.
|
||||
**leap.nvim** and **flit.nvim** have been disabled.
|
||||
Please remove the plugins from your config.
|
||||
If you rather use leap/flit instead, you can add the leap extra:
|
||||
`lazyvim.plugins.extras.editor.leap`
|
||||
]],
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
end
|
||||
end)
|
||||
return false
|
||||
}
|
||||
end,
|
||||
optional = true,
|
||||
},
|
||||
{ "ggandor/flit.nvim", enabled = false, optional = true },
|
||||
|
||||
-- Flash enhances the built-in search functionality by showing labels
|
||||
-- at the end of each match, letting you quickly jump to a specific
|
||||
@ -291,7 +307,7 @@ If you rather use leap/flit instead, you can add the leap extra:
|
||||
defaults = {
|
||||
mode = { "n", "v" },
|
||||
["g"] = { name = "+goto" },
|
||||
["gz"] = { name = "+surround" },
|
||||
["gs"] = { name = "+surround" },
|
||||
["]"] = { name = "+next" },
|
||||
["["] = { name = "+prev" },
|
||||
["<leader><tab>"] = { name = "+tabs" },
|
||||
@ -319,7 +335,7 @@ If you rather use leap/flit instead, you can add the leap extra:
|
||||
-- hunks in a commit.
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
event = "LazyFile",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
@ -358,7 +374,7 @@ If you rather use leap/flit instead, you can add the leap extra:
|
||||
-- instances.
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
event = "LazyFile",
|
||||
opts = {
|
||||
delay = 200,
|
||||
large_file_cutoff = 2000,
|
||||
@ -396,9 +412,27 @@ If you rather use leap/flit instead, you can add the leap extra:
|
||||
-- buffer remove
|
||||
{
|
||||
"echasnovski/mini.bufremove",
|
||||
-- stylua: ignore
|
||||
|
||||
keys = {
|
||||
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
|
||||
{
|
||||
"<leader>bd",
|
||||
function()
|
||||
local bd = require("mini.bufremove").delete
|
||||
if vim.bo.modified then
|
||||
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
|
||||
if choice == 1 then -- Yes
|
||||
vim.cmd.write()
|
||||
bd(0)
|
||||
elseif choice == 2 then -- No
|
||||
bd(0, true)
|
||||
end
|
||||
else
|
||||
bd(0)
|
||||
end
|
||||
end,
|
||||
desc = "Delete Buffer",
|
||||
},
|
||||
-- stylua: ignore
|
||||
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
|
||||
},
|
||||
},
|
||||
@ -449,7 +483,7 @@ If you rather use leap/flit instead, you can add the leap extra:
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
cmd = { "TodoTrouble", "TodoTelescope" },
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
event = "LazyFile",
|
||||
config = true,
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
|
69
lua/lazyvim/plugins/extras/coding/codeium.lua
Normal file
69
lua/lazyvim/plugins/extras/coding/codeium.lua
Normal file
@ -0,0 +1,69 @@
|
||||
return {
|
||||
|
||||
-- codeium cmp source
|
||||
{
|
||||
"nvim-cmp",
|
||||
dependencies = {
|
||||
-- codeium
|
||||
{
|
||||
"Exafunction/codeium.nvim",
|
||||
cmd = "Codeium",
|
||||
build = ":Codeium Auth",
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, 1, {
|
||||
name = "codeium",
|
||||
group_index = 1,
|
||||
priority = 100,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
optional = true,
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
local started = false
|
||||
local function status()
|
||||
if not package.loaded["cmp"] then
|
||||
return
|
||||
end
|
||||
for _, s in ipairs(require("cmp").core.sources) do
|
||||
if s.name == "codeium" then
|
||||
if s.source:is_available() then
|
||||
started = true
|
||||
else
|
||||
return started and "error" or nil
|
||||
end
|
||||
if s.status == s.SourceStatus.FETCHING then
|
||||
return "pending"
|
||||
end
|
||||
return "ok"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
local colors = {
|
||||
ok = Util.fg("Special"),
|
||||
error = Util.fg("DiagnosticError"),
|
||||
pending = Util.fg("DiagnosticWarn"),
|
||||
}
|
||||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
return require("lazyvim.config").icons.kinds.Codeium
|
||||
end,
|
||||
cond = function()
|
||||
return status() ~= nil
|
||||
end,
|
||||
color = function()
|
||||
return colors[status()] or colors.ok
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -33,7 +33,13 @@ return {
|
||||
return icon .. (status.message or "")
|
||||
end,
|
||||
cond = function()
|
||||
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
|
||||
if not package.loaded["copilot"] then
|
||||
return
|
||||
end
|
||||
local ok, clients = pcall(require("lazyvim.util").get_clients, { name = "copilot", bufnr = 0 })
|
||||
if not ok then
|
||||
return false
|
||||
end
|
||||
return ok and #clients > 0
|
||||
end,
|
||||
color = function()
|
||||
@ -70,9 +76,11 @@ return {
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
||||
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
|
||||
table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize)
|
||||
table.insert(opts.sources, 1, {
|
||||
name = "copilot",
|
||||
group_index = 1,
|
||||
priority = 100,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -3,21 +3,10 @@ return {
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } },
|
||||
opts = function()
|
||||
local mapping = require("yanky.telescope.mapping")
|
||||
local mappings = mapping.get_defaults()
|
||||
mappings.i["<c-p>"] = nil
|
||||
return {
|
||||
highlight = { timer = 200 },
|
||||
ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" },
|
||||
picker = {
|
||||
telescope = {
|
||||
use_default_mappings = false,
|
||||
mappings = mappings,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
opts = {
|
||||
highlight = { timer = 250 },
|
||||
ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" },
|
||||
},
|
||||
keys = {
|
||||
-- stylua: ignore
|
||||
{ "<leader>p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" },
|
||||
|
@ -1,3 +1,14 @@
|
||||
---@param config {args?:string[]|fun():string[]?}
|
||||
local function get_args(config)
|
||||
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {}
|
||||
---@cast args string[]
|
||||
config.args = function()
|
||||
local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]]
|
||||
return vim.split(vim.fn.expand(new_args) --[[@as string]], " ")
|
||||
end
|
||||
return config
|
||||
end
|
||||
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
|
||||
@ -13,6 +24,8 @@ return {
|
||||
},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
-- setup dap config by VsCode launch.json file
|
||||
-- require("dap.ext.vscode").load_launchjs()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
@ -74,6 +87,7 @@ return {
|
||||
{ "<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>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
|
||||
{ "<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" },
|
||||
|
@ -6,8 +6,8 @@ return {
|
||||
"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" },
|
||||
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server", ft = "lua" },
|
||||
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" },
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
@ -1,6 +0,0 @@
|
||||
require("lazy.core.util").warn(
|
||||
"`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.",
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
|
||||
return {}
|
@ -35,6 +35,22 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- rename surround mappings from gs to gz to prevent conflict with leap
|
||||
{
|
||||
"echasnovski/mini.surround",
|
||||
opts = {
|
||||
mappings = {
|
||||
add = "gza", -- Add surrounding in Normal and Visual modes
|
||||
delete = "gzd", -- Delete surrounding
|
||||
find = "gzf", -- Find surrounding (to the right)
|
||||
find_left = "gzF", -- Find surrounding (to the left)
|
||||
highlight = "gzh", -- Highlight surrounding
|
||||
replace = "gzr", -- Replace surrounding
|
||||
update_n_lines = "gzn", -- Update `n_lines`
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- makes some plugins dot-repeatable like leap
|
||||
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||
}
|
||||
|
@ -53,5 +53,12 @@ return {
|
||||
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "MiniFilesActionRename",
|
||||
callback = function(event)
|
||||
require("lazyvim.util").on_rename(event.data.from, event.data.to)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
25
lua/lazyvim/plugins/extras/formatting/black.lua
Normal file
25
lua/lazyvim/plugins/extras/formatting/black.lua
Normal file
@ -0,0 +1,25 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.ensure_installed, "black")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
table.insert(opts.sources, nls.builtins.formatting.black)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
["python"] = { "black" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
58
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
58
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
@ -0,0 +1,58 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
dependencies = { "mason.nvim" },
|
||||
lazy = true,
|
||||
cmd = "ConformInfo",
|
||||
keys = {
|
||||
{
|
||||
"<leader>cF",
|
||||
function()
|
||||
require("conform").format({ formatters = { "injected" } })
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Format Injected Langs",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
-- Install the conform formatter on VeryLazy
|
||||
require("lazyvim.util").on_very_lazy(function()
|
||||
require("lazyvim.plugins.lsp.format").custom_format = function(buf)
|
||||
return require("conform").format({ bufnr = buf })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
fish = { "fish_indent" },
|
||||
sh = { "shfmt" },
|
||||
},
|
||||
-- LazyVim will merge the options you set here with builtin formatters.
|
||||
-- You can also define any custom formatters here.
|
||||
---@type table<string,table>
|
||||
formatters = {
|
||||
injected = { options = { ignore_errors = true } },
|
||||
-- -- Example of using dprint only when a dprint.json file is present
|
||||
-- dprint = {
|
||||
-- condition = function(ctx)
|
||||
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
opts.formatters = opts.formatters or {}
|
||||
for name, formatter in pairs(opts.formatters) do
|
||||
if type(formatter) == "table" then
|
||||
local ok, defaults = pcall(require, "conform.formatters." .. name)
|
||||
if ok and type(defaults) == "table" then
|
||||
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
|
||||
end
|
||||
end
|
||||
end
|
||||
require("conform").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
@ -6,10 +6,35 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
table.insert(opts.sources, nls.builtins.formatting.prettierd)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
["javascript"] = { { "prettierd", "prettier" } },
|
||||
["javascriptreact"] = { { "prettierd", "prettier" } },
|
||||
["typescript"] = { { "prettierd", "prettier" } },
|
||||
["typescriptreact"] = { { "prettierd", "prettier" } },
|
||||
["vue"] = { { "prettierd", "prettier" } },
|
||||
["css"] = { { "prettierd", "prettier" } },
|
||||
["scss"] = { { "prettierd", "prettier" } },
|
||||
["less"] = { { "prettierd", "prettier" } },
|
||||
["html"] = { { "prettierd", "prettier" } },
|
||||
["json"] = { { "prettierd", "prettier" } },
|
||||
["jsonc"] = { { "prettierd", "prettier" } },
|
||||
["yaml"] = { { "prettierd", "prettier" } },
|
||||
["markdown"] = { { "prettierd", "prettier" } },
|
||||
["markdown.mdx"] = { { "prettierd", "prettier" } },
|
||||
["graphql"] = { { "prettierd", "prettier" } },
|
||||
["handlebars"] = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -15,29 +15,27 @@ return {
|
||||
lazy = true,
|
||||
config = function() end,
|
||||
opts = {
|
||||
extensions = {
|
||||
inlay_hints = {
|
||||
inline = false,
|
||||
inlay_hints = {
|
||||
inline = false,
|
||||
},
|
||||
ast = {
|
||||
--These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
declaration = "",
|
||||
expression = "",
|
||||
specifier = "",
|
||||
statement = "",
|
||||
["template argument"] = "",
|
||||
},
|
||||
ast = {
|
||||
--These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
declaration = "",
|
||||
expression = "",
|
||||
specifier = "",
|
||||
statement = "",
|
||||
["template argument"] = "",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "",
|
||||
Recovery = "",
|
||||
TranslationUnit = "",
|
||||
PackExpansion = "",
|
||||
TemplateTypeParm = "",
|
||||
TemplateTemplateParm = "",
|
||||
TemplateParamObject = "",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "",
|
||||
Recovery = "",
|
||||
TranslationUnit = "",
|
||||
PackExpansion = "",
|
||||
TemplateTypeParm = "",
|
||||
TemplateTemplateParm = "",
|
||||
TemplateParamObject = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -56,7 +54,6 @@ return {
|
||||
root_dir = function(fname)
|
||||
return require("lspconfig.util").root_pattern(
|
||||
"Makefile",
|
||||
"CMakeLists.txt",
|
||||
"configure.ac",
|
||||
"configure.in",
|
||||
"config.h.in",
|
||||
@ -90,7 +87,7 @@ return {
|
||||
clangd = function(_, opts)
|
||||
local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim")
|
||||
require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
|
||||
return true
|
||||
return false
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
@ -8,7 +8,8 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
@ -17,6 +18,15 @@ return {
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
cmake = { "cmakelint" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
@ -35,6 +45,6 @@ return {
|
||||
{
|
||||
"Civitasv/cmake-tools.nvim",
|
||||
opts = {},
|
||||
event = "BufRead",
|
||||
event = "LazyFile",
|
||||
},
|
||||
}
|
||||
|
@ -8,7 +8,15 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
@ -16,12 +24,14 @@ return {
|
||||
nls.builtins.diagnostics.hadolint,
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -29,4 +29,30 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if vim.fn.executable("credo") == 0 then
|
||||
return
|
||||
end
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.credo,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if vim.fn.executable("credo") == 0 then
|
||||
return
|
||||
end
|
||||
opts.linters_by_ft = {
|
||||
elixir = { "credo" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -83,19 +83,28 @@ return {
|
||||
},
|
||||
-- Ensure Go tools are installed
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if type(opts.sources) == "table" then
|
||||
local nls = require("null-ls")
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.code_actions.gomodifytags,
|
||||
nls.builtins.code_actions.impl,
|
||||
nls.builtins.formatting.gofumpt,
|
||||
nls.builtins.formatting.goimports_reviser,
|
||||
nls.builtins.formatting.goimports,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
go = { "goimports" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
@ -104,7 +113,7 @@ return {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" })
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,13 +10,16 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- yaml schema support
|
||||
{
|
||||
"b0o/SchemaStore.nvim",
|
||||
lazy = true,
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"b0o/SchemaStore.nvim",
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user