diff options
| author | Robert Günzler <r@gnzler.io> | 2026-04-08 13:11:48 +0900 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-04-08 13:11:48 +0900 |
| commit | d4620f3ac119263fee90bd819eadaf84fc8d50b7 (patch) | |
| tree | f5268e72a1c0037d29acac699e5d3f4c37be0e6b /.config/nvim/lua/config | |
| parent | 8afe3fa8d88ae56e96f65897935ef508581ac5f7 (diff) | |
*
Automated-commit-by: dots Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
| -rw-r--r-- | .config/nvim/lua/config/diagnostics.lua | 13 | ||||
| -rw-r--r-- | .config/nvim/lua/config/filetypes.lua | 3 | ||||
| -rw-r--r-- | .config/nvim/lua/config/keymaps.lua | 9 | ||||
| -rw-r--r-- | .config/nvim/lua/config/lsp.lua | 36 |
4 files changed, 36 insertions, 25 deletions
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', '<leader>d', '<nop>', { desc = "diagnostics" }) vim.keymap.set('n', '<leader>dd', vim.diagnostic.open_float, { desc = 'diagnostic: current line' }) vim.keymap.set('n', '<leader>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', '<cmd>close<cr>', { desc = 'Close buffer', buffer = 0 }) end end, @@ -34,3 +34,8 @@ map('n', '<leader><leader>x', function() end, { desc = 'source current file' }) map('n', '<leader>a', '<cmd>edit #<cr>', { desc = 'open alternative file' }) + +-- yank buffer name +map('n', ';yb', [[<cmd>let @+ = expand('%')<cr>]], { desc = 'yank buffer name' }) +map('n', ';yn', [[<cmd>let @+ = expand('%:t')<cr>]], { desc = 'yank filename' }) +map('n', ';yp', [[<cmd>let @+ = expand('%:p')<cr>]], { 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', '<leader>f', vim.lsp.buf.format, { desc = 'format' }) + vim.keymap.set('n', '<leader>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, }) |