mirror of https://github.com/LazyVim/starter
feat(lsp): add none-ls.nvim plugin for enhanced LSP support
parent
12b049ef3e
commit
95f9550202
|
@ -5,7 +5,6 @@
|
|||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
|
||||
"coc-code-action-menu.nvim": { "branch": "main", "commit": "42c641ac3ac366d6f0f2536bac4407cba64bae77" },
|
||||
"coc.nvim": { "branch": "release", "commit": "4fee4938afa69843a3c147f9fdb453de67a1a7a2" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "ac1c3c9d937eb90280eecd00efc12b1b9858b94f" },
|
||||
"conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" },
|
||||
|
@ -34,6 +33,7 @@
|
|||
"neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" },
|
||||
"neotest-python": { "branch": "master", "commit": "34c9f6f3dc53fc462ea658b5071238037f95f7aa" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "db2a48b79cfcdab8baa5d3f37f21c78b6705c62e" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-dap": { "branch": "master", "commit": "40a8189b8a57664a1850b0823fdcb3ac95b9f635" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" },
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"lazyvim.plugins.extras.lang.python",
|
||||
"lazyvim.plugins.extras.lang.tex",
|
||||
"lazyvim.plugins.extras.lang.toml",
|
||||
"lazyvim.plugins.extras.lsp.none-ls",
|
||||
"lazyvim.plugins.extras.test.core",
|
||||
"lazyvim.plugins.extras.ui.treesitter-context"
|
||||
],
|
||||
|
|
|
@ -22,7 +22,7 @@ map_nv("x", '"1x', { desc = "Delete and put the deleted part into secondary clip
|
|||
map_nv("X", '"1X', { desc = "Delete and put the deleted part into secondary clipboard" })
|
||||
map_nv("<C-d>", '"1d', { desc = "Delete and put the deleted part into secondary clipboard" })
|
||||
keyset("n", "<BS>", '"1d', { noremap = true, desc = "Backspace in normal mode" })
|
||||
keyset("o", "<BS>", 'd', { noremap = true, desc = "Backspace in normal mode" })
|
||||
keyset("o", "<BS>", "d", { noremap = true, desc = "Backspace in normal mode" })
|
||||
--TODO: This does not work due to which-key
|
||||
keyset({ "x", "v" }, "<BS>", '"1x', { noremap = true, desc = "Backspace in normal mode" })
|
||||
-- keyset("v", "x", '"_x', { noremap = true, desc = "Delete without saving to clipboard" })
|
||||
|
@ -69,6 +69,7 @@ end, { desc = "Print variable (Preview Mode)" })
|
|||
keyset("n", "<localleader>r", "<Plug>(coc-rename)", { desc = "Rename (Coc)" })
|
||||
keyset("v", "<localleader>r", "<Plug>(coc-codeaction-refactor-selected)", { desc = "Refactor Selected (Coc)" })
|
||||
keyset("n", "<localleader>cl", "<Plug>(coc-codelens-action)", { desc = "CodeLens Action (Coc)" })
|
||||
-- Code actions are actually twisted by another plugin
|
||||
keyset("n", "<localleader>ca", "<Plug>(coc-codeaction)", { desc = "Code Action (Coc)" })
|
||||
keyset("v", "<localleader>ca", "<Plug>(coc-codeaction-selected)", { desc = "Code Action (Coc)" })
|
||||
|
||||
|
@ -99,7 +100,8 @@ keyset("v", "<D-v>", '"1d"+gP', { desc = "Remove the selected part and paste fro
|
|||
keyset("v", "<D-c>", '"+y', { desc = "Copy to clipboard in visual mode" })
|
||||
keyset("v", "<D-x>", '"+d', { desc = "Cut to clipboard" })
|
||||
map_nv("<D-a>", "gg<S-v>G", { desc = "Select all" })
|
||||
-- Test: Code action Menu
|
||||
vim.keymap.set("n", "<leader>m", function()
|
||||
-- Code action menu
|
||||
vim.keymap.set({ "n", "v" }, "<leader>ca", function()
|
||||
---@diagnostic disable-next-line: missing-parameter
|
||||
require("tiny-code-action").code_action()
|
||||
end, { noremap = true, silent = true })
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
if vim.fn.has("gui_running") == 1 then
|
||||
vim.o.clipboard = ""
|
||||
end
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.api.nvim_set_keymap("i", "<C-Tab>", 'copilot#Accept("<CR>")', { silent = true, expr = true })
|
||||
vim.o.guifont = "Monaco:h16"
|
||||
vim.cmd("set wrap")
|
||||
local dap = require("dap")
|
||||
|
|
|
@ -28,7 +28,7 @@ return {
|
|||
{ "<localleader>c", group = "code", mode = { "n", "v" } },
|
||||
{ "<localleader>d", group = "debug", mode = { "n", "v" } },
|
||||
{ "<localleader>r", icon = "", group = "Rename (COC)" },
|
||||
{ "<leader>a", group = "AI", mode = { "n", "v" } }
|
||||
{ "<leader>a", group = "AI", mode = { "n", "v" } },
|
||||
},
|
||||
-- name = "\\",
|
||||
-- d = { name = "+debug" },
|
||||
|
@ -73,7 +73,7 @@ return {
|
|||
formatters_by_ft = {
|
||||
python = { "black" },
|
||||
sh = { "shfmt" },
|
||||
lua = { "/opt/homebrew/bin/lua" },
|
||||
lua = { "stylua" },
|
||||
tex = { "latexindent" },
|
||||
},
|
||||
},
|
||||
|
@ -236,11 +236,39 @@ return {
|
|||
require("utils.codecompanion_fidget_spinner"):init()
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>aa", "<CMD>CodeCompanionActions<CR>", mode = { "n", "v" }, noremap = true, silent = true, desc = "CodeCompanion actions" },
|
||||
{
|
||||
"<leader>aa",
|
||||
"<CMD>CodeCompanionActions<CR>",
|
||||
mode = { "n", "v" },
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "CodeCompanion actions",
|
||||
},
|
||||
-- Map <leader>ai to run CodeCompanion on the selected range in normal and visual modes
|
||||
{ "<leader>ai", "<CMD>'<,'>CodeCompanion<CR>", mode = { "n", "v" }, noremap = true, silent = true, desc = "CodeCompanion inline" },
|
||||
{ "<leader>ac", "<CMD>CodeCompanionChat Toggle<CR>", mode = { "n", "v" }, noremap = true, silent = true, desc = "CodeCompanion chat (toggle)" },
|
||||
{ "<leader>ap", "<CMD>CodeCompanionChat Add<CR>", mode = { "v" }, noremap = true, silent = true, desc = "CodeCompanion chat add code" },
|
||||
{
|
||||
"<leader>ai",
|
||||
"<CMD>'<,'>CodeCompanion<CR>",
|
||||
mode = { "n", "v" },
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "CodeCompanion inline",
|
||||
},
|
||||
{
|
||||
"<leader>ac",
|
||||
"<CMD>CodeCompanionChat Toggle<CR>",
|
||||
mode = { "n", "v" },
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "CodeCompanion chat (toggle)",
|
||||
},
|
||||
{
|
||||
"<leader>ap",
|
||||
"<CMD>CodeCompanionChat Add<CR>",
|
||||
mode = { "v" },
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "CodeCompanion chat add code",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
display = {
|
||||
|
@ -264,6 +292,7 @@ return {
|
|||
opts = {
|
||||
default_mappings = false,
|
||||
mappings = {
|
||||
set = "m",
|
||||
set_next = "m,",
|
||||
toggle = "m;",
|
||||
delete_line = "dm-",
|
||||
|
@ -275,11 +304,49 @@ return {
|
|||
prev = "[`",
|
||||
-- TODO: This seems not working
|
||||
-- annotate = "m*",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "rachartier/tiny-code-action.nvim" },
|
||||
{ "xiyaowong/coc-code-action-menu.nvim" },
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = "LazyFile",
|
||||
init = function()
|
||||
LazyVim.on_very_lazy(function()
|
||||
-- register the formatter with LazyVim
|
||||
LazyVim.format.register({
|
||||
name = "none-ls.nvim",
|
||||
priority = 1, -- set higher than conform, the builtin formatter
|
||||
primary = true,
|
||||
format = function(buf)
|
||||
return LazyVim.lsp.format({
|
||||
bufnr = buf,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
sources = function(buf)
|
||||
local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {}
|
||||
return vim.tbl_map(function(source)
|
||||
return source.name
|
||||
end, ret)
|
||||
end,
|
||||
})
|
||||
end)
|
||||
end,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.root_dir = opts.root_dir
|
||||
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
-- nls.builtins.formatting.fish_indent,
|
||||
-- nls.builtins.diagnostics.fish,
|
||||
-- nls.builtins.formatting.stylua,
|
||||
-- nls.builtins.formatting.shfmt,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue