From c52452dbf43d981e2fe57fd1d00fe23991f895a8 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 16 Jul 2025 19:08:18 +0200 Subject: [PATCH] Merge work --- nvim/base.lua | 20 ++++++++++++++------ nvim/keymaps.lua | 1 + nvim/plugins.lua | 16 ++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/nvim/base.lua b/nvim/base.lua index 267b15b..8cfacb4 100644 --- a/nvim/base.lua +++ b/nvim/base.lua @@ -7,7 +7,6 @@ vim.g.loaded_netrwPlugin = 1 vim.opt.mouse = 'a' vim.opt.history = 1000 vim.opt.ruler = true -vim.opt.ruler = true vim.opt.number = true vim.opt.showcmd = true vim.opt.ttimeoutlen = 100 @@ -84,11 +83,11 @@ vim.api.nvim_create_autocmd({'FocusGained', 'BufEnter', 'CursorMoved', 'CursorMo command = 'silent! checktime' }) -vim.api.nvim_create_autocmd('BufEnter', { - group = 'VimIntern', - pattern = '*', - command = 'silent! lcd %:p:h' -}) +-- vim.api.nvim_create_autocmd('BufEnter', { +-- group = 'VimIntern', +-- pattern = '*', +-- command = 'silent! lcd %:p:h' +-- }) -- Open nvim-tree when starting Neovim in a specific directory or any of its subdirectories vim.api.nvim_create_autocmd("VimEnter", { @@ -133,6 +132,15 @@ vim.api.nvim_create_user_command('TrimWhiteSpace', function() vim.cmd('%s/\\s\\+$//e') end, {}) +local function ToggleDiagnostics() + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + if vim.diagnostic.is_enabled() then + print("Diagnostics enabled") + else + print("Diagnostics disabled") + end +end + --------------------------- ------- DIAGNOSTICS ------- diff --git a/nvim/keymaps.lua b/nvim/keymaps.lua index cd5cb1b..ce7c559 100644 --- a/nvim/keymaps.lua +++ b/nvim/keymaps.lua @@ -60,6 +60,7 @@ vim.keymap.set('n', 'cws', vim.lsp.buf.workspace_symbol, { desc = 'LSP W vim.keymap.set('n', 'ch', vim.lsp.buf.hover, { desc = 'LSP Hover' }) vim.keymap.set('n', 'cH', vim.lsp.buf.signature_help, { desc = 'LSP Signature Help' }) vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, { desc = 'LSP Code Action' }) +vim.keymap.set('n', 'cde', ToggleDiagnostics, { desc = 'Toggle Diagnostics' }) diff --git a/nvim/plugins.lua b/nvim/plugins.lua index 3576a05..975db71 100644 --- a/nvim/plugins.lua +++ b/nvim/plugins.lua @@ -44,14 +44,14 @@ cmp.setup({ }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - { name = 'path' }, - { name = 'cmp_yanky' }, - { name = 'git' }, - { name = 'copilot' }, - -- }, { - { name = 'buffer', keyword_length = 2 }, + { name = 'nvim_lsp', priority = 1000 }, + { name = 'buffer', priority = 800, keyword_length = 2 }, + { name = 'copilot', priority = 700 }, + { name = 'path', priority = 600 }, + { name = 'cmp_yanky', priority = 500 }, + { name = 'git', priority = 400 }, + { name = 'vsnip', priority = 300 }, + { name = 'nvim_lua', priority = 200 }, }), formatting = {