diff --git a/after/lsp/marksman.lua b/after/lsp/marksman.lua index 934ab015..4cbb165d 100644 --- a/after/lsp/marksman.lua +++ b/after/lsp/marksman.lua @@ -1,6 +1,6 @@ ---@type vim.lsp.Config return { cmd = { 'marksman', 'server' }, - filetypes = { 'markdown', 'markdown.mdx' }, + filetypes = { 'markdown' }, root_markers = { '.marksman.toml', '.git' }, } diff --git a/lua/config/autocommands.lua b/lua/config/autocommands.lua index 93f68c4b..27706116 100644 --- a/lua/config/autocommands.lua +++ b/lua/config/autocommands.lua @@ -187,99 +187,3 @@ vim.api.nvim_create_autocmd('FocusGained', { end, desc = 'Close non-existing buffers', }) - -local lsp_group = vim.api.nvim_create_augroup('my.lsp', { clear = true }) - -vim.api.nvim_create_autocmd('LspAttach', { - group = lsp_group, - desc = 'LSP keymaps & features', - callback = function(ev) - local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) - local bufnr = ev.buf - - local map = function(mode, lhs, rhs, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, lhs, rhs, opts) - end - - -- diagnostics - map('n', 'D', vim.diagnostic.open_float) - - -- completion - vim.lsp.completion.enable(true, client.id, bufnr, { autotrigger = true }) - - -- navigation - if client:supports_method('textDocument/definition') then - map('n', 'gd', vim.lsp.buf.definition) - end - - if client:supports_method('textDocument/declaration') then - map('n', 'gD', vim.lsp.buf.declaration) - end - - if client:supports_method('textDocument/typeDefinition') then - map('n', 'gt', vim.lsp.buf.type_definition) - end - - if client:supports_method('textDocument/implementation') then - map('n', 'gri', vim.lsp.buf.implementation) - end - - if client:supports_method('callHierarchy/incomingCalls') then - map('n', 'grI', vim.lsp.buf.incoming_calls) - end - - -- editing - if client:supports_method('textDocument/rename') then - map('n', 'R', vim.lsp.buf.rename) - end - - if client:supports_method('textDocument/onTypeFormatting') then - vim.lsp.on_type_formatting.enable() - end - - map('i', '', vim.lsp.buf.signature_help) - - -- UI extras - if client:supports_method('textDocument/documentSymbol') then - require('nvim-navic').attach(client, bufnr) - end - - if client:supports_method('textDocument/documentColor') then - vim.lsp.document_color.enable(true, bufnr) - end - - if client:supports_method('textDocument/inlayHint') and vim.g.lsp_inlay_hints then - vim.lsp.inlay_hint.enable(true) - end - - if client:supports_method('textDocument/inlineCompletion') then - vim.lsp.inline_completion.enable(true, { bufnr = bufnr }) - map('i', '', vim.lsp.inline_completion.get, { desc = 'Accept inline completion' }) - map('i', '', vim.lsp.inline_completion.select, { desc = 'Cycle inline completion' }) - end - - if client:supports_method('textDocument/documentHighlight') then - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = bufnr, - group = lsp_group, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = bufnr, - group = lsp_group, - callback = vim.lsp.buf.clear_references, - }) - end - end, -}) - -vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach', 'DiagnosticChanged' }, { - group = vim.api.nvim_create_augroup('StatuslineUpdate', { clear = true }), - desc = 'Update statusline/winbar', - callback = vim.schedule_wrap(function() - vim.cmd.redrawstatus() - end), -}) diff --git a/lua/config/icons.lua b/lua/config/icons.lua index 24335058..d572e1f8 100644 --- a/lua/config/icons.lua +++ b/lua/config/icons.lua @@ -50,7 +50,9 @@ return { }, spinner = { dot = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' }, - circle = { '  ', '  ', '  ', '  ', '  ', '  ' }, + arc = { '◜', '◠', '◝', '◞', '◡', '◟' }, + circle = { '◐', '◓', '◑', '◒', '◐', '◓', '◑', '◒' }, + quarter = { '◴', '◷', '◶', '◵' }, }, todolist = { todo = '  ', diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 2598fd07..46d714bc 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -46,3 +46,99 @@ vim.diagnostic.config({ float = true, jump = { on_jump = vim.diagnostic.open_float }, }) + +local lsp_group = vim.api.nvim_create_augroup('my.lsp', { clear = true }) + +vim.api.nvim_create_autocmd('LspAttach', { + group = lsp_group, + desc = 'LSP keymaps & features', + callback = function(ev) + local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) + local bufnr = ev.buf + + local map = function(mode, lhs, rhs, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, lhs, rhs, opts) + end + + -- diagnostics + map('n', 'D', vim.diagnostic.open_float) + + -- completion + vim.lsp.completion.enable(true, client.id, bufnr) + + -- navigation + if client:supports_method('textDocument/definition') then + map('n', 'gd', vim.lsp.buf.definition) + end + + if client:supports_method('textDocument/declaration') then + map('n', 'gD', vim.lsp.buf.declaration) + end + + if client:supports_method('textDocument/typeDefinition') then + map('n', 'gt', vim.lsp.buf.type_definition) + end + + if client:supports_method('textDocument/implementation') then + map('n', 'gri', vim.lsp.buf.implementation) + end + + if client:supports_method('callHierarchy/incomingCalls') then + map('n', 'grI', vim.lsp.buf.incoming_calls) + end + + -- editing + if client:supports_method('textDocument/rename') then + map('n', 'R', vim.lsp.buf.rename) + end + + if client:supports_method('textDocument/onTypeFormatting') then + vim.lsp.on_type_formatting.enable() + end + + map('i', '', vim.lsp.buf.signature_help) + + -- -- UI extras + -- if client:supports_method('textDocument/documentSymbol') then + -- require('nvim-navic').attach(client, bufnr) + -- end + + if client:supports_method('textDocument/documentColor') then + vim.lsp.document_color.enable(true, bufnr) + end + + if client:supports_method('textDocument/inlayHint') and vim.g.lsp_inlay_hints then + vim.lsp.inlay_hint.enable(true) + end + + if client:supports_method('textDocument/inlineCompletion') then + vim.lsp.inline_completion.enable(true, { bufnr = bufnr }) + map('i', '', vim.lsp.inline_completion.get, { desc = 'Accept inline completion' }) + map('i', '', vim.lsp.inline_completion.select, { desc = 'Cycle inline completion' }) + end + + if client:supports_method('textDocument/documentHighlight') then + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = bufnr, + group = lsp_group, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = bufnr, + group = lsp_group, + callback = vim.lsp.buf.clear_references, + }) + end + end, +}) + +vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach', 'DiagnosticChanged' }, { + group = vim.api.nvim_create_augroup('StatuslineUpdate', { clear = true }), + desc = 'Update statusline/winbar', + callback = vim.schedule_wrap(function() + vim.cmd.redrawstatus() + end), +}) diff --git a/lua/plugins/foldtext.lua b/lua/plugins/foldtext.lua index 3208db71..34147208 100644 --- a/lua/plugins/foldtext.lua +++ b/lua/plugins/foldtext.lua @@ -1,14 +1,15 @@ ---@type LazyPluginSpec return { 'OXY2DEV/foldtext.nvim', - lazy = false, ---@module 'foldtext' ---@type foldtext.config opts = { ignore_filetypes = { 'snacks_dashboard', }, - ignore_buftypes = {}, + ignore_buftypes = { + 'nofile', + }, styles = { default = { ---|fS "config: Default configuration" diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index ed67b42c..a44bc6ce 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -114,7 +114,7 @@ return { 'lsp_status', icon = '󰒋 ', symbols = { - spinner = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' }, + spinner = require('config.icons').spinner.circle, done = '✓', separator = ' ', }, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 95f9bacb..2c770bcd 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -15,7 +15,7 @@ return { dependencies = { { 'nvim-treesitter/nvim-treesitter-context', - lazy = false, + lazy = true, opts = { max_lines = 4, multiline_threshold = 2, @@ -24,7 +24,7 @@ return { { 'nvim-treesitter/nvim-treesitter-textobjects', branch = 'main', - lazy = false, + lazy = true, init = function() -- Disable entire built-in ftplugin mappings to avoid conflicts. -- See https://github.com/neovim/neovim/tree/master/runtime/ftplugin for built-in ftplugins. diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm new file mode 100644 index 00000000..7aff2207 --- /dev/null +++ b/queries/lua/highlights.scm @@ -0,0 +1,4 @@ +;; extends + +((identifier) @namespace.builtin + (#eq? @namespace.builtin "vim"))