Compare commits
479 Commits
Author | SHA1 | Date | |
---|---|---|---|
720b17f970 | |||
b9a2aa868b | |||
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 | |||
aa1cccf230 | |||
6dc66852b8 | |||
9fe89f5f8a | |||
76d33bba2c | |||
79619364bd | |||
2e09051472 | |||
9a0543531d | |||
f6d646a325 | |||
07f183516f | |||
b97ccb9e73 | |||
142e6bec20 | |||
fa898b7293 | |||
012ca50b28 | |||
6b2c648878 | |||
02d673d37c | |||
0411baab89 | |||
31b50e3a9c | |||
e5f53ee193 | |||
d71ebeab24 | |||
a184fc1c73 | |||
871e7fb0db | |||
fc50c055c3 | |||
df0818880e | |||
6323b419fd | |||
abaa6d90e4 | |||
f70f873355 | |||
258f339bcf | |||
4d0427e131 | |||
f2459bd70e | |||
e797e13bce | |||
489221f741 | |||
a28acf0ce7 | |||
fb1f29c32c | |||
b4b27e867c | |||
f46316af00 | |||
63e898599a | |||
3a07bd8d2e | |||
69bb89184f | |||
0801e52118 | |||
1b0b6eb0e1 | |||
8c0e39c826 | |||
bb2608ecd1 | |||
ae759b947b | |||
9387ab388e | |||
8f9f76a96f | |||
9e8ce289d1 | |||
5204aacf8d | |||
a0c2014b10 | |||
c882544224 | |||
e212c166b4 | |||
9fd89701da | |||
b1721bc20a | |||
3f68f44d72 | |||
a38bf3001d | |||
67d1cbfb01 | |||
abea2807ce | |||
44cdb5eac5 | |||
0db31c2840 | |||
22c9477b96 | |||
baa9614022 | |||
b660b51718 | |||
99f30f9a37 | |||
ae054ec13c | |||
bcff5a1937 | |||
299aae3545 | |||
0b020dc37b | |||
755419f39c | |||
ddb819cb9a | |||
9c120b5ef7 | |||
d33be73b8d | |||
27eb4610bd | |||
e5200e6358 | |||
64ca399c56 | |||
dee8dc318e | |||
6d58f1dacf | |||
a981682603 | |||
bbaf47028f | |||
8ccc109e92 | |||
a9c73bc7c3 | |||
4009620651 | |||
39627cab42 | |||
1e1fc3c6a0 | |||
eaa0118dd2 | |||
272f6af842 | |||
29ba21274d | |||
a46d47653e | |||
61e3ce8cdc | |||
36774c6058 | |||
d0bc8b7dce | |||
fca09b12e8 | |||
ea21cad7ed | |||
4ba5086b3d | |||
089606b48d | |||
6d8be7ae46 | |||
79b1c92dd2 | |||
c992ebec46 | |||
37d7ccdea1 | |||
5a441f8972 | |||
3d0de235ec | |||
146bc4f172 | |||
65c70f6ad7 | |||
75d029c35b | |||
8b1e7976a0 | |||
0e33010937 | |||
2f2c7a32a4 | |||
c03b9a3ff1 | |||
e83d2c814f | |||
5818e01f27 | |||
a1820c1b42 | |||
27d3e45df6 | |||
296d79cfbc | |||
240fa7631b | |||
d1eb9c89d3 | |||
c5759a451f | |||
c998be8fa4 | |||
5f89e4a142 | |||
5e6a07200c | |||
a40f257c79 | |||
f6f8436fe8 | |||
e9358d977a | |||
e018d07cce | |||
d5a9c54faf | |||
85542df6f5 | |||
abfdab37ce | |||
12b57235a9 | |||
1acad8be93 | |||
6e9b18aa93 | |||
c3477ed81e | |||
a080bc7667 | |||
eb7b4fc369 | |||
9bfe77c1de | |||
2ef0c437b2 | |||
ed89d01113 | |||
09c1bf54ea | |||
5299522780 | |||
9ea1f31e9d | |||
e624511fa2 | |||
69bf9e7e01 | |||
ca1880da0a | |||
09fafb946a | |||
8281bd2f63 | |||
aa28119aa6 | |||
5d0e10a30a | |||
0b99c9f788 | |||
47111bd2db | |||
318a4c8304 | |||
e865b9abe1 | |||
31505842be | |||
01c7eeebd0 | |||
428bdf768f | |||
e4eb4e1603 | |||
6b1efe78e2 | |||
b37616c203 | |||
d3440766d0 | |||
855b1ccc7d | |||
f54d95d965 | |||
ebd002f135 | |||
b95644448e | |||
41f515caae | |||
cbf1797f4c | |||
2e7ad2b825 | |||
ba49339fe3 | |||
84986b3729 | |||
986a6374f4 | |||
30d03eda5b | |||
d6bb907cf0 | |||
b2bceeed77 | |||
86fe83f311 | |||
04f17cb86b | |||
9013f6e274 | |||
6ffc89512e | |||
e049928b8b | |||
7c593dce1f | |||
47edc8918a | |||
f7b0c853cc | |||
448d502947 | |||
57c7ba1c0d | |||
2ec4da7fa5 | |||
0731f08ee4 | |||
00339b7b56 | |||
34a5d32561 | |||
1897617c98 | |||
41765a4041 | |||
ad6f6cfffd | |||
d31772f981 | |||
6a01c9a180 | |||
b929413ddd | |||
56f092f1a8 | |||
821672a0db | |||
8ce862e12e | |||
952a0cfb96 | |||
d69d55afd4 | |||
7a36e2989c | |||
049fe77c3c | |||
5a47492535 | |||
15f5a229d9 | |||
bb4a7fe410 | |||
419086e8a3 | |||
49ae2344a1 | |||
1efe3a96b2 | |||
5ed3250f24 | |||
9c1a5620ed | |||
08422bf559 | |||
fc236b3a2a | |||
01fbeb139b | |||
99ce1002d7 | |||
3b4c27e6a6 | |||
a94ef5953a | |||
0c05f8a185 | |||
6b68378c2c | |||
0e671ad7fa | |||
b68311eb6d | |||
a866c6801d | |||
5c97e0c1d0 | |||
72b81553f3 | |||
88238e2109 | |||
c272bba013 | |||
b16012b106 | |||
efc72b0649 | |||
2a3bac7690 | |||
98e2ffcf14 | |||
2c89770504 | |||
30824369c2 | |||
1288f0d5a5 | |||
a3ec4c21f7 | |||
f7a63042f9 | |||
b7a925904e | |||
5eccaeb992 | |||
962fc6bab4 | |||
e990d23cfe | |||
b027bebeab | |||
19f4250888 | |||
33f61b58de | |||
5373af76f8 | |||
c526ea338b | |||
ba0cfbccf3 | |||
47ee48faba | |||
7bc979a7c1 | |||
9c7821e681 | |||
95e2a07f16 | |||
d35d982984 | |||
877e63ca8e | |||
bc24b68260 | |||
b75ed594a9 | |||
4f2bb725be | |||
2f0bfbbad8 | |||
01a6085b2b | |||
2b5ae7b63c | |||
dc40f02f35 | |||
4b367952f6 | |||
7c9abd7463 | |||
868ccedff2 | |||
29632c6b29 | |||
5b7ae96c5d | |||
e9fb81e94d | |||
b172f47f27 | |||
9cfe88c7ba | |||
163a4f9275 | |||
076b2e432e | |||
5bf45e3139 | |||
eba510ec69 | |||
39fa63646d | |||
e975f021ea | |||
bf66e71adc | |||
cd96e3d9e5 | |||
5559228300 | |||
3dcc074693 | |||
58c3842faa | |||
89db0157b1 | |||
7443effe26 | |||
78298cb134 | |||
55bf4d104c | |||
c12835ab86 | |||
183fd89d76 | |||
99785ce36b | |||
bb0d4d4e7d | |||
f8982332be | |||
0c517d1f5c | |||
df6a0d3b10 | |||
7a7c024bf6 | |||
29554455aa | |||
b227d9727a | |||
b4099a6477 | |||
5a27e1def0 | |||
06e4ba2fdb | |||
23410a4594 | |||
c737f2b6c2 | |||
78354a1e5e | |||
080ea29354 | |||
3d7238f753 | |||
a43d1b79f2 | |||
bd1ba54d13 |
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
|
1037
CHANGELOG.md
1037
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -54,9 +54,10 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性,
|
|||||||
|
|
||||||
## ⚡️ 要求
|
## ⚡️ 要求
|
||||||
|
|
||||||
- Neovim >= **0.8.0** (需要用 **LuaJIT** 构建)
|
- Neovim >= **0.9.0** (需要用 **LuaJIT** 构建)
|
||||||
- Git >= **2.19.0** (用于部分克隆支持)
|
- Git >= **2.19.0** (用于部分克隆支持)
|
||||||
- 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_**
|
- 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_**
|
||||||
|
- 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||||
|
|
||||||
## 🚀 入门
|
## 🚀 入门
|
||||||
|
|
||||||
|
@ -56,9 +56,10 @@ to tweak your config as needed, along with the convenience of a pre-configured s
|
|||||||
|
|
||||||
## ⚡️ Requirements
|
## ⚡️ 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)
|
- Git >= **2.19.0** (for partial clones support)
|
||||||
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
|
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
|
||||||
|
- a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||||
|
|
||||||
## 🚀 Getting Started
|
## 🚀 Getting Started
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 May 13
|
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 08
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Table of Contents *LazyVim-table-of-contents*
|
Table of Contents *LazyVim-table-of-contents*
|
||||||
@ -52,9 +52,10 @@ FEATURES *LazyVim-features*
|
|||||||
|
|
||||||
REQUIREMENTS *LazyVim-requirements*
|
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)
|
- Git >= **2.19.0** (for partial clones support)
|
||||||
- a Nerd Font <https://www.nerdfonts.com/> **(optional)**
|
- a Nerd Font <https://www.nerdfonts.com/> **(optional)**
|
||||||
|
- a **C** compiler for `nvim-treesitter`. See here <https://github.com/nvim-treesitter/nvim-treesitter#requirements>
|
||||||
|
|
||||||
|
|
||||||
GETTING STARTED *LazyVim-getting-started*
|
GETTING STARTED *LazyVim-getting-started*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- This file is automatically loaded by plugins.init
|
-- This file is automatically loaded by lazyvim.config.init.
|
||||||
|
|
||||||
local function augroup(name)
|
local function augroup(name)
|
||||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||||
@ -22,16 +22,23 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||||
group = augroup("resize_splits"),
|
group = augroup("resize_splits"),
|
||||||
callback = function()
|
callback = function()
|
||||||
|
local current_tab = vim.fn.tabpagenr()
|
||||||
vim.cmd("tabdo wincmd =")
|
vim.cmd("tabdo wincmd =")
|
||||||
|
vim.cmd("tabnext " .. current_tab)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- go to last loc when opening a buffer
|
-- go to last loc when opening a buffer
|
||||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
group = augroup("last_loc"),
|
group = augroup("last_loc"),
|
||||||
callback = function()
|
callback = function(event)
|
||||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
local exclude = { "gitcommit" }
|
||||||
local lcount = vim.api.nvim_buf_line_count(0)
|
local buf = event.buf
|
||||||
|
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
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
|
if mark[1] > 0 and mark[1] <= lcount then
|
||||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||||
end
|
end
|
||||||
@ -48,10 +55,14 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
"man",
|
"man",
|
||||||
"notify",
|
"notify",
|
||||||
"qf",
|
"qf",
|
||||||
|
"query",
|
||||||
"spectre_panel",
|
"spectre_panel",
|
||||||
"startuptime",
|
"startuptime",
|
||||||
"tsplayground",
|
"tsplayground",
|
||||||
|
"neotest-output",
|
||||||
"checkhealth",
|
"checkhealth",
|
||||||
|
"neotest-summary",
|
||||||
|
"neotest-output-panel",
|
||||||
},
|
},
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.bo[event.buf].buflisted = false
|
vim.bo[event.buf].buflisted = false
|
||||||
@ -80,3 +91,16 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
|||||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- HACK: re-caclulate folds when entering a buffer through Telescope
|
||||||
|
-- @see https://github.com/nvim-telescope/telescope.nvim/issues/699
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
group = augroup("fix_folds"),
|
||||||
|
callback = function()
|
||||||
|
if vim.opt.foldmethod:get() == "expr" then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.opt.foldmethod = "expr"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
---@type LazyVimConfig
|
---@class LazyVimConfig: LazyVimOptions
|
||||||
local M = {}
|
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 = {
|
local defaults = {
|
||||||
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
|
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
|
||||||
---@type string|fun()
|
---@type string|fun()
|
||||||
@ -19,6 +21,9 @@ local defaults = {
|
|||||||
},
|
},
|
||||||
-- icons used by other plugins
|
-- icons used by other plugins
|
||||||
icons = {
|
icons = {
|
||||||
|
misc = {
|
||||||
|
dots = "",
|
||||||
|
},
|
||||||
dap = {
|
dap = {
|
||||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||||
Breakpoint = " ",
|
Breakpoint = " ",
|
||||||
@ -41,10 +46,11 @@ local defaults = {
|
|||||||
Array = " ",
|
Array = " ",
|
||||||
Boolean = " ",
|
Boolean = " ",
|
||||||
Class = " ",
|
Class = " ",
|
||||||
|
Codeium = " ",
|
||||||
Color = " ",
|
Color = " ",
|
||||||
Constant = " ",
|
Constant = " ",
|
||||||
Constructor = " ",
|
Constructor = " ",
|
||||||
Copilot = " ",
|
Copilot = " ",
|
||||||
Enum = " ",
|
Enum = " ",
|
||||||
EnumMember = " ",
|
EnumMember = " ",
|
||||||
Event = " ",
|
Event = " ",
|
||||||
@ -79,39 +85,79 @@ local defaults = {
|
|||||||
|
|
||||||
M.renames = {
|
M.renames = {
|
||||||
["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre",
|
["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
|
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)
|
function M.setup(opts)
|
||||||
options = vim.tbl_deep_extend("force", defaults, opts or {})
|
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
|
||||||
if not M.has() then
|
|
||||||
require("lazy.core.util").error(
|
if vim.fn.has("nvim-0.9.0") == 0 then
|
||||||
"**LazyVim** needs **lazy.nvim** version "
|
M.msg({
|
||||||
.. M.lazy_version
|
{
|
||||||
.. " to work properly.\n"
|
"LazyVim requires Neovim >= 0.9.0\n",
|
||||||
.. "Please upgrade **lazy.nvim**",
|
"ErrorMsg",
|
||||||
{ title = "LazyVim" }
|
},
|
||||||
)
|
{ "Press any key to exit", "MoreMsg" },
|
||||||
error("Exiting")
|
})
|
||||||
|
vim.cmd([[quit]])
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.fn.argc(-1) == 0 then
|
if not M.has() then
|
||||||
-- autocmds and keymaps can wait to load
|
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", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
pattern = "LazyVimStarted",
|
||||||
pattern = "VeryLazy",
|
|
||||||
callback = function()
|
callback = function()
|
||||||
M.load("autocmds")
|
require("lazy").update({ plugins = { "lazy.nvim" }, wait = true })
|
||||||
M.load("keymaps")
|
M.msg({
|
||||||
|
{
|
||||||
|
"**lazy.nvim** has been upgraded.\nPlease restart **Neovim**",
|
||||||
|
"WarningMsg",
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
else
|
end
|
||||||
-- load them now so they affect the opened buffers
|
|
||||||
|
-- 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")
|
M.load("autocmds")
|
||||||
M.load("keymaps")
|
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
|
end
|
||||||
|
|
||||||
require("lazy.core.util").try(function()
|
require("lazy.core.util").try(function()
|
||||||
@ -129,6 +175,59 @@ function M.setup(opts)
|
|||||||
})
|
})
|
||||||
end
|
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")
|
||||||
|
local Util = require("lazy.core.util")
|
||||||
|
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
|
---@param range? string
|
||||||
function M.has(range)
|
function M.has(range)
|
||||||
local Semver = require("lazy.manage.semver")
|
local Semver = require("lazy.manage.semver")
|
||||||
@ -161,12 +260,23 @@ function M.load(name)
|
|||||||
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||||
vim.cmd([[do VimResized]])
|
vim.cmd([[do VimResized]])
|
||||||
end
|
end
|
||||||
|
local pattern = "LazyVim" .. name:sub(1, 1):upper() .. name:sub(2)
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
M.did_init = false
|
M.did_init = false
|
||||||
function M.init()
|
function M.init()
|
||||||
if not M.did_init then
|
if not M.did_init then
|
||||||
M.did_init = true
|
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
|
-- delay notifications till vim.notify was replaced or after 500ms
|
||||||
require("lazyvim.util").lazy_notify()
|
require("lazyvim.util").lazy_notify()
|
||||||
|
|
||||||
@ -176,12 +286,45 @@ function M.init()
|
|||||||
require("lazyvim.config").load("options")
|
require("lazyvim.config").load("options")
|
||||||
local Plugin = require("lazy.core.plugin")
|
local Plugin = require("lazy.core.plugin")
|
||||||
local add = Plugin.Spec.add
|
local add = Plugin.Spec.add
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
Plugin.Spec.add = function(self, plugin, ...)
|
Plugin.Spec.add = function(self, plugin, ...)
|
||||||
if type(plugin) == "table" and M.renames[plugin[1]] then
|
if type(plugin) == "table" then
|
||||||
plugin[1] = M.renames[plugin[1]]
|
if M.renames[plugin[1]] then
|
||||||
|
require("lazy.core.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
|
end
|
||||||
return add(self, plugin, ...)
|
return add(self, plugin, ...)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
-- This file is automatically loaded by lazyvim.plugins.config
|
-- This file is automatically loaded by lazyvim.config.init
|
||||||
|
|
||||||
local Util = require("lazyvim.util")
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
-- DO NOT USE THIS IN YOU OWN CONFIG!!
|
||||||
local keys = require("lazy.core.handler").handlers.keys
|
-- use `vim.keymap.set` instead
|
||||||
---@cast keys LazyKeysHandler
|
local map = Util.safe_keymap_set
|
||||||
-- 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
|
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- better up/down
|
-- better up/down
|
||||||
map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
|
||||||
-- Move to window using the <ctrl> hjkl keys
|
-- Move to window using the <ctrl> hjkl keys
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window" })
|
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window" })
|
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
||||||
|
|
||||||
-- Resize window using <ctrl> arrow keys
|
-- Resize window using <ctrl> arrow keys
|
||||||
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
||||||
@ -64,8 +56,6 @@ map(
|
|||||||
{ desc = "Redraw / clear hlsearch / diff update" }
|
{ 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
|
-- 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("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||||
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||||
@ -80,14 +70,17 @@ map("i", ".", ".<c-g>u")
|
|||||||
map("i", ";", ";<c-g>u")
|
map("i", ";", ";<c-g>u")
|
||||||
|
|
||||||
-- save file
|
-- 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" })
|
||||||
|
|
||||||
-- better indenting
|
-- better indenting
|
||||||
map("v", "<", "<gv")
|
map("v", "<", "<gv")
|
||||||
map("v", ">", ">gv")
|
map("v", ">", ">gv")
|
||||||
|
|
||||||
-- lazy
|
-- lazy
|
||||||
map("n", "<leader>l", "<cmd>:Lazy<cr>", { desc = "Lazy" })
|
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
|
||||||
|
|
||||||
-- new file
|
-- new file
|
||||||
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
|
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
|
||||||
@ -100,41 +93,62 @@ if not Util.has("trouble.nvim") then
|
|||||||
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- formatting
|
||||||
|
map({ "n", "v" }, "<leader>cf", function()
|
||||||
|
require("lazyvim.plugins.lsp.format").format({ force = true })
|
||||||
|
end, { desc = "Format" })
|
||||||
|
|
||||||
-- stylua: ignore start
|
-- stylua: ignore start
|
||||||
|
|
||||||
-- toggle options
|
-- toggle options
|
||||||
map("n", "<leader>uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
|
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>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>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||||
map("n", "<leader>ul", function() Util.toggle("relativenumber", true) Util.toggle("number") end, { desc = "Toggle Line Numbers" })
|
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" })
|
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
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" })
|
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||||
|
if vim.lsp.inlay_hint then
|
||||||
|
map("n", "<leader>uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||||
|
end
|
||||||
|
|
||||||
-- lazygit
|
-- lazygit
|
||||||
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" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||||
map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = false}) end, { desc = "Lazygit (cwd)" })
|
map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||||
|
|
||||||
-- quit
|
-- quit
|
||||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||||
|
|
||||||
-- highlights under cursor
|
-- highlights under cursor
|
||||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
|
||||||
end
|
-- LazyVim Changelog
|
||||||
|
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||||
|
|
||||||
-- floating terminal
|
-- floating terminal
|
||||||
map("n", "<leader>ft", function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = "Terminal (root dir)" })
|
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
|
||||||
|
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||||
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
|
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
|
||||||
|
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
|
||||||
|
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })
|
||||||
|
|
||||||
|
-- Terminal Mappings
|
||||||
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
||||||
|
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" })
|
||||||
|
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" })
|
||||||
|
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" })
|
||||||
|
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" })
|
||||||
|
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
|
||||||
|
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
|
||||||
|
|
||||||
-- windows
|
-- windows
|
||||||
map("n", "<leader>ww", "<C-W>p", { desc = "Other window" })
|
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
|
||||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window" })
|
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
|
||||||
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below" })
|
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right" })
|
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
map("n", "<leader>-", "<C-W>s", { desc = "Split window below" })
|
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
map("n", "<leader>|", "<C-W>v", { desc = "Split window right" })
|
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
|
|
||||||
-- tabs
|
-- tabs
|
||||||
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- This file is automatically loaded by plugins.config
|
-- This file is automatically loaded by plugins.core
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ opt.grepformat = "%f:%l:%c:%m"
|
|||||||
opt.grepprg = "rg --vimgrep"
|
opt.grepprg = "rg --vimgrep"
|
||||||
opt.ignorecase = true -- Ignore case
|
opt.ignorecase = true -- Ignore case
|
||||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||||
opt.laststatus = 0
|
opt.laststatus = 3 -- global statusline
|
||||||
opt.list = true -- Show some invisible characters (tabs...
|
opt.list = true -- Show some invisible characters (tabs...
|
||||||
opt.mouse = "a" -- Enable mouse mode
|
opt.mouse = "a" -- Enable mouse mode
|
||||||
opt.number = true -- Print line number
|
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.pumheight = 10 -- Maximum number of entries in a popup
|
||||||
opt.relativenumber = true -- Relative line numbers
|
opt.relativenumber = true -- Relative line numbers
|
||||||
opt.scrolloff = 4 -- Lines of context
|
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.shiftround = true -- Round indent
|
||||||
opt.shiftwidth = 2 -- Size of an 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.showmode = false -- Dont show mode since we have a statusline
|
||||||
opt.sidescrolloff = 8 -- Columns of context
|
opt.sidescrolloff = 8 -- Columns of context
|
||||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
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.smartindent = true -- Insert indents automatically
|
||||||
opt.spelllang = { "en" }
|
opt.spelllang = { "en" }
|
||||||
opt.splitbelow = true -- Put new windows below current
|
opt.splitbelow = true -- Put new windows below current
|
||||||
|
opt.splitkeep = "screen"
|
||||||
opt.splitright = true -- Put new windows right of current
|
opt.splitright = true -- Put new windows right of current
|
||||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||||
opt.termguicolors = true -- True color support
|
opt.termguicolors = true -- True color support
|
||||||
@ -45,10 +46,34 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
|||||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||||
opt.winminwidth = 5 -- Minimum window width
|
opt.winminwidth = 5 -- Minimum window width
|
||||||
opt.wrap = false -- Disable line wrap
|
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
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||||
opt.splitkeep = "screen"
|
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||||
opt.shortmess:append({ C = true })
|
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
|
end
|
||||||
|
|
||||||
-- Fix markdown indentation settings
|
-- Fix markdown indentation settings
|
||||||
|
@ -8,10 +8,10 @@ local error = vim.health.error or vim.health.report_error
|
|||||||
function M.check()
|
function M.check()
|
||||||
start("LazyVim")
|
start("LazyVim")
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.8.0") == 1 then
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||||
ok("Using Neovim >= 0.8.0")
|
ok("Using Neovim >= 0.9.0")
|
||||||
else
|
else
|
||||||
error("Neovim >= 0.8.0 is required")
|
error("Neovim >= 0.9.0 is required")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
||||||
|
@ -4,7 +4,7 @@ return {
|
|||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
build = (not jit.os:find("Windows"))
|
build = (not jit.os:find("Windows"))
|
||||||
and "echo -e 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp"
|
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
|
||||||
or nil,
|
or nil,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
@ -42,7 +42,9 @@ return {
|
|||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
},
|
},
|
||||||
opts = function()
|
opts = function()
|
||||||
|
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
local defaults = require("cmp.config.default")()
|
||||||
return {
|
return {
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noinsert",
|
completeopt = "menu,menuone,noinsert",
|
||||||
@ -65,12 +67,12 @@ return {
|
|||||||
select = true,
|
select = true,
|
||||||
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp", group_index = 1 },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip", group_index = 1 },
|
||||||
{ name = "buffer" },
|
{ name = "buffer", group_index = 2 },
|
||||||
{ name = "path" },
|
{ name = "path", group_index = 2 },
|
||||||
}),
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(_, item)
|
format = function(_, item)
|
||||||
local icons = require("lazyvim.config").icons.kinds
|
local icons = require("lazyvim.config").icons.kinds
|
||||||
@ -82,9 +84,10 @@ return {
|
|||||||
},
|
},
|
||||||
experimental = {
|
experimental = {
|
||||||
ghost_text = {
|
ghost_text = {
|
||||||
hl_group = "LspCodeLens",
|
hl_group = "CmpGhostText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
sorting = defaults.sorting,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -93,12 +96,28 @@ return {
|
|||||||
{
|
{
|
||||||
"echasnovski/mini.pairs",
|
"echasnovski/mini.pairs",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
config = function(_, opts)
|
opts = {},
|
||||||
require("mini.pairs").setup(opts)
|
keys = {
|
||||||
end,
|
{
|
||||||
|
"<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",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- surround
|
-- Fast and feature-rich surround actions. For text that includes
|
||||||
|
-- surrounding characters like brackets or quotes, this allows you
|
||||||
|
-- to select the text inside, change or modify the surrounding characters,
|
||||||
|
-- and more.
|
||||||
{
|
{
|
||||||
"echasnovski/mini.surround",
|
"echasnovski/mini.surround",
|
||||||
keys = function(_, keys)
|
keys = function(_, keys)
|
||||||
@ -121,30 +140,38 @@ return {
|
|||||||
end,
|
end,
|
||||||
opts = {
|
opts = {
|
||||||
mappings = {
|
mappings = {
|
||||||
add = "gza", -- Add surrounding in Normal and Visual modes
|
add = "gsa", -- Add surrounding in Normal and Visual modes
|
||||||
delete = "gzd", -- Delete surrounding
|
delete = "gsd", -- Delete surrounding
|
||||||
find = "gzf", -- Find surrounding (to the right)
|
find = "gsf", -- Find surrounding (to the right)
|
||||||
find_left = "gzF", -- Find surrounding (to the left)
|
find_left = "gsF", -- Find surrounding (to the left)
|
||||||
highlight = "gzh", -- Highlight surrounding
|
highlight = "gsh", -- Highlight surrounding
|
||||||
replace = "gzr", -- Replace surrounding
|
replace = "gsr", -- Replace surrounding
|
||||||
update_n_lines = "gzn", -- Update `n_lines`
|
update_n_lines = "gsn", -- Update `n_lines`
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
|
||||||
-- use gz mappings instead of s to prevent conflict with leap
|
|
||||||
require("mini.surround").setup(opts)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- comments
|
-- comments
|
||||||
|
{
|
||||||
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||||
|
lazy = true,
|
||||||
|
opts = {
|
||||||
|
enable_autocmd = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"echasnovski/mini.comment",
|
"echasnovski/mini.comment",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {},
|
opts = {
|
||||||
main = "mini.comment",
|
options = {
|
||||||
|
custom_commentstring = function()
|
||||||
|
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- better text-objects
|
-- Better text-objects
|
||||||
{
|
{
|
||||||
"echasnovski/mini.ai",
|
"echasnovski/mini.ai",
|
||||||
-- keys = {
|
-- keys = {
|
||||||
@ -152,7 +179,6 @@ return {
|
|||||||
-- { "i", mode = { "x", "o" } },
|
-- { "i", mode = { "x", "o" } },
|
||||||
-- },
|
-- },
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
dependencies = { "nvim-treesitter-textobjects" },
|
|
||||||
opts = function()
|
opts = function()
|
||||||
local ai = require("mini.ai")
|
local ai = require("mini.ai")
|
||||||
return {
|
return {
|
||||||
@ -164,13 +190,14 @@ return {
|
|||||||
}, {}),
|
}, {}),
|
||||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
||||||
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
||||||
|
t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("mini.ai").setup(opts)
|
require("mini.ai").setup(opts)
|
||||||
-- register all text objects with which-key
|
-- register all text objects with which-key
|
||||||
if require("lazyvim.util").has("which-key.nvim") then
|
require("lazyvim.util").on_load("which-key.nvim", function()
|
||||||
---@type table<string, string|table>
|
---@type table<string, string|table>
|
||||||
local i = {
|
local i = {
|
||||||
[" "] = "Whitespace",
|
[" "] = "Whitespace",
|
||||||
@ -211,7 +238,7 @@ return {
|
|||||||
i = i,
|
i = i,
|
||||||
a = a,
|
a = a,
|
||||||
})
|
})
|
||||||
end
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,36 @@ return {
|
|||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
name = "catppuccin",
|
name = "catppuccin",
|
||||||
|
opts = {
|
||||||
|
integrations = {
|
||||||
|
alpha = true,
|
||||||
|
cmp = true,
|
||||||
|
flash = true,
|
||||||
|
gitsigns = true,
|
||||||
|
illuminate = true,
|
||||||
|
indent_blankline = { enabled = true },
|
||||||
|
lsp_trouble = true,
|
||||||
|
mason = true,
|
||||||
|
mini = true,
|
||||||
|
native_lsp = {
|
||||||
|
enabled = true,
|
||||||
|
underlines = {
|
||||||
|
errors = { "undercurl" },
|
||||||
|
hints = { "undercurl" },
|
||||||
|
warnings = { "undercurl" },
|
||||||
|
information = { "undercurl" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
navic = { enabled = true, custom_bg = "lualine" },
|
||||||
|
neotest = true,
|
||||||
|
noice = true,
|
||||||
|
notify = true,
|
||||||
|
neotree = true,
|
||||||
|
semantic_tokens = true,
|
||||||
|
telescope = true,
|
||||||
|
treesitter = true,
|
||||||
|
which_key = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
24
lua/lazyvim/plugins/extras/coding/codeium.lua
Normal file
24
lua/lazyvim/plugins/extras/coding/codeium.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
-- codeium
|
||||||
|
{
|
||||||
|
"Exafunction/codeium.nvim",
|
||||||
|
cmd = "Codeium",
|
||||||
|
build = ":Codeium Auth",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
-- codeium cmp source
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"Exafunction/codeium.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sources, 1, { name = "codeium", group_index = 1 })
|
||||||
|
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -8,10 +8,15 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
suggestion = { enabled = false },
|
suggestion = { enabled = false },
|
||||||
panel = { enabled = false },
|
panel = { enabled = false },
|
||||||
|
filetypes = {
|
||||||
|
markdown = true,
|
||||||
|
help = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local Util = require("lazyvim.util")
|
local Util = require("lazyvim.util")
|
||||||
@ -32,6 +37,9 @@ return {
|
|||||||
return ok and #clients > 0
|
return ok and #clients > 0
|
||||||
end,
|
end,
|
||||||
color = function()
|
color = function()
|
||||||
|
if not package.loaded["copilot"] then
|
||||||
|
return
|
||||||
|
end
|
||||||
local status = require("copilot.api").status.data
|
local status = require("copilot.api").status.data
|
||||||
return colors[status.status] or colors[""]
|
return colors[status.status] or colors[""]
|
||||||
end,
|
end,
|
||||||
@ -62,28 +70,9 @@ return {
|
|||||||
},
|
},
|
||||||
---@param opts cmp.ConfigSchema
|
---@param opts cmp.ConfigSchema
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local cmp = require("cmp")
|
table.insert(opts.sources, 1, { name = "copilot", group_index = 1 })
|
||||||
|
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
|
||||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize)
|
||||||
|
|
||||||
opts.sorting = {
|
|
||||||
priority_weight = 2,
|
|
||||||
comparators = {
|
|
||||||
require("copilot_cmp.comparators").prioritize,
|
|
||||||
|
|
||||||
-- Below is the default comparitor list and order for nvim-cmp
|
|
||||||
cmp.config.compare.offset,
|
|
||||||
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
|
||||||
cmp.config.compare.exact,
|
|
||||||
cmp.config.compare.score,
|
|
||||||
cmp.config.compare.recently_used,
|
|
||||||
cmp.config.compare.locality,
|
|
||||||
cmp.config.compare.kind,
|
|
||||||
cmp.config.compare.sort_text,
|
|
||||||
cmp.config.compare.length,
|
|
||||||
cmp.config.compare.order,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
32
lua/lazyvim/plugins/extras/coding/yanky.lua
Normal file
32
lua/lazyvim/plugins/extras/coding/yanky.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
return {
|
||||||
|
-- better yank/paste
|
||||||
|
{
|
||||||
|
"gbprod/yanky.nvim",
|
||||||
|
dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } },
|
||||||
|
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" },
|
||||||
|
{ "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" },
|
||||||
|
{ "[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)" },
|
||||||
|
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||||
|
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||||
|
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||||
|
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||||
|
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||||
|
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -13,6 +13,8 @@ return {
|
|||||||
},
|
},
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
-- setup dap config by VsCode launch.json file
|
||||||
|
-- require("dap.ext.vscode").load_launchjs()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
dapui.setup(opts)
|
dapui.setup(opts)
|
||||||
@ -37,6 +39,7 @@ return {
|
|||||||
-- which key integration
|
-- which key integration
|
||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
|
optional = true,
|
||||||
opts = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
["<leader>d"] = { name = "+debug" },
|
["<leader>d"] = { name = "+debug" },
|
||||||
@ -53,7 +56,7 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
-- Makes a best effort to setup the various debuggers with
|
-- Makes a best effort to setup the various debuggers with
|
||||||
-- reasonable debug configurations
|
-- reasonable debug configurations
|
||||||
automatic_setup = true,
|
automatic_installation = true,
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
-- You can provide additional configuration to the handlers,
|
||||||
-- see mason-nvim-dap README for more information
|
-- see mason-nvim-dap README for more information
|
||||||
|
@ -6,8 +6,8 @@ return {
|
|||||||
"jbyuki/one-small-step-for-vimkind",
|
"jbyuki/one-small-step-for-vimkind",
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" },
|
{ "<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" },
|
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
56
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
56
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
return {
|
||||||
|
-- disable flash
|
||||||
|
{ "folke/flash.nvim", enabled = false, optional = true },
|
||||||
|
|
||||||
|
-- easily jump to any location and enhanced f/t motions for Leap
|
||||||
|
{
|
||||||
|
"ggandor/flit.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = function()
|
||||||
|
---@type LazyKeys[]
|
||||||
|
local ret = {}
|
||||||
|
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
||||||
|
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end,
|
||||||
|
opts = { labeled_modes = "nx" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ggandor/leap.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = {
|
||||||
|
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
||||||
|
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
||||||
|
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local leap = require("leap")
|
||||||
|
for k, v in pairs(opts) do
|
||||||
|
leap.opts[k] = v
|
||||||
|
end
|
||||||
|
leap.add_default_mappings(true)
|
||||||
|
vim.keymap.del({ "x", "o" }, "x")
|
||||||
|
vim.keymap.del({ "x", "o" }, "X")
|
||||||
|
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" },
|
||||||
|
}
|
64
lua/lazyvim/plugins/extras/editor/mini-files.lua
Normal file
64
lua/lazyvim/plugins/extras/editor/mini-files.lua
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
return {
|
||||||
|
"echasnovski/mini.files",
|
||||||
|
opts = {
|
||||||
|
windows = {
|
||||||
|
preview = true,
|
||||||
|
width_focus = 30,
|
||||||
|
width_preview = 30,
|
||||||
|
},
|
||||||
|
options = {
|
||||||
|
-- Whether to use for editing directories
|
||||||
|
-- Disabled by default in LazyVim because neo-tree is used for that
|
||||||
|
use_as_default_explorer = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fm",
|
||||||
|
function()
|
||||||
|
require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
|
||||||
|
end,
|
||||||
|
desc = "Open mini.files (directory of current file)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fM",
|
||||||
|
function()
|
||||||
|
require("mini.files").open(vim.loop.cwd(), true)
|
||||||
|
end,
|
||||||
|
desc = "Open mini.files (cwd)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.files").setup(opts)
|
||||||
|
|
||||||
|
local show_dotfiles = true
|
||||||
|
local filter_show = function(fs_entry)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local filter_hide = function(fs_entry)
|
||||||
|
return not vim.startswith(fs_entry.name, ".")
|
||||||
|
end
|
||||||
|
|
||||||
|
local toggle_dotfiles = function()
|
||||||
|
show_dotfiles = not show_dotfiles
|
||||||
|
local new_filter = show_dotfiles and filter_show or filter_hide
|
||||||
|
require("mini.files").refresh({ content = { filter = new_filter } })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesBufferCreate",
|
||||||
|
callback = function(args)
|
||||||
|
local buf_id = args.data.buf_id
|
||||||
|
-- Tweak left-hand side of mapping to your liking
|
||||||
|
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,
|
||||||
|
}
|
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,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local nls = require("null-ls")
|
local nls = require("null-ls")
|
||||||
table.insert(opts.sources, nls.builtins.formatting.prettierd)
|
table.insert(opts.sources, nls.builtins.formatting.prettierd)
|
||||||
end,
|
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" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
154
lua/lazyvim/plugins/extras/lang/clangd.lua
Normal file
154
lua/lazyvim/plugins/extras/lang/clangd.lua
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
-- Add C/C++ to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "c", "cpp" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"p00f/clangd_extensions.nvim",
|
||||||
|
lazy = true,
|
||||||
|
config = function() end,
|
||||||
|
opts = {
|
||||||
|
inlay_hints = {
|
||||||
|
inline = false,
|
||||||
|
},
|
||||||
|
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 = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Correctly setup lspconfig for clangd 🚀
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
-- Ensure mason installs the server
|
||||||
|
clangd = {
|
||||||
|
keys = {
|
||||||
|
{ "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
||||||
|
},
|
||||||
|
root_dir = function(fname)
|
||||||
|
return require("lspconfig.util").root_pattern(
|
||||||
|
"Makefile",
|
||||||
|
"configure.ac",
|
||||||
|
"configure.in",
|
||||||
|
"config.h.in",
|
||||||
|
"meson.build",
|
||||||
|
"meson_options.txt",
|
||||||
|
"build.ninja"
|
||||||
|
)(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")(
|
||||||
|
fname
|
||||||
|
) or require("lspconfig.util").find_git_ancestor(fname)
|
||||||
|
end,
|
||||||
|
capabilities = {
|
||||||
|
offsetEncoding = { "utf-16" },
|
||||||
|
},
|
||||||
|
cmd = {
|
||||||
|
"clangd",
|
||||||
|
"--background-index",
|
||||||
|
"--clang-tidy",
|
||||||
|
"--header-insertion=iwyu",
|
||||||
|
"--completion-style=detailed",
|
||||||
|
"--function-arg-placeholders",
|
||||||
|
"--fallback-style=llvm",
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
clangdFileStatus = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
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 false
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores"))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
-- Ensure C/C++ debugger is installed
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
if not dap.adapters["codelldb"] then
|
||||||
|
require("dap").adapters["codelldb"] = {
|
||||||
|
type = "server",
|
||||||
|
host = "localhost",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = "codelldb",
|
||||||
|
args = {
|
||||||
|
"--port",
|
||||||
|
"${port}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
for _, lang in ipairs({ "c", "cpp" }) do
|
||||||
|
dap.configurations[lang] = {
|
||||||
|
{
|
||||||
|
type = "codelldb",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch file",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "codelldb",
|
||||||
|
request = "attach",
|
||||||
|
name = "Attach to process",
|
||||||
|
processId = require("dap.utils").pick_process,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
50
lua/lazyvim/plugins/extras/lang/cmake.lua
Normal file
50
lua/lazyvim/plugins/extras/lang/cmake.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "cmake" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
vim.list_extend(opts.sources, {
|
||||||
|
nls.builtins.diagnostics.cmake_lint,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
cmake = { "cmakelint" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "cmakelang" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
neocmake = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Civitasv/cmake-tools.nvim",
|
||||||
|
opts = {},
|
||||||
|
event = "LazyFile",
|
||||||
|
},
|
||||||
|
}
|
46
lua/lazyvim/plugins/extras/lang/docker.lua
Normal file
46
lua/lazyvim/plugins/extras/lang/docker.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "dockerfile" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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 {}
|
||||||
|
vim.list_extend(opts.sources, {
|
||||||
|
nls.builtins.diagnostics.hadolint,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
dockerfile = { "hadolint" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
dockerls = {},
|
||||||
|
docker_compose_language_service = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
58
lua/lazyvim/plugins/extras/lang/elixir.lua
Normal file
58
lua/lazyvim/plugins/extras/lang/elixir.lua
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"elixir",
|
||||||
|
"heex",
|
||||||
|
"eex",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"elixir-ls",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"jfpedroza/neotest-elixir",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-elixir"] = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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,
|
||||||
|
},
|
||||||
|
}
|
140
lua/lazyvim/plugins/extras/lang/go.lua
Normal file
140
lua/lazyvim/plugins/extras/lang/go.lua
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"go",
|
||||||
|
"gomod",
|
||||||
|
"gowork",
|
||||||
|
"gosum",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
gopls = {
|
||||||
|
keys = {
|
||||||
|
-- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12
|
||||||
|
{ "<leader>td", "<cmd>lua require('dap-go').debug_test()<CR>", desc = "Debug Nearest (Go)" },
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
gofumpt = true,
|
||||||
|
codelenses = {
|
||||||
|
gc_details = false,
|
||||||
|
generate = true,
|
||||||
|
regenerate_cgo = true,
|
||||||
|
run_govulncheck = true,
|
||||||
|
test = true,
|
||||||
|
tidy = true,
|
||||||
|
upgrade_dependency = true,
|
||||||
|
vendor = true,
|
||||||
|
},
|
||||||
|
hints = {
|
||||||
|
assignVariableTypes = true,
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
compositeLiteralTypes = true,
|
||||||
|
constantValues = true,
|
||||||
|
functionTypeParameters = true,
|
||||||
|
parameterNames = true,
|
||||||
|
rangeVariableTypes = true,
|
||||||
|
},
|
||||||
|
analyses = {
|
||||||
|
fieldalignment = true,
|
||||||
|
nilness = true,
|
||||||
|
unusedparams = true,
|
||||||
|
unusedwrite = true,
|
||||||
|
useany = true,
|
||||||
|
},
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
staticcheck = true,
|
||||||
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
|
semanticTokens = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
gopls = function(_, opts)
|
||||||
|
-- workaround for gopls not supporting semanticTokensProvider
|
||||||
|
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||||
|
require("lazyvim.util").on_attach(function(client, _)
|
||||||
|
if client.name == "gopls" then
|
||||||
|
if not client.server_capabilities.semanticTokensProvider then
|
||||||
|
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||||
|
client.server_capabilities.semanticTokensProvider = {
|
||||||
|
full = true,
|
||||||
|
legend = {
|
||||||
|
tokenTypes = semantic.tokenTypes,
|
||||||
|
tokenModifiers = semantic.tokenModifiers,
|
||||||
|
},
|
||||||
|
range = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- end workaround
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Ensure Go tools are installed
|
||||||
|
{
|
||||||
|
"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.goimports,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
go = { "goimports" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-neotest/neotest-go",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-go"] = {
|
||||||
|
-- Here we can set options for neotest-go, e.g.
|
||||||
|
-- args = { "-tags=integration" }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
227
lua/lazyvim/plugins/extras/lang/java.lua
Normal file
227
lua/lazyvim/plugins/extras/lang/java.lua
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
-- This is the same as in lspconfig.server_configurations.jdtls, but avoids
|
||||||
|
-- needing to require that when this module loads.
|
||||||
|
local java_filetypes = { "java" }
|
||||||
|
|
||||||
|
-- Utility function to extend or override a config table, similar to the way
|
||||||
|
-- that Plugin.opts works.
|
||||||
|
---@param config table
|
||||||
|
---@param custom function | table | nil
|
||||||
|
local function extend_or_override(config, custom, ...)
|
||||||
|
if type(custom) == "function" then
|
||||||
|
config = custom(config, ...) or config
|
||||||
|
elseif custom then
|
||||||
|
config = vim.tbl_deep_extend("force", config, custom) --[[@as table]]
|
||||||
|
end
|
||||||
|
return config
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Add java to treesitter.
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "java" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Ensure java debugger and test packages are installed.
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Configure nvim-lspconfig to install the server automatically via mason, but
|
||||||
|
-- defer actually starting it to our configuration of nvim-jtdls below.
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
-- make sure mason installs the server
|
||||||
|
servers = {
|
||||||
|
jdtls = {},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
jdtls = function()
|
||||||
|
return true -- avoid duplicate servers
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Set up nvim-jdtls to attach to java files.
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
dependencies = { "folke/which-key.nvim" },
|
||||||
|
ft = java_filetypes,
|
||||||
|
opts = function()
|
||||||
|
return {
|
||||||
|
-- How to find the root dir for a given filename. The default comes from
|
||||||
|
-- lspconfig which provides a function specifically for java projects.
|
||||||
|
root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir,
|
||||||
|
|
||||||
|
-- How to find the project name for a given root dir.
|
||||||
|
project_name = function(root_dir)
|
||||||
|
return root_dir and vim.fs.basename(root_dir)
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Where are the config and workspace dirs for a project?
|
||||||
|
jdtls_config_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
|
||||||
|
end,
|
||||||
|
jdtls_workspace_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- How to run jdtls. This can be overridden to a full java command-line
|
||||||
|
-- if the Python wrapper script doesn't suffice.
|
||||||
|
cmd = { "jdtls" },
|
||||||
|
full_cmd = function(opts)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
local root_dir = opts.root_dir(fname)
|
||||||
|
local project_name = opts.project_name(root_dir)
|
||||||
|
local cmd = vim.deepcopy(opts.cmd)
|
||||||
|
if project_name then
|
||||||
|
vim.list_extend(cmd, {
|
||||||
|
"-configuration",
|
||||||
|
opts.jdtls_config_dir(project_name),
|
||||||
|
"-data",
|
||||||
|
opts.jdtls_workspace_dir(project_name),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return cmd
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||||
|
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||||
|
test = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
local opts = Util.opts("nvim-jdtls") or {}
|
||||||
|
|
||||||
|
-- Find the extra bundles that should be passed on the jdtls command-line
|
||||||
|
-- if nvim-dap is enabled with java debug/test.
|
||||||
|
local mason_registry = require("mason-registry")
|
||||||
|
local bundles = {} ---@type string[]
|
||||||
|
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
|
||||||
|
local java_dbg_path = java_dbg_pkg:get_install_path()
|
||||||
|
local jar_patterns = {
|
||||||
|
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
|
||||||
|
}
|
||||||
|
-- java-test also depends on java-debug-adapter.
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
local java_test_pkg = mason_registry.get_package("java-test")
|
||||||
|
local java_test_path = java_test_pkg:get_install_path()
|
||||||
|
vim.list_extend(jar_patterns, {
|
||||||
|
java_test_path .. "/extension/server/*.jar",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
for _, jar_pattern in ipairs(jar_patterns) do
|
||||||
|
for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
|
||||||
|
table.insert(bundles, bundle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function attach_jdtls()
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
|
||||||
|
-- Configuration can be augmented and overridden by opts.jdtls
|
||||||
|
local config = extend_or_override({
|
||||||
|
cmd = opts.full_cmd(opts),
|
||||||
|
root_dir = opts.root_dir(fname),
|
||||||
|
init_options = {
|
||||||
|
bundles = bundles,
|
||||||
|
},
|
||||||
|
-- enable CMP capabilities
|
||||||
|
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||||
|
}, opts.jdtls)
|
||||||
|
|
||||||
|
-- Existing server will be reused if the root_dir matches.
|
||||||
|
require("jdtls").start_or_attach(config)
|
||||||
|
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Attach the jdtls for each java buffer. HOWEVER, this plugin loads
|
||||||
|
-- depending on filetype, so this autocmd doesn't run for the first file.
|
||||||
|
-- For that, we call directly below.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = java_filetypes,
|
||||||
|
callback = attach_jdtls,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Setup keymap and dap after the lsp is fully attached.
|
||||||
|
-- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
|
||||||
|
-- https://neovim.io/doc/user/lsp.html#LspAttach
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client and client.name == "jdtls" then
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.register({
|
||||||
|
["<leader>cx"] = { name = "+extract" },
|
||||||
|
["<leader>cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" },
|
||||||
|
["<leader>cxc"] = { require("jdtls").extract_constant, "Extract Constant" },
|
||||||
|
["gs"] = { require("jdtls").super_implementation, "Goto Super" },
|
||||||
|
["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" },
|
||||||
|
["<leader>co"] = { require("jdtls").organize_imports, "Organize Imports" },
|
||||||
|
}, { mode = "n", buffer = args.buf })
|
||||||
|
wk.register({
|
||||||
|
["<leader>c"] = { name = "+code" },
|
||||||
|
["<leader>cx"] = { name = "+extract" },
|
||||||
|
["<leader>cxm"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
|
||||||
|
"Extract Method",
|
||||||
|
},
|
||||||
|
["<leader>cxv"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_variable_all(true)<CR>]],
|
||||||
|
"Extract Variable",
|
||||||
|
},
|
||||||
|
["<leader>cxc"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_constant(true)<CR>]],
|
||||||
|
"Extract Constant",
|
||||||
|
},
|
||||||
|
}, { mode = "v", buffer = args.buf })
|
||||||
|
|
||||||
|
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
-- custom init for Java debugger
|
||||||
|
require("jdtls").setup_dap(opts.dap)
|
||||||
|
require("jdtls.dap").setup_dap_main_class_configs()
|
||||||
|
|
||||||
|
-- Java Test require Java debugger to work
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
-- custom keymaps for Java test runner (not yet compatible with neotest)
|
||||||
|
wk.register({
|
||||||
|
["<leader>t"] = { name = "+test" },
|
||||||
|
["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" },
|
||||||
|
["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" },
|
||||||
|
["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" },
|
||||||
|
}, { mode = "n", buffer = args.buf })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- User can set additional keymaps in opts.on_attach
|
||||||
|
if opts.on_attach then
|
||||||
|
opts.on_attach(args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Avoid race condition by calling attach the first time, since the autocmd won't fire.
|
||||||
|
attach_jdtls()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -10,13 +10,16 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- yaml schema support
|
||||||
|
{
|
||||||
|
"b0o/SchemaStore.nvim",
|
||||||
|
lazy = true,
|
||||||
|
version = false, -- last release is way too old
|
||||||
|
},
|
||||||
|
|
||||||
-- correctly setup lspconfig
|
-- correctly setup lspconfig
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
|
||||||
"b0o/SchemaStore.nvim",
|
|
||||||
version = false, -- last release is way too old
|
|
||||||
},
|
|
||||||
opts = {
|
opts = {
|
||||||
-- make sure mason installs the server
|
-- make sure mason installs the server
|
||||||
servers = {
|
servers = {
|
||||||
|
67
lua/lazyvim/plugins/extras/lang/omnisharp.lua
Normal file
67
lua/lazyvim/plugins/extras/lang/omnisharp.lua
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
return {
|
||||||
|
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "c_sharp" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
table.insert(opts.sources, nls.builtins.formatting.csharpier)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
cs = { "csharpier" },
|
||||||
|
},
|
||||||
|
formatters = {
|
||||||
|
csharpier = {
|
||||||
|
command = "dotnet-csharpier",
|
||||||
|
args = { "--write-stdout" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
table.insert(opts.ensure_installed, "csharpier")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
omnisharp = {
|
||||||
|
handlers = {
|
||||||
|
["textDocument/definition"] = function(...)
|
||||||
|
return require("omnisharp_extended").handler(...)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"gd",
|
||||||
|
function()
|
||||||
|
require("omnisharp_extended").telescope_lsp_definitions()
|
||||||
|
end,
|
||||||
|
desc = "Goto Definition",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
enable_roslyn_analyzers = true,
|
||||||
|
organize_imports_on_format = true,
|
||||||
|
enable_import_completion = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user