chore: make demonstrated examples the default values of AstroNvim

This commit is contained in:
Micah Halter 2024-05-22 09:13:33 -04:00
parent 5aedbc8d99
commit 8a474001f4
No known key found for this signature in database
GPG Key ID: 4224A6EA9A8CAAA8
3 changed files with 29 additions and 34 deletions

View File

@ -30,7 +30,7 @@ return {
relativenumber = true, -- sets vim.opt.relativenumber relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell 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 wrap = false, -- sets vim.opt.wrap
}, },
g = { -- vim.g.<key> g = { -- vim.g.<key>
@ -46,28 +46,26 @@ return {
n = { n = {
-- second key is the lefthand side of the map -- second key is the lefthand side of the map
-- navigate buffer tabs with `H` and `L` -- navigate buffer tabs
L = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, ["[b"] = { 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" }, ["]b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
-- mappings seen under group name "Buffer" -- mappings seen under group name "Buffer"
["<Leader>bD"] = { ["<Leader>bd"] = {
function() function()
require("astroui.status.heirline").buffer_picker( require("astroui.status.heirline").buffer_picker(
function(bufnr) require("astrocore.buffer").close(bufnr) end function(bufnr) require("astrocore.buffer").close(bufnr) end
) )
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 -- tables with just a `desc` key will be registered with which-key if it's installed
-- this is useful for naming menus -- this is useful for naming menus
["<Leader>b"] = { desc = "Buffers" }, -- ["<Leader>b"] = { desc = "Buffers" },
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
},
t = {
-- setting a mapping to false will disable it -- setting a mapping to false will disable it
-- ["<esc>"] = false, -- ["<C-S>"] = false,
}, },
}, },
}, },

View File

@ -59,43 +59,41 @@ return {
-- Configure buffer local auto commands to add when attaching a language server -- Configure buffer local auto commands to add when attaching a language server
autocmds = { autocmds = {
-- first key is the `augroup` to add the auto commands to (:h augroup) -- 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 -- 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` -- 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, -- 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 -- 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, -- cond = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set -- list of auto commands to set
{ {
-- events to trigger -- events to trigger
event = { "CursorHold", "CursorHoldI" }, event = { "InsertLeave", "BufEnter" },
-- the rest of the autocmd options (:h nvim_create_autocmd) -- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting", desc = "Refresh codelens (buffer)",
callback = function() vim.lsp.buf.document_highlight() end, callback = function(args)
}, if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end
{ end,
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function() vim.lsp.buf.clear_references() end,
}, },
}, },
}, },
-- mappings to be set up on attaching of a language server -- mappings to be set up on attaching of a language server
mappings = { mappings = {
n = { 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 -- 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 = { gD = {
-- function() vim.lsp.buf.declaration() end, function() vim.lsp.buf.declaration() end,
-- desc = "Declaration of current symbol", desc = "Declaration of current symbol",
-- cond = "textDocument/declaration", cond = "textDocument/declaration",
-- }, },
-- ["<Leader>uY"] = { ["<Leader>uY"] = {
-- function() require("astrolsp.toggles").buffer_semantic_tokens() end, function() require("astrolsp.toggles").buffer_semantic_tokens() end,
-- desc = "Toggle LSP semantic highlight (buffer)", desc = "Toggle LSP semantic highlight (buffer)",
-- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, 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 -- A custom `on_attach` function to be run after the default `on_attach` function

View File

@ -23,7 +23,6 @@ return {
opts = function(_, opts) opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it -- 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, { opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"prettier",
"stylua", "stylua",
-- add more arguments for adding more null-ls sources -- add more arguments for adding more null-ls sources
}) })