Compare commits
203 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
418
CHANGELOG.md
418
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** (用于部分克隆支持)
|
||||
- 一个 [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 June 30
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03
|
||||
|
||||
==============================================================================
|
||||
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>
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
-- This file is automatically loaded by lazyvim.config.init.
|
||||
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||
@ -22,7 +22,9 @@ 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,
|
||||
})
|
||||
|
||||
@ -38,7 +40,7 @@ vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
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
|
||||
pcall(vim.api.nvim_win_set_cursor, buf, mark)
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
end,
|
||||
})
|
||||
@ -53,6 +55,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
"man",
|
||||
"notify",
|
||||
"qf",
|
||||
"query",
|
||||
"spectre_panel",
|
||||
"startuptime",
|
||||
"tsplayground",
|
||||
|
@ -19,6 +19,9 @@ local defaults = {
|
||||
},
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
misc = {
|
||||
dots = "",
|
||||
},
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
@ -44,7 +47,7 @@ local defaults = {
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
@ -79,6 +82,8 @@ 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
|
||||
@ -87,6 +92,21 @@ local options
|
||||
---@param opts? LazyVimConfig
|
||||
function M.setup(opts)
|
||||
options = vim.tbl_deep_extend("force", defaults, opts or {})
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 0 then
|
||||
vim.api.nvim_echo({
|
||||
{
|
||||
"LazyVim requires Neovim >= 0.9.0\n",
|
||||
"ErrorMsg",
|
||||
},
|
||||
{ "Press any key to exit", "MoreMsg" },
|
||||
}, true, {})
|
||||
|
||||
vim.fn.getchar()
|
||||
vim.cmd([[quit]])
|
||||
return
|
||||
end
|
||||
|
||||
if not M.has() then
|
||||
require("lazy.core.util").error(
|
||||
"**LazyVim** needs **lazy.nvim** version "
|
||||
@ -98,22 +118,23 @@ function M.setup(opts)
|
||||
error("Exiting")
|
||||
end
|
||||
|
||||
if vim.fn.argc(-1) == 0 then
|
||||
-- autocmds and keymaps can wait to load
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
M.load("autocmds")
|
||||
M.load("keymaps")
|
||||
end,
|
||||
})
|
||||
else
|
||||
-- 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("keymaps")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
if lazy_autocmds then
|
||||
M.load("autocmds")
|
||||
end
|
||||
M.load("keymaps")
|
||||
end,
|
||||
})
|
||||
|
||||
require("lazy.core.util").try(function()
|
||||
if type(M.colorscheme) == "function" then
|
||||
M.colorscheme()
|
||||
@ -180,6 +201,14 @@ function M.init()
|
||||
local add = Plugin.Spec.add
|
||||
Plugin.Spec.add = function(self, plugin, ...)
|
||||
if type(plugin) == "table" and 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
|
||||
return add(self, plugin, ...)
|
||||
|
@ -66,8 +66,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 +80,10 @@ 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" })
|
||||
|
||||
-- better indenting
|
||||
map("v", "<", "<gv")
|
||||
@ -102,18 +103,24 @@ 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", 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" })
|
||||
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" })
|
||||
if vim.lsp.buf.inlay_hint then
|
||||
map("n", "<leader>uh", function() vim.lsp.buf.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||
if vim.lsp.inlay_hint then
|
||||
map("n", "<leader>uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||
end
|
||||
|
||||
-- lazygit
|
||||
@ -124,9 +131,10 @@ 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"})
|
||||
|
||||
-- floating terminal
|
||||
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- This file is automatically loaded by plugins.core
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
@ -27,7 +27,7 @@ opt.scrolloff = 4 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.shortmess:append({ W = true, I = true, c = true })
|
||||
opt.shortmess:append({ W = true, I = true, c = true, 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
|
||||
@ -45,10 +46,30 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
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.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||
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
|
||||
|
@ -97,9 +97,27 @@ 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",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- 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",
|
||||
keys = function(_, keys)
|
||||
@ -134,7 +152,13 @@ return {
|
||||
},
|
||||
|
||||
-- comments
|
||||
{ "JoosepAlviste/nvim-ts-context-commentstring", lazy = true },
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_autocmd = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.comment",
|
||||
event = "VeryLazy",
|
||||
@ -147,7 +171,7 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- better text-objects
|
||||
-- Better text-objects
|
||||
{
|
||||
"echasnovski/mini.ai",
|
||||
-- keys = {
|
||||
@ -167,13 +191,14 @@ 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,
|
||||
config = function(_, opts)
|
||||
require("mini.ai").setup(opts)
|
||||
-- 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>
|
||||
local i = {
|
||||
[" "] = "Whitespace",
|
||||
@ -214,7 +239,7 @@ return {
|
||||
i = i,
|
||||
a = a,
|
||||
})
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -16,10 +16,12 @@ return {
|
||||
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,
|
||||
@ -30,7 +32,7 @@ return {
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true },
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
|
@ -5,6 +5,7 @@ return {
|
||||
-- file explorer
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{
|
||||
@ -28,7 +29,6 @@ return {
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
vim.g.neo_tree_remove_legacy_commands = 1
|
||||
if vim.fn.argc() == 1 then
|
||||
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
if stat and stat.type == "directory" then
|
||||
@ -41,7 +41,7 @@ return {
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" },
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = true,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
@ -56,19 +56,19 @@ return {
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_empty = "",
|
||||
folder_empty_open = "",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
renamed = "",
|
||||
unstaged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
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",
|
||||
@ -92,10 +92,12 @@ 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
|
||||
keys = {
|
||||
@ -113,6 +115,7 @@ return {
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
|
||||
-- search
|
||||
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
|
||||
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
|
||||
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
|
||||
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||
@ -128,8 +131,10 @@ return {
|
||||
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
|
||||
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
|
||||
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
|
||||
{ "<leader>sw", Util.telescope("grep_string"), desc = "Word (root dir)" },
|
||||
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" },
|
||||
{ "<leader>sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" },
|
||||
{ "<leader>sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
|
||||
{ "<leader>sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" },
|
||||
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" },
|
||||
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
||||
{
|
||||
"<leader>ss",
|
||||
@ -145,6 +150,8 @@ return {
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol",
|
||||
@ -163,88 +170,110 @@ 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 = " ",
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- easily jump to any location and enhanced f/t motions for Leap
|
||||
-- Flash enhances the built-in search functionality by showing labels
|
||||
-- at the end of each match, letting you quickly jump to a specific
|
||||
-- location.
|
||||
{
|
||||
"ggandor/flit.nvim",
|
||||
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",
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
vscode = true,
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
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" },
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
local leap = require("leap")
|
||||
for k, v in pairs(opts) do
|
||||
leap.opts[k] = v
|
||||
},
|
||||
|
||||
-- Flash Telescope config
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if not require("lazyvim.util").has("flash.nvim") then
|
||||
return
|
||||
end
|
||||
leap.add_default_mappings(true)
|
||||
vim.keymap.del({ "x", "o" }, "x")
|
||||
vim.keymap.del({ "x", "o" }, "X")
|
||||
local function flash(prompt_bufnr)
|
||||
require("flash").jump({
|
||||
pattern = "^",
|
||||
label = { after = { 0, 0 } },
|
||||
search = {
|
||||
mode = "search",
|
||||
exclude = {
|
||||
function(win)
|
||||
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
||||
end,
|
||||
},
|
||||
},
|
||||
action = function(match)
|
||||
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
||||
picker:set_selection(match.pos[1] - 1)
|
||||
end,
|
||||
})
|
||||
end
|
||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
||||
mappings = { n = { s = flash }, i = { ["<c-s>"] = flash } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- which-key
|
||||
-- which-key helps you remember key bindings by showing a popup
|
||||
-- with the active keybindings of the command you started typing.
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
@ -276,7 +305,9 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- git signs
|
||||
-- git signs highlights text that has changed since the list
|
||||
-- git commit, and also lets you interactively stage & unstage
|
||||
-- hunks in a commit.
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
@ -313,7 +344,9 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- references
|
||||
-- Automatically highlights other instances of the word under your cursor.
|
||||
-- This works with LSP, Treesitter, and regexp matching to find the other
|
||||
-- instances.
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
@ -402,7 +435,8 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- todo comments
|
||||
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
||||
-- in your project and loads them into a browsable list.
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
cmd = { "TodoTrouble", "TodoTelescope" },
|
||||
|
@ -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" },
|
||||
|
@ -13,6 +13,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)
|
||||
|
@ -1,75 +0,0 @@
|
||||
return {
|
||||
{ "ggandor/leap.nvim", enabled = false },
|
||||
{ "ggandor/flit.nvim", enabled = false },
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
vscode = true,
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"s",
|
||||
mode = { "n", "x", "o" },
|
||||
function()
|
||||
require("flash").jump()
|
||||
end,
|
||||
desc = "Flash",
|
||||
},
|
||||
{
|
||||
"S",
|
||||
mode = { "n", "o", "x" },
|
||||
function()
|
||||
require("flash").treesitter()
|
||||
end,
|
||||
desc = "Flash Treesitter",
|
||||
},
|
||||
{
|
||||
"r",
|
||||
mode = "o",
|
||||
function()
|
||||
require("flash").remote()
|
||||
end,
|
||||
desc = "Remote Flash",
|
||||
},
|
||||
{
|
||||
"R",
|
||||
mode = { "o", "x" },
|
||||
function()
|
||||
require("flash").treesitter_search()
|
||||
end,
|
||||
desc = "Treesitter Search",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local function flash(prompt_bufnr)
|
||||
require("flash").jump({
|
||||
pattern = "^",
|
||||
highlight = { label = { after = { 0, 0 } } },
|
||||
search = {
|
||||
mode = "search",
|
||||
exclude = {
|
||||
function(win)
|
||||
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
||||
end,
|
||||
},
|
||||
},
|
||||
action = function(match)
|
||||
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
||||
picker:set_selection(match.pos[1] - 1)
|
||||
end,
|
||||
})
|
||||
end
|
||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
||||
mappings = {
|
||||
n = { s = flash },
|
||||
i = { ["<c-s>"] = flash },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
@ -0,0 +1,40 @@
|
||||
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,
|
||||
},
|
||||
|
||||
-- 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,
|
||||
}
|
||||
|
53
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
53
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
@ -0,0 +1,53 @@
|
||||
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 = {
|
||||
-- -- 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 f, o in pairs(opts.formatters) do
|
||||
local ok, formatter = pcall(require, "conform.formatters." .. f)
|
||||
opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o)
|
||||
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" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
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 = "BufRead",
|
||||
},
|
||||
}
|
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 = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -29,4 +29,24 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"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.credo,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
elixir = { "credo" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -15,16 +15,51 @@ return {
|
||||
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()
|
||||
-- workaround for gopls not supporting semantictokensprovider
|
||||
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
|
||||
@ -46,6 +81,30 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
-- 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,
|
||||
@ -54,9 +113,13 @@ return {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "delve")
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"leoluz/nvim-dap-go",
|
||||
config = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
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,
|
||||
},
|
||||
|
||||
-- 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 = {
|
||||
|
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
31
lua/lazyvim/plugins/extras/lang/python-semshi.lua
Normal file
31
lua/lazyvim/plugins/extras/lang/python-semshi.lua
Normal file
@ -0,0 +1,31 @@
|
||||
return {
|
||||
-- "numiras/semshi",
|
||||
"wookayin/semshi", -- use a maintained fork
|
||||
ft = "python",
|
||||
build = ":UpdateRemotePlugins",
|
||||
init = function()
|
||||
-- Disabled these features better provided by LSP or other more general plugins
|
||||
vim.g["semshi#error_sign"] = false
|
||||
vim.g["semshi#simplify_markup"] = false
|
||||
vim.g["semshi#mark_selected_nodes"] = false
|
||||
vim.g["semshi#update_delay_factor"] = 0.001
|
||||
|
||||
-- This autocmd must be defined in init to take effect
|
||||
vim.api.nvim_create_autocmd({ "VimEnter", "ColorScheme" }, {
|
||||
group = vim.api.nvim_create_augroup("SemanticHighlight", {}),
|
||||
callback = function()
|
||||
-- Only add style, inherit or link to the LSP's colors
|
||||
vim.cmd([[
|
||||
highlight! semshiGlobal gui=italic
|
||||
highlight! semshiImported gui=bold
|
||||
highlight! link semshiParameter @lsp.type.parameter
|
||||
highlight! link semshiParameterUnused DiagnosticUnnecessary
|
||||
highlight! link semshiBuiltin @function.builtin
|
||||
highlight! link semshiAttribute @attribute
|
||||
highlight! link semshiSelf @lsp.type.selfKeyword
|
||||
highlight! link semshiUnresolved @lsp.type.unresolvedReference
|
||||
]])
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
79
lua/lazyvim/plugins/extras/lang/python.lua
Normal file
79
lua/lazyvim/plugins/extras/lang/python.lua
Normal file
@ -0,0 +1,79 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
pyright = {},
|
||||
ruff_lsp = {},
|
||||
},
|
||||
setup = {
|
||||
ruff_lsp = function()
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "ruff_lsp" then
|
||||
-- Disable hover in favor of Pyright
|
||||
client.server_capabilities.hoverProvider = false
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"nvim-neotest/neotest-python",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-python"] = {
|
||||
-- Here you can specify the settings for the adapter, i.e.
|
||||
-- runner = "pytest",
|
||||
-- python = ".venv/bin/python",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap-python",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method" },
|
||||
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class" },
|
||||
},
|
||||
config = function()
|
||||
local path = require("mason-registry").get_package("debugpy"):get_install_path()
|
||||
require("dap-python").setup(path .. "/venv/bin/python")
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
cmd = "VenvSelect",
|
||||
opts = function(_, opts)
|
||||
if require("lazyvim.util").has("nvim-dap-python") then
|
||||
opts.dap_enabled = true
|
||||
end
|
||||
return vim.tbl_deep_extend("force", opts, {
|
||||
name = {
|
||||
"venv",
|
||||
".venv",
|
||||
"env",
|
||||
".env",
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
|
||||
},
|
||||
}
|
@ -32,6 +32,7 @@ return {
|
||||
-- Ensure Rust 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" })
|
||||
@ -39,93 +40,118 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
lazy = true,
|
||||
opts = function()
|
||||
local ok, mason_registry = pcall(require, "mason-registry")
|
||||
local adapter ---@type any
|
||||
if ok then
|
||||
-- rust tools configuration for debugging support
|
||||
local codelldb = mason_registry.get_package("codelldb")
|
||||
local extension_path = codelldb:get_install_path() .. "/extension/"
|
||||
local codelldb_path = extension_path .. "adapter/codelldb"
|
||||
local liblldb_path = ""
|
||||
if vim.loop.os_uname().sysname:find("Windows") then
|
||||
liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll"
|
||||
elseif vim.fn.has("mac") == 1 then
|
||||
liblldb_path = extension_path .. "lldb/lib/liblldb.dylib"
|
||||
else
|
||||
liblldb_path = extension_path .. "lldb/lib/liblldb.so"
|
||||
end
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path)
|
||||
end
|
||||
return {
|
||||
dap = {
|
||||
adapter = adapter,
|
||||
},
|
||||
tools = {
|
||||
on_initialized = function()
|
||||
vim.cmd([[
|
||||
augroup RustLSP
|
||||
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references()
|
||||
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
|
||||
augroup END
|
||||
]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function() end,
|
||||
},
|
||||
|
||||
-- Correctly setup lspconfig for Rust 🚀
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "simrat39/rust-tools.nvim" },
|
||||
opts = {
|
||||
servers = {
|
||||
-- Ensure mason installs the server
|
||||
rust_analyzer = {},
|
||||
taplo = {},
|
||||
},
|
||||
setup = {
|
||||
rust_analyzer = function(_, opts)
|
||||
require("lazyvim.util").on_attach(function(client, buffer)
|
||||
-- stylua: ignore
|
||||
if client.name == "rust_analyzer" then
|
||||
vim.keymap.set("n", "K", "<cmd>RustHoverActions<cr>", { buffer = buffer, desc = "Hover Actions (Rust)" })
|
||||
vim.keymap.set("n", "<leader>cR", "<cmd>RustCodeAction<cr>", { buffer = buffer, desc = "Code Action (Rust)" })
|
||||
vim.keymap.set("n", "<leader>dr", "<cmd>RustDebuggables<cr>", { buffer = buffer, desc = "Run Debuggables (Rust)" })
|
||||
end
|
||||
end)
|
||||
local mason_registry = require("mason-registry")
|
||||
-- rust tools configuration for debugging support
|
||||
local codelldb = mason_registry.get_package("codelldb")
|
||||
local extension_path = codelldb:get_install_path() .. "/extension/"
|
||||
local codelldb_path = extension_path .. "adapter/codelldb"
|
||||
local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib"
|
||||
or extension_path .. "lldb/lib/liblldb.so"
|
||||
local rust_tools_opts = vim.tbl_deep_extend("force", opts, {
|
||||
dap = {
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
|
||||
},
|
||||
tools = {
|
||||
on_initialized = function()
|
||||
vim.cmd([[
|
||||
augroup RustLSP
|
||||
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references()
|
||||
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
|
||||
augroup END
|
||||
]])
|
||||
end,
|
||||
},
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
loadOutDirsFromCheck = true,
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
rust_analyzer = {
|
||||
keys = {
|
||||
{ "K", "<cmd>RustHoverActions<cr>", desc = "Hover Actions (Rust)" },
|
||||
{ "<leader>cR", "<cmd>RustCodeAction<cr>", desc = "Code Action (Rust)" },
|
||||
{ "<leader>dr", "<cmd>RustDebuggables<cr>", desc = "Run Debuggables (Rust)" },
|
||||
},
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
loadOutDirsFromCheck = true,
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require("rust-tools").setup(rust_tools_opts)
|
||||
},
|
||||
},
|
||||
taplo = {
|
||||
keys = {
|
||||
{
|
||||
"K",
|
||||
function()
|
||||
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||
require("crates").show_popup()
|
||||
else
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end,
|
||||
desc = "Show Crate Documentation",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
rust_analyzer = function(_, opts)
|
||||
local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
|
||||
require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts }))
|
||||
return true
|
||||
end,
|
||||
taplo = function(_, _)
|
||||
local function show_documentation()
|
||||
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||
require("crates").show_popup()
|
||||
else
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end
|
||||
require("lazyvim.util").on_attach(function(client, buffer)
|
||||
-- stylua: ignore
|
||||
if client.name == "taplo" then
|
||||
vim.keymap.set("n", "K", show_documentation, { buffer = buffer, desc = "Show Crate Documentation" })
|
||||
end
|
||||
end)
|
||||
return false -- make sure the base implementation calls taplo.setup
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"rouge8/neotest-rust",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-rust"] = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user