better cmp config
This commit is contained in:
parent
1782ed2698
commit
e0f6c55e1a
4 changed files with 101 additions and 2 deletions
|
@ -7,12 +7,14 @@ return {
|
|||
"AstroNvim/astrocommunity",
|
||||
{ import = "astrocommunity.colorscheme.catppuccin" },
|
||||
|
||||
{ import = "astrocommunity.diagnostics.lsp_lines-nvim" },
|
||||
{ import = "astrocommunity.diagnostics.trouble-nvim" },
|
||||
|
||||
{ import = "astrocommunity.editing-support.rainbow-delimiters-nvim" },
|
||||
{ import = "astrocommunity.editing-support.ultimate-autopair-nvim" },
|
||||
|
||||
{ import = "astrocommunity.indent.indent-blankline-nvim" },
|
||||
{ import = "astrocommunity.indent.mini-indentscope" },
|
||||
{ import = "astrocommunity.indent.indent-rainbowline" },
|
||||
|
||||
{ import = "astrocommunity.lsp.lsp-lens-nvim" },
|
||||
{ import = "astrocommunity.lsp.lsplinks-nvim" },
|
||||
|
@ -24,7 +26,6 @@ return {
|
|||
|
||||
{ import = "astrocommunity.pack.cs-omnisharp" },
|
||||
{ import = "astrocommunity.pack.html-css" },
|
||||
{ import = "astrocommunity.pack.lua" },
|
||||
{ import = "astrocommunity.pack.nix" },
|
||||
{ import = "astrocommunity.pack.python" },
|
||||
{ import = "astrocommunity.pack.rust" },
|
||||
|
|
|
@ -12,6 +12,7 @@ return {
|
|||
codelens = true,
|
||||
inlay_hints = true,
|
||||
semantic_tokens = true,
|
||||
signature_help = true;
|
||||
},
|
||||
formatting = {
|
||||
disabled = {
|
||||
|
|
28
lua/plugins/cmp.lua
Normal file
28
lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
opts.sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
})
|
||||
|
||||
opts.experimental = { ghost_text = true }
|
||||
opts.formatting.fields = {"abbr", "kind", "menu"}
|
||||
opts.formatting.format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
menu = ({
|
||||
buffer = "[BUFFER]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[SNIP]",
|
||||
path = "[PATH]",
|
||||
})
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
69
lua/plugins/lua.lua
Normal file
69
lua/plugins/lua.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
local function selene_configured(path)
|
||||
return #vim.fs.find("selene.toml", { path = path, upward = true, type = "file" }) > 0
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"AstroNvim/astrolsp",
|
||||
optional = true,
|
||||
opts = {
|
||||
config = {
|
||||
lua_ls = { settings = { Lua = { hint = { enable = true, arrayIndex = "Disable" } } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if opts.ensure_installed ~= "all" then
|
||||
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "lua", "luap" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "stylua", "selene" })
|
||||
if not opts.handlers then opts.handlers = {} end
|
||||
opts.handlers.selene = function(source_name, methods)
|
||||
local null_ls = require "null-ls"
|
||||
for _, method in ipairs(methods) do
|
||||
null_ls.register(null_ls.builtins[method][source_name].with {
|
||||
runtime_condition = function(params) return selene_configured(params.bufname) end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed =
|
||||
require("astrocore").list_insert_unique(opts.ensure_installed, { "lua-language-server", "stylua", "selene" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
lua = { "selene" },
|
||||
},
|
||||
linters = {
|
||||
selene = { condition = function(ctx) return selene_configured(ctx.filename) end },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue