astro-nvim-v3 - Update: add context function for neo

This commit is contained in:
huyjaky
2025-08-02 13:03:28 +07:00
parent f0c5a8f756
commit e9e1ab82b3
11 changed files with 360 additions and 331 deletions

View File

@@ -18,6 +18,7 @@ if not pcall(require, "lazy") then
vim.cmd.quit()
end
-- NOTE: ENV
-- Disable Copilot tab mapping
vim.g.copilot_no_tab_map = true

View File

@@ -15,7 +15,6 @@
"catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
@@ -61,16 +60,16 @@
"nvim-highlight-colors": { "branch": "main", "commit": "b42a5ccec7457b44e89f7ed3b3afb1b375bb2093" },
"nvim-lsp-endhints": { "branch": "main", "commit": "7917c7af1ec345ca9b33e8dbcd3723fc15d023c0" },
"nvim-lspconfig": { "branch": "master", "commit": "185b2af444b27d6541c02d662b5b68190e5cf0c4" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" },
"nvim-spider": { "branch": "main", "commit": "6da0307421bc4be6fe02815faabde51007c4ea1a" },
"nvim-treesitter": { "branch": "master", "commit": "f8aaf5ce4e27cd20de917946b2ae5c968a2c2858" },
"nvim-treesitter-context": { "branch": "master", "commit": "6853ecb2cd8b062365da1cdd1a2e6f934ad55ed6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"nvim_context_vt": { "branch": "master", "commit": "4ee3f8fe1b3aacacd31eaf77378dffcad0ff9465" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "97bf4b8ef9298644a29fcd9dd41a0210cf08cac7" },
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
"schemastore.nvim": { "branch": "main", "commit": "67d6c391e9a372d2d8701b5b8c9ae89455561fbf" },
"smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" },

View File

@@ -13,7 +13,7 @@ return {
large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = false, -- enable autopairs at start
cmp = true, -- enable completion at start
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
diagnostics_mode = 2, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
highlighturl = false, -- highlight URLs at start
notifications = true, -- enable notifications at start
},

View File

@@ -4,219 +4,220 @@
---@type LazySpec
return {
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = false, -- enable or disable auto formatting on start
codelens = false, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = require("plugins.configs.lsp.formatting"),
-- enable servers that you already have installed without mason
servers = {},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require("plugins.configs.lsp.config.basedpyright"),
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = false, -- enable or disable auto formatting on start
codelens = false, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = require("plugins.configs.lsp.formatting"),
-- enable servers that you already have installed without mason
servers = {},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require("plugins.configs.lsp.config.basedpyright"),
jedi_language_server = {
init_options = {
completion = {
disableSnippets = true,
},
diagnostics = {
enable = true,
},
jediSettings = {
autoImportModules = {
"numpy",
"pandas",
"torch",
"sklearn",
},
},
workspace = {
environmentPath = "/home/duckq1u/miniconda3/envs/OCR3/bin/python"
}
},
},
jedi_language_server = {
init_options = {
completion = {
disableSnippets = true,
},
diagnostics = {
enable = true,
},
jediSettings = {
autoImportModules = {
"numpy",
"pandas",
"torch",
"sklearn",
},
},
workspace = {
environmentPath = "/home/duckq1u/miniconda3/envs/OCR3/bin/python",
ignore = { "/home/duckq1u/miniconda3/envs/OCR3/lib/python3.11/site-packages/transformers/mode ls/albert/configuration_albert.py" },
},
},
},
ruff = {
init_options = {
settings = {
lint = {
unfixable = { "F401" },
select = {
"ALL",
},
ignore = {
"ANN",
"COM",
"C90",
"DJ",
"EXE",
"T10",
"TID",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D200",
"D205",
"D212",
"D400",
"D401",
"D415",
"E402",
"E501",
"ERA001",
"TRY003",
"TD002",
"TD003",
"T201",
"FIX002",
"N803",
"PD901",
-- "F401",
"I001",
"RET504",
"PLR2004",
"W291",
"PLW2901",
"D213",
"PLR0402",
},
},
ruff = {
init_options = {
settings = {
lint = {
unfixable = { "F401" },
select = {
"ALL",
},
ignore = {
"ANN",
"COM",
"C90",
"DJ",
"EXE",
"T10",
"TID",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D200",
"D205",
"D212",
"D400",
"D401",
"D415",
"E402",
"E501",
"ERA001",
"TRY003",
"TD002",
"TD003",
"T201",
"FIX002",
"N803",
"PD901",
-- "F401",
"I001",
"RET504",
"PLR2004",
"W291",
"PLW2901",
"D213",
"PLR0402",
},
},
args = {},
},
},
},
},
-- customize how language servers are attached
handlers = {
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
-- function(server, opts) require("lspconfig")[server].setup(opts) end
args = {},
},
},
},
},
-- customize how language servers are attached
handlers = {
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
-- function(server, opts) require("lspconfig")[server].setup(opts) end
-- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
},
-- 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 = {
-- 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 = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set
{
-- events to trigger
event = { "CursorHold", "CursorHoldI" },
-- 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,
},
},
-- disable inlay hints in insert mode
disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints
-- (and only if vim.lsp.inlay_hint is available)
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false,
{
-- when going into insert mode
event = "InsertEnter",
desc = "disable inlay hints on insert",
callback = function(args)
local filter = { bufnr = args.buf }
-- if the inlay hints are currently enabled
if vim.lsp.inlay_hint.is_enabled(filter) then
-- disable the inlay hints
vim.lsp.inlay_hint.enable(false, filter)
-- create a single use autocommand to turn the inlay hints back on
-- when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
buffer = args.buf,
once = true,
callback = function()
vim.lsp.inlay_hint.enable(true, filter)
end,
})
end
end,
},
},
},
-- mappings to be set up on attaching of a language server
mappings = {
n = {
gh = {
function()
vim.lsp.buf.hover()
end,
desc = "Hover symbol details",
cond = "textDocument/hover",
},
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",
},
["<Leader>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,
},
},
},
-- A custom `on_attach` function to be run after the default `on_attach` function
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff_lsp" then
client.server_capabilities.hoverProvider = false
end
-- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
},
-- 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 = {
-- 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 = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set
{
-- events to trigger
event = { "CursorHold", "CursorHoldI" },
-- 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,
},
},
-- disable inlay hints in insert mode
disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints
-- (and only if vim.lsp.inlay_hint is available)
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false,
{
-- when going into insert mode
event = "InsertEnter",
desc = "disable inlay hints on insert",
callback = function(args)
local filter = { bufnr = args.buf }
-- if the inlay hints are currently enabled
if vim.lsp.inlay_hint.is_enabled(filter) then
-- disable the inlay hints
vim.lsp.inlay_hint.enable(false, filter)
-- create a single use autocommand to turn the inlay hints back on
-- when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
buffer = args.buf,
once = true,
callback = function()
vim.lsp.inlay_hint.enable(true, filter)
end,
})
end
end,
},
},
},
-- mappings to be set up on attaching of a language server
mappings = {
n = {
gh = {
function()
vim.lsp.buf.hover()
end,
desc = "Hover symbol details",
cond = "textDocument/hover",
},
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",
},
["<Leader>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,
},
},
},
-- A custom `on_attach` function to be run after the default `on_attach` function
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff_lsp" then
client.server_capabilities.hoverProvider = false
end
-- Disable completion feature of pyright
if client.name == "basedpyright" then
client.server_capabilities.completionProvider = false
end
end,
},
-- Disable completion feature of pyright
if client.name == "basedpyright" then
client.server_capabilities.completionProvider = false
end
end,
},
}

View File

@@ -62,33 +62,6 @@ return {
},
},
{
"scottmckendry/cyberdream.nvim",
opts = {
transparent = true,
italic_comments = true,
hide_fillchars = true,
borderless_telescope = false,
terminal_colors = false,
integrations = { rainbow_delimiters = true },
},
},
{
"loctvl842/monokai-pro.nvim",
opts = {
terminal_colors = true,
devicons = true, -- highlight the icons of `nvim-web-devicons`
filter = "pro", -- classic | octagon | pro | machine | ristretto | spectrum
plugins = {
indent_blankline = {
context_highlight = "pro", -- default | pro
context_start_underline = false,
},
},
},
},
-- Using lazy.nvim
{
"ribru17/bamboo.nvim",

View File

@@ -1,8 +1,8 @@
return {
init = function() -- this table overrides highlights in all themes
local get_hlgroup = require("astroui").get_hlgroup
local ui = require "astroui"
local utils = require "astrocore"
local ui = require("astroui")
local utils = require("astrocore")
local hl = {
-- remove background of virtual texts

View File

@@ -1,46 +1,55 @@
-- Plugins to disable
return {
{ "s1n7ax/nvim-window-picker", enabled = false },
{ "akinsho/toggleterm.nvim", enabled = false },
{ "NvChad/nvim-colorizer.lua", enabled = false },
{ "catppuccin/nvim", name = "catppuccin", enabled = false },
{ "rebelot/kanagawa.nvim", enabled = false },
{ "folke/tokyonight.nvim", enabled = false },
{ "f4z3r/gruvbox-material.nvim", name = "gruvbox-material", enabled = false },
{ "b0o/SchemaStore.nvim", enabled = false },
{ "ray-x/lsp_signature.nvim", enabled = false },
{ "kmontocam/nvim-conda", enabled = false },
{ "NMAC427/guess-indent.nvim", enabled = false },
{ "lukas-reineke/indent-blankline.nvim", enabled = false },
{ "AstroNvim/astrotheme", enabled = false },
{ "scottmckendry/cyberdream.nvim", enabled = false },
{ "xiyaowong/transparent.nvim", enabled = false },
{ "loctvl842/monokai-pro.nvim", enabled = false },
{ "xiyaowong/transparent.nvim", enabled = false },
{ "iamcco/markdown-preview.nvim", enabled = false },
{ "max397574/better-escape.nvim", enabled = false },
{ "hinell/duplicate.nvim", enabled = false },
{ "CRAG666/code_runner.nvim", enabled = false },
{ "RRethy/vim-illuminate", enabled = false },
{ "OXY2DEV/markview.nvim", enabled = false },
{ "kevinhwang91/nvim-ufo", enabled = false },
{ "s1n7ax/nvim-window-picker", enabled = false },
{ "akinsho/toggleterm.nvim", enabled = false },
{ "NvChad/nvim-colorizer.lua", enabled = false },
{ "catppuccin/nvim", name = "catppuccin", enabled = false },
{ "rebelot/kanagawa.nvim", enabled = false },
{ "folke/tokyonight.nvim", enabled = false },
{ "f4z3r/gruvbox-material.nvim", name = "gruvbox-material", enabled = false },
{ "b0o/SchemaStore.nvim", enabled = false },
{ "ray-x/lsp_signature.nvim", enabled = false },
{ "kmontocam/nvim-conda", enabled = false },
{ "NMAC427/guess-indent.nvim", enabled = false },
{ "lukas-reineke/indent-blankline.nvim", enabled = false },
{ "AstroNvim/astrotheme", enabled = false },
{ "scottmckendry/cyberdream.nvim", enabled = false },
{ "xiyaowong/transparent.nvim", enabled = false },
{ "loctvl842/monokai-pro.nvim", enabled = false },
{ "xiyaowong/transparent.nvim", enabled = false },
{ "iamcco/markdown-preview.nvim", enabled = false },
{ "max397574/better-escape.nvim", enabled = false },
{ "hinell/duplicate.nvim", enabled = false },
{ "CRAG666/code_runner.nvim", enabled = false },
{ "RRethy/vim-illuminate", enabled = false },
{ "OXY2DEV/markview.nvim", enabled = false },
{ "kevinhwang91/nvim-ufo", enabled = false },
{ "echasnovski/mini.bufremove", enabled = false },
-- interface
-- { "HiPhish/rainbow-delimiters.nvim", enabled = true },
{ "ribru17/bamboo.nvim", enabled = true },
-- System
{ "nvim-treesitter/nvim-treesitter-textobjects", enabled = false },
-- Disable Dap
{ "mfussenegger/nvim-dap", enabled = false },
{ "theHamsta/nvim-dap-virtual-text", enabled = false },
{ "rcarriga/nvim-dap-ui", enabled = false },
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
-- service
{ "stevearc/resession.nvim", enabled = true },
{ "echasnovski/mini.move", enabled = true },
{ "nvim-neo-tree/neo-tree.nvim", enabled = true },
{ "folke/flash.nvim", enabled = true },
{ "github/copilot.vim", enabled = true },
-- interface
-- { "HiPhish/rainbow-delimiters.nvim", enabled = true },
{ "ribru17/bamboo.nvim", enabled = true },
{ "rafamadriz/friendly-snippets", enabled = false },
{ "JoosepAlviste/nvim-ts-context-commentstring", enabled = false },
{ "windwp/nvim-ts-autotag", enabled = false },
{ "saadparwaiz1/cmp_luasnip", enabled = false },
{ "L3MON4D3/LuaSnip", enabled = true },
-- service
{ "stevearc/resession.nvim", enabled = true },
{ "echasnovski/mini.move", enabled = true },
{ "nvim-neo-tree/neo-tree.nvim", enabled = true },
{ "folke/flash.nvim", enabled = true },
{ "github/copilot.vim", enabled = true },
{ "rafamadriz/friendly-snippets", enabled = false },
{ "JoosepAlviste/nvim-ts-context-commentstring", enabled = false },
{ "windwp/nvim-ts-autotag", enabled = false },
{ "saadparwaiz1/cmp_luasnip", enabled = false },
{ "L3MON4D3/LuaSnip", enabled = true },
}
-- if true then return {} end

View File

@@ -250,17 +250,4 @@ return {
-- },
-- },
-- Markdown preview support
{
"OXY2DEV/markview.nvim",
dependencies = {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "markdown", "markdown_inline" })
end,
},
},
ft = { "markdown" },
},
}

View File

@@ -0,0 +1,22 @@
---@type LazySpec
return {
"andersevenrud/nvim_context_vt",
event = "User AstroFile",
cmd = { "NvimContextVtToggle" },
dependencies = {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
["<Leader>uv"] = {
function()
require("nvim_context_vt").toggle()
end,
desc = "Toggle virutal text context",
},
},
},
},
},
}

View File

@@ -0,0 +1,28 @@
---@type LazySpec
return {
"nvim-treesitter/nvim-treesitter-context",
event = "User AstroFile",
cmd = { "TSContext" },
opts = {
-- không có option trực tiếp cho border, nên ta set highlight ở đây
on_attach = function()
vim.api.nvim_set_hl(0, "TreesitterContext", { underline = true, sp = "Red", bg = "#1e1e3f" })
end,
max_lines = 2, -- 0 means no limit
},
dependencies = {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
["<Leader>uT"] = {
"<cmd>TSContext toggle<CR>",
desc = "Toggle treesitter context",
},
},
},
},
},
}

View File

@@ -38,39 +38,39 @@ return {
-- { "<Leader>uT", "<Cmd>TransparentToggle<CR>", desc = "Toggle transparent" },
-- },
-- },
{
{
"HiPhish/rainbow-delimiters.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>u("] = {
function()
local bufnr = vim.api.nvim_get_current_buf()
require("rainbow-delimiters").toggle(bufnr)
require("astrocore").notify(
string.format(
"Buffer rainbow delimeters %s",
require("rainbow-delimiters").is_enabled(bufnr) and "on" or "off"
)
)
end,
desc = "Toggle rainbow delimeters (buffer)",
},
},
},
},
},
},
event = "User AstroFile",
main = "rainbow-delimiters.setup",
opts = {},
},
},
-- {
-- {
-- "HiPhish/rainbow-delimiters.nvim",
-- dependencies = {
-- "nvim-treesitter/nvim-treesitter",
-- {
-- "AstroNvim/astrocore",
-- opts = {
-- mappings = {
-- n = {
-- ["<Leader>u("] = {
-- function()
-- local bufnr = vim.api.nvim_get_current_buf()
-- require("rainbow-delimiters").toggle(bufnr)
-- require("astrocore").notify(
-- string.format(
-- "Buffer rainbow delimeters %s",
-- require("rainbow-delimiters").is_enabled(bufnr) and "on" or "off"
-- )
-- )
-- end,
-- desc = "Toggle rainbow delimeters (buffer)",
-- },
-- },
-- },
-- },
-- },
-- },
-- event = "User AstroFile",
-- main = "rainbow-delimiters.setup",
-- opts = {},
-- },
-- },
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
@@ -108,7 +108,9 @@ return {
-- disable in comments
-- https://github.com/altermo/ultimate-autopair.nvim/blob/6fd0d6aa976a97dd6f1bed4d46be1b437613a52f/Q%26A.md?plain=1#L26
cond = {
function(fn) return not fn.in_node "comment" end,
function(fn)
return not fn.in_node("comment")
end,
},
},
-- get fly mode working on strings:
@@ -136,14 +138,21 @@ return {
desc = "Toggle Ultimate Autopair",
function()
local notify = require("astrocore").notify
local function bool2str(bool) return bool and "on" or "off" end
local function bool2str(bool)
return bool and "on" or "off"
end
local ok, ultimate_autopair = pcall(require, "ultimate-autopair")
if ok then
ultimate_autopair.toggle()
vim.g.ultimate_autopair_enabled = require("ultimate-autopair.core").disable
notify(string.format("ultimate-autopair %s", bool2str(not vim.g.ultimate_autopair_enabled)))
notify(
string.format(
"ultimate-autopair %s",
bool2str(not vim.g.ultimate_autopair_enabled)
)
)
else
notify "ultimate-autopair not available"
notify("ultimate-autopair not available")
end
end,
},