From d4620f3ac119263fee90bd819eadaf84fc8d50b7 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 8 Apr 2026 13:11:48 +0900 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- .config/nvim/lua/config/diagnostics.lua | 13 +++--------- .config/nvim/lua/config/filetypes.lua | 3 ++- .config/nvim/lua/config/keymaps.lua | 9 +++++++-- .config/nvim/lua/config/lsp.lua | 36 ++++++++++++++++++++++----------- 4 files changed, 36 insertions(+), 25 deletions(-) (limited to '.config/nvim/lua/config') diff --git a/.config/nvim/lua/config/diagnostics.lua b/.config/nvim/lua/config/diagnostics.lua index 6314b83..158e3e4 100644 --- a/.config/nvim/lua/config/diagnostics.lua +++ b/.config/nvim/lua/config/diagnostics.lua @@ -23,7 +23,9 @@ vim.diagnostic.config({ underline = { severity = { min = vim.diagnostic.severity.WARN }, }, - float = false, + float = { + source = true, + }, virtual_text = false, virtual_lines = false, }) @@ -34,16 +36,7 @@ vim.api.nvim_set_hl(0, 'DiagnosticUnderlineWarn', commonhl) vim.api.nvim_set_hl(0, 'DiagnosticUnderlineInfo', commonhl) vim.api.nvim_set_hl(0, 'DiagnosticUnderlineHint', commonhl) -vim.keymap.set('n', '[d', function() - vim.diagnostic.jump({ count = 1, float = true }) -end, { desc = 'diagnostic: next' }) - -vim.keymap.set('n', ']d', function() - vim.diagnostic.jump({ count = -1, float = true }) -end, { desc = 'diagnostic: prev' }) - vim.keymap.set('n', 'DD', vim.diagnostic.open_float, { desc = 'diagnostic: current line' }) - vim.keymap.set('n', 'd', '', { desc = "diagnostics" }) vim.keymap.set('n', 'dd', vim.diagnostic.open_float, { desc = 'diagnostic: current line' }) vim.keymap.set('n', 'dv', function() diff --git a/.config/nvim/lua/config/filetypes.lua b/.config/nvim/lua/config/filetypes.lua index f1428d2..f3657db 100644 --- a/.config/nvim/lua/config/filetypes.lua +++ b/.config/nvim/lua/config/filetypes.lua @@ -1,5 +1,6 @@ vim.filetype.add({ pattern = { + ['^/etc/portage/package.*/$'] = 'oil', ['todo.txt'] = 'todotxt', - } + }, }) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 9c00f7b..a93b8fd 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -18,10 +18,10 @@ map( { desc = 'Open file under cursor' } ) -vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { +vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { group = vim.api.nvim_create_augroup('bufclose', {}), callback = function() - if vim.list_contains({'help', 'nofile', 'quickfix'}, vim.bo.buftype) then + if vim.list_contains({ 'help', 'nofile', 'quickfix' }, vim.bo.buftype) then map('', 'q', 'close', { desc = 'Close buffer', buffer = 0 }) end end, @@ -34,3 +34,8 @@ map('n', 'x', function() end, { desc = 'source current file' }) map('n', 'a', 'edit #', { desc = 'open alternative file' }) + +-- yank buffer name +map('n', ';yb', [[let @+ = expand('%')]], { desc = 'yank buffer name' }) +map('n', ';yn', [[let @+ = expand('%:t')]], { desc = 'yank filename' }) +map('n', ';yp', [[let @+ = expand('%:p')]], { desc = 'yank path' }) diff --git a/.config/nvim/lua/config/lsp.lua b/.config/nvim/lua/config/lsp.lua index 282a3dc..b168014 100644 --- a/.config/nvim/lua/config/lsp.lua +++ b/.config/nvim/lua/config/lsp.lua @@ -1,4 +1,6 @@ -if not vim.lsp.enable then return end +if not vim.lsp.enable then + return +end local lsp = vim.lsp @@ -7,6 +9,8 @@ lsp.enable({ 'ccls', 'clangd', 'gopls', + 'harper_ls', + 'pylsp', 'rust_analyzer', 'superhtml', 'tinymist', @@ -14,17 +18,21 @@ lsp.enable({ 'zls', }) -local capabilities = nil +local capabilities = {} if pcall(require, 'blink.cmp') then capabilities = require('blink.cmp').get_lsp_capabilities() end lsp.config('*', { - root_markers = {'.git'}, - capabilities = capabilities + root_markers = { '.git' }, + capabilities = vim.tbl_deep_extend('error', capabilities, { + textDocument = { + semanticTokens = { multilineTokenSupport = true }, + }, + }), }) -vim.api.nvim_create_autocmd({'LspAttach'}, { +vim.api.nvim_create_autocmd({ 'LspAttach' }, { group = vim.api.nvim_create_augroup('lspattach', {}), callback = function(args) local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) @@ -36,7 +44,7 @@ vim.api.nvim_create_autocmd({'LspAttach'}, { vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, { desc = 'goto declaration' }) vim.keymap.set('n', 'gT', vim.lsp.buf.type_definition, { desc = 'goto type definition' }) vim.keymap.set('n', 'gR', vim.lsp.buf.references, { desc = 'show references' }) - vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, { desc = 'show code actions' }) + vim.keymap.set({ 'n', 'v' }, 'ga', vim.lsp.buf.code_action, { desc = 'show code actions' }) vim.keymap.set('n', 'grr', vim.lsp.buf.rename, { desc = 'rename' }) if client:supports_method('textDocument/implementation') then @@ -44,20 +52,24 @@ vim.api.nvim_create_autocmd({'LspAttach'}, { end if client:supports_method('textDocument/completion') then - vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = false}) + vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = false }) end if client:supports_method('textDocument/formatting') then - vim.keymap.set('n', 'f', vim.lsp.buf.format, { desc = 'format' }) + vim.keymap.set('n', 'f', vim.lsp.buf.format, { desc = 'format' }) end - if not client:supports_method('textDocument/willSaveWaitUntil') - and client:supports_method('textDocument/formatting') then - vim.api.nvim_create_autocmd({'BufWritePre'}, { + if + not client:supports_method('textDocument/willSaveWaitUntil') + and client:supports_method('textDocument/formatting') + then + vim.api.nvim_create_autocmd({ 'BufWritePre' }, { group = vim.api.nvim_create_augroup('lspattach', {}), buffer = args.buf, callback = function() - if vim.b.nofmt then return end + if vim.b.nofmt then + return + end vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 }) end, }) -- cgit 1.4.1