mirror of
https://github.com/mintycube/dotfiles.git
synced 2024-10-22 14:05:41 +02:00
add cpp custom snippet and tone down diagnostics
This commit is contained in:
parent
44c76af6c6
commit
cfce3cf614
@ -1,186 +1,194 @@
|
||||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v3.x",
|
||||
lazy = true,
|
||||
config = false,
|
||||
init = function()
|
||||
vim.g.lsp_zero_extend_cmp = 0
|
||||
vim.g.lsp_zero_extend_lspconfig = 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v3.x",
|
||||
lazy = true,
|
||||
config = false,
|
||||
init = function()
|
||||
vim.g.lsp_zero_extend_cmp = 0
|
||||
vim.g.lsp_zero_extend_lspconfig = 0
|
||||
end,
|
||||
},
|
||||
|
||||
-- autocompletion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "https://codeberg.org/FelipeLema/cmp-async-path" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
{ "onsails/lspkind.nvim" },
|
||||
{ "hrsh7th/cmp-calc" },
|
||||
{ "f3fora/cmp-spell" },
|
||||
{ "micangl/cmp-vimtex" },
|
||||
{ "Jezda1337/nvim-html-css" },
|
||||
},
|
||||
config = function()
|
||||
local lsp_zero = require("lsp-zero")
|
||||
lsp_zero.extend_cmp()
|
||||
-- autocompletion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "https://codeberg.org/FelipeLema/cmp-async-path" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
{ "onsails/lspkind.nvim" },
|
||||
{ "hrsh7th/cmp-calc" },
|
||||
{ "f3fora/cmp-spell" },
|
||||
{ "micangl/cmp-vimtex" },
|
||||
{ "Jezda1337/nvim-html-css" },
|
||||
},
|
||||
config = function()
|
||||
local lsp_zero = require("lsp-zero")
|
||||
lsp_zero.extend_cmp()
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_action = lsp_zero.cmp_action()
|
||||
local cmp = require("cmp")
|
||||
local cmp_action = lsp_zero.cmp_action()
|
||||
|
||||
-- Lazy load snippets from VSCode
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./lua/snippets" } })
|
||||
-- Lazy load snippets from VSCode
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./lua/snippets" } })
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "async_path" },
|
||||
{ name = "calc" },
|
||||
{ name = "html-css" },
|
||||
{ name = "vimtex" },
|
||||
{
|
||||
name = "spell",
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
preselect = "item",
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "async_path" },
|
||||
{ name = "calc" },
|
||||
{ name = "html-css" },
|
||||
{ name = "vimtex" },
|
||||
{
|
||||
name = "spell",
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
preselect = "item",
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
maxwidth = 30,
|
||||
fields = { "abbr", "kind" },
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 30,
|
||||
ellipsis_char = "",
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp_action.luasnip_supertab(),
|
||||
["<S-Tab>"] = cmp_action.luasnip_shift_supertab(),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
fields = { "abbr", "kind" },
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 30,
|
||||
ellipsis_char = "",
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp_action.luasnip_supertab(),
|
||||
["<S-Tab>"] = cmp_action.luasnip_shift_supertab(),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
cmd = { "LspInfo", "LspInstall", "LspStart" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = true,
|
||||
},
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp_zero = require("lsp-zero")
|
||||
lsp_zero.extend_lspconfig()
|
||||
-- lsp
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
cmd = { "LspInfo", "LspInstall", "LspStart" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = true,
|
||||
},
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp_zero = require("lsp-zero")
|
||||
lsp_zero.extend_lspconfig()
|
||||
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
-- exclude = { 'gl', 'K' },
|
||||
})
|
||||
end)
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
-- exclude = { 'gl', 'K' },
|
||||
})
|
||||
end)
|
||||
|
||||
lsp_zero.set_sign_icons({
|
||||
error = "",
|
||||
warn = "",
|
||||
hint = "",
|
||||
info = "",
|
||||
})
|
||||
lsp_zero.set_sign_icons({
|
||||
error = "",
|
||||
warn = "",
|
||||
hint = "",
|
||||
info = "",
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"clangd",
|
||||
"ruff_lsp",
|
||||
"marksman",
|
||||
"html",
|
||||
"cssls",
|
||||
"lua_ls",
|
||||
"bashls",
|
||||
"texlab",
|
||||
"jsonls",
|
||||
"eslint",
|
||||
},
|
||||
handlers = {
|
||||
lsp_zero.default_setup,
|
||||
lua_ls = function()
|
||||
require("lspconfig").lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
clangd = function()
|
||||
require("lspconfig").clangd.setup({
|
||||
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,
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
-- ltex = function()
|
||||
-- require("lspconfig").ltex.setup({
|
||||
-- settings = {
|
||||
-- ltex = {
|
||||
-- language = {"en-US"},
|
||||
-- -- dictionary = {":~/.config/nvim/spell/en.utf-8.add"},
|
||||
-- disabledRules = { ['en-US'] = { 'MORFOLOGIK_RULE_EN_US' } },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
vim.diagnostic.config({
|
||||
underline = false,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"clangd",
|
||||
"ruff_lsp",
|
||||
"marksman",
|
||||
"html",
|
||||
"cssls",
|
||||
"lua_ls",
|
||||
"bashls",
|
||||
"texlab",
|
||||
"jsonls",
|
||||
"eslint",
|
||||
},
|
||||
handlers = {
|
||||
lsp_zero.default_setup,
|
||||
lua_ls = function()
|
||||
require("lspconfig").lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
clangd = function()
|
||||
require("lspconfig").clangd.setup({
|
||||
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,
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
-- ltex = function()
|
||||
-- require("lspconfig").ltex.setup({
|
||||
-- settings = {
|
||||
-- ltex = {
|
||||
-- language = {"en-US"},
|
||||
-- -- dictionary = {":~/.config/nvim/spell/en.utf-8.add"},
|
||||
-- disabledRules = { ['en-US'] = { 'MORFOLOGIK_RULE_EN_US' } },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -29,6 +29,18 @@ return {
|
||||
hl.DiagnosticVirtualTextWarn = {
|
||||
fg = colors.comment
|
||||
}
|
||||
hl.DiagnosticSignError = {
|
||||
fg = colors.comment
|
||||
}
|
||||
hl.DiagnosticSignHint = {
|
||||
fg = colors.comment
|
||||
}
|
||||
hl.DiagnosticSignInfo = {
|
||||
fg = colors.comment
|
||||
}
|
||||
hl.DiagnosticSignWarn = {
|
||||
fg = colors.comment
|
||||
}
|
||||
end,
|
||||
})
|
||||
vim.cmd.colorscheme("tokyonight")
|
||||
@ -349,14 +361,14 @@ return {
|
||||
end,
|
||||
},
|
||||
winopts = {
|
||||
height = 0.3,
|
||||
height = 0.4,
|
||||
width = 0.5,
|
||||
},
|
||||
})
|
||||
end),
|
||||
|
||||
dashboard.button("f", " Find file", ":lua require('fzf-lua').files()<CR>"),
|
||||
dashboard.button("t", " Find text", ":lua require('fzf-lua').live_grep_native()<CR>"),
|
||||
-- dashboard.button("f", " Find file", ":lua require('fzf-lua').files()<CR>"),
|
||||
-- dashboard.button("t", " Find text", ":lua require('fzf-lua').live_grep_native()<CR>"),
|
||||
dashboard.button("s", " Restore Session", ":lua require('persistence').load()<CR>"),
|
||||
dashboard.button("n", " Notes", ":lua require('fzf-lua').files({cwd =[[~/notes]]})<CR>"),
|
||||
dashboard.button("c", " Configuration", ":e $MYVIMRC <CR>"),
|
||||
|
14
.config/nvim/lua/snippets/cpp.json
Normal file
14
.config/nvim/lua/snippets/cpp.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"Hello World": {
|
||||
"prefix": "hello",
|
||||
"body": [
|
||||
"#include <iostream>",
|
||||
"",
|
||||
"int main () {",
|
||||
"\t$1",
|
||||
"\treturn 0;",
|
||||
"}"
|
||||
],
|
||||
"description": "starter template"
|
||||
}
|
||||
}
|
@ -15,6 +15,10 @@
|
||||
"all"
|
||||
],
|
||||
"path": "./global.json"
|
||||
},
|
||||
{
|
||||
"language": "cpp",
|
||||
"path": "./cpp.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user