diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index c99b395..762f826 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -30,7 +30,7 @@ return { relativenumber = true, -- sets vim.opt.relativenumber number = true, -- sets vim.opt.number spell = false, -- sets vim.opt.spell - signcolumn = "auto", -- sets vim.opt.signcolumn to auto + signcolumn = "yes", -- sets vim.opt.signcolumn to yes wrap = false, -- sets vim.opt.wrap }, g = { -- vim.g. @@ -46,28 +46,26 @@ return { n = { -- second key is the lefthand side of the map - -- navigate buffer tabs with `H` and `L` - L = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, - H = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, + -- navigate buffer tabs + ["[b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + ["]b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, -- mappings seen under group name "Buffer" - ["bD"] = { + ["bd"] = { function() require("astroui.status.heirline").buffer_picker( function(bufnr) require("astrocore.buffer").close(bufnr) end ) end, - desc = "Pick to close", + desc = "Close buffer from tabline", }, + -- tables with just a `desc` key will be registered with which-key if it's installed -- this is useful for naming menus - ["b"] = { desc = "Buffers" }, - -- quick save - -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command - }, - t = { + -- ["b"] = { desc = "Buffers" }, + -- setting a mapping to false will disable it - -- [""] = false, + -- [""] = false, }, }, }, diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 3d5f7ff..80e0784 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -59,43 +59,41 @@ return { -- Configure buffer local auto commands to add when attaching a language server autocmds = { -- first key is the `augroup` to add the auto commands to (:h augroup) - lsp_document_highlight = { + lsp_codelens_refresh = { -- Optional condition to create/delete auto command group -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` -- condition will be resolved for each client on each execution and if it ever fails for all clients, -- the auto commands will be deleted for that buffer - cond = "textDocument/documentHighlight", + cond = "textDocument/codeLens", -- cond = function(client, bufnr) return client.name == "lua_ls" end, -- list of auto commands to set { -- events to trigger - event = { "CursorHold", "CursorHoldI" }, + event = { "InsertLeave", "BufEnter" }, -- the rest of the autocmd options (:h nvim_create_autocmd) - desc = "Document Highlighting", - callback = function() vim.lsp.buf.document_highlight() end, - }, - { - event = { "CursorMoved", "CursorMovedI", "BufLeave" }, - desc = "Document Highlighting Clear", - callback = function() vim.lsp.buf.clear_references() end, + desc = "Refresh codelens (buffer)", + callback = function(args) + if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + end, }, }, }, -- mappings to be set up on attaching of a language server mappings = { n = { - gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean - -- gD = { - -- function() vim.lsp.buf.declaration() end, - -- desc = "Declaration of current symbol", - -- cond = "textDocument/declaration", - -- }, - -- ["uY"] = { - -- function() require("astrolsp.toggles").buffer_semantic_tokens() end, - -- desc = "Toggle LSP semantic highlight (buffer)", - -- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, - -- }, + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens + end, + }, }, }, -- A custom `on_attach` function to be run after the default `on_attach` function diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index 634840f..dfc24a2 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -23,7 +23,6 @@ return { opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { - "prettier", "stylua", -- add more arguments for adding more null-ls sources })