1
0
Fork 0

nvim cleanup

This commit is contained in:
Luca Bilke 2024-04-08 02:15:57 +02:00
parent dbd7f49553
commit 7d4f272723
No known key found for this signature in database
GPG Key ID: AD6630D0A1E650AC
5 changed files with 52 additions and 26 deletions

View File

@ -1,27 +1,59 @@
local autocmds = {
{ -- Handles the automatic line numeration changes
{ -- Automatically change line numeration
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
group = "auto_number",
command = 'if &nu && mode() != "i" | set rnu | endif',
-- callback = function()
-- if vim.opt.number and vim.fn.mode() ~= "i" then
-- vim.opt.relativenumber = true
-- end
-- end,
},
},
{ -- Handles the automatic line numeration changes
{ -- Automatically change line numeration
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
group = "auto_number",
command = "if &nu | set nornu | endif",
-- callback = function()
-- if vim.opt.number then
-- vim.opt.relativenumber = false
-- end
-- end,
},
},
{ -- Use 'q' to quit from common plugins
"FileType",
{
pattern = { "help", "man" },
callback = function()
vim.cmd([[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]])
pattern = {
"PlenaryTestPopup",
"help",
"lspinfo",
"notify",
"qf",
"query",
"spectre_panel",
"startuptime",
"tsplayground",
"neotest-output",
"checkhealth",
"neotest-summary",
"neotest-output-panel",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
},
},
{ -- make it easier to close man-files when opened inline
"FileType",
{
group = "man_unlisted",
pattern = { "man" },
callback = function(event)
vim.bo[event.buf].buflisted = false
end,
},
},

View File

@ -1,7 +1,7 @@
return {
{ "neovim/nvim-lspconfig" },
{ "folke/neoconf.nvim" },
{ "folke/neodev.nvim" },
{ "folke/neodev.nvim", opts = {} },
require("plugins.lsp.mason-lspconfig"),
require("plugins.lsp.mason-null-ls"),
require("plugins.lsp.null-ls"),

View File

@ -8,25 +8,16 @@ M.event = { "BufReadPost", "BufNewFile", "BufWritePre" }
M.cmd = { "LspInstall", "LspUninstall" }
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = { "documentation", "detail", "additionalTextEdits" },
}
capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
local function merge(table, overwrite)
overwrite = overwrite or {}
return table and vim.tbl_deep_extend("force", table, overwrite) or overwrite
end
local base_capabilities = vim.lsp.protocol.make_client_capabilities()
local cmp_capabilities = require('cmp_nvim_lsp').default_capabilities()
local capabilities = merge(base_capabilities, cmp_capabilities)
capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
M.config = function()
require("neoconf").setup()
require("neodev").setup()

View File

@ -24,9 +24,9 @@ M.opts = function()
end
M.config = function(_, opts)
local m = require("telescope")
local actions = require("telescope.actions")
opts.mappings = require("config.keymaps").telescope(actions)
local m = require("telescope")
m.setup(opts)
m.load_extension("aerial")
m.load_extension("fzf")

View File

@ -5,6 +5,9 @@ M.event = { "BufReadPost", "BufNewFile", "BufWritePre" }
M.opts = {
signs = false,
highlight = {
multiline = false,
},
keywords = {
BUG = { icon = icons.Bug, color = "error", alt = { "FIXME", "FIX", "FIXIT", "ISSUE" } },
TODO = { icon = icons.Task, color = "info" },