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() vim.cmd.quit()
end end
-- NOTE: ENV -- NOTE: ENV
-- Disable Copilot tab mapping -- Disable Copilot tab mapping
vim.g.copilot_no_tab_map = true vim.g.copilot_no_tab_map = true

View File

@@ -15,7 +15,6 @@
"catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" }, "catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
@@ -61,16 +60,16 @@
"nvim-highlight-colors": { "branch": "main", "commit": "b42a5ccec7457b44e89f7ed3b3afb1b375bb2093" }, "nvim-highlight-colors": { "branch": "main", "commit": "b42a5ccec7457b44e89f7ed3b3afb1b375bb2093" },
"nvim-lsp-endhints": { "branch": "main", "commit": "7917c7af1ec345ca9b33e8dbcd3723fc15d023c0" }, "nvim-lsp-endhints": { "branch": "main", "commit": "7917c7af1ec345ca9b33e8dbcd3723fc15d023c0" },
"nvim-lspconfig": { "branch": "master", "commit": "185b2af444b27d6541c02d662b5b68190e5cf0c4" }, "nvim-lspconfig": { "branch": "master", "commit": "185b2af444b27d6541c02d662b5b68190e5cf0c4" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" },
"nvim-spider": { "branch": "main", "commit": "6da0307421bc4be6fe02815faabde51007c4ea1a" }, "nvim-spider": { "branch": "main", "commit": "6da0307421bc4be6fe02815faabde51007c4ea1a" },
"nvim-treesitter": { "branch": "master", "commit": "f8aaf5ce4e27cd20de917946b2ae5c968a2c2858" }, "nvim-treesitter": { "branch": "master", "commit": "f8aaf5ce4e27cd20de917946b2ae5c968a2c2858" },
"nvim-treesitter-context": { "branch": "master", "commit": "6853ecb2cd8b062365da1cdd1a2e6f934ad55ed6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" }, "nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"nvim_context_vt": { "branch": "master", "commit": "4ee3f8fe1b3aacacd31eaf77378dffcad0ff9465" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "97bf4b8ef9298644a29fcd9dd41a0210cf08cac7" },
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
"schemastore.nvim": { "branch": "main", "commit": "67d6c391e9a372d2d8701b5b8c9ae89455561fbf" }, "schemastore.nvim": { "branch": "main", "commit": "67d6c391e9a372d2d8701b5b8c9ae89455561fbf" },
"smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" }, "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 large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = false, -- enable autopairs at start autopairs = false, -- enable autopairs at start
cmp = true, -- enable completion 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 highlighturl = false, -- highlight URLs at start
notifications = true, -- enable notifications at start notifications = true, -- enable notifications at start
}, },

View File

@@ -4,219 +4,220 @@
---@type LazySpec ---@type LazySpec
return { return {
"AstroNvim/astrolsp", "AstroNvim/astrolsp",
---@type AstroLSPOpts ---@type AstroLSPOpts
opts = { opts = {
-- Configuration table of features provided by AstroLSP -- Configuration table of features provided by AstroLSP
features = { features = {
autoformat = false, -- enable or disable auto formatting on start autoformat = false, -- enable or disable auto formatting on start
codelens = false, -- enable/disable codelens refresh on start codelens = false, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting semantic_tokens = true, -- enable/disable semantic token highlighting
}, },
-- customize lsp formatting options -- customize lsp formatting options
formatting = require("plugins.configs.lsp.formatting"), formatting = require("plugins.configs.lsp.formatting"),
-- enable servers that you already have installed without mason -- enable servers that you already have installed without mason
servers = {}, servers = {},
-- customize language server configuration options passed to `lspconfig` -- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields ---@diagnostic disable: missing-fields
config = { config = {
-- clangd = require "plugins.configs.lsp.config.clangd", -- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require("plugins.configs.lsp.config.basedpyright"), basedpyright = require("plugins.configs.lsp.config.basedpyright"),
jedi_language_server = { jedi_language_server = {
init_options = { init_options = {
completion = { completion = {
disableSnippets = true, disableSnippets = true,
}, },
diagnostics = { diagnostics = {
enable = true, enable = true,
}, },
jediSettings = { jediSettings = {
autoImportModules = { autoImportModules = {
"numpy", "numpy",
"pandas", "pandas",
"torch", "torch",
"sklearn", "sklearn",
}, },
}, },
workspace = { workspace = {
environmentPath = "/home/duckq1u/miniconda3/envs/OCR3/bin/python" 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 = { ruff = {
init_options = { init_options = {
settings = { settings = {
lint = { lint = {
unfixable = { "F401" }, unfixable = { "F401" },
select = { select = {
"ALL", "ALL",
}, },
ignore = { ignore = {
"ANN", "ANN",
"COM", "COM",
"C90", "C90",
"DJ", "DJ",
"EXE", "EXE",
"T10", "T10",
"TID", "TID",
"D100", "D100",
"D101", "D101",
"D102", "D102",
"D103", "D103",
"D104", "D104",
"D105", "D105",
"D106", "D106",
"D107", "D107",
"D200", "D200",
"D205", "D205",
"D212", "D212",
"D400", "D400",
"D401", "D401",
"D415", "D415",
"E402", "E402",
"E501", "E501",
"ERA001", "ERA001",
"TRY003", "TRY003",
"TD002", "TD002",
"TD003", "TD003",
"T201", "T201",
"FIX002", "FIX002",
"N803", "N803",
"PD901", "PD901",
-- "F401", -- "F401",
"I001", "I001",
"RET504", "RET504",
"PLR2004", "PLR2004",
"W291", "W291",
"PLW2901", "PLW2901",
"D213", "D213",
"PLR0402", "PLR0402",
}, },
}, },
args = {}, args = {},
}, },
}, },
}, },
}, },
-- customize how language servers are attached -- customize how language servers are attached
handlers = { 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 -- 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 -- function(server, opts) require("lspconfig")[server].setup(opts) end
-- the key is the server that is being setup with `lspconfig` -- 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 -- 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 -- 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 -- 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_document_highlight = {
-- 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/documentHighlight",
-- 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 = { "CursorHold", "CursorHoldI" },
-- the rest of the autocmd options (:h nvim_create_autocmd) -- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting", desc = "Document Highlighting",
callback = function() callback = function()
vim.lsp.buf.document_highlight() vim.lsp.buf.document_highlight()
end, end,
}, },
{ {
event = { "CursorMoved", "CursorMovedI", "BufLeave" }, event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear", desc = "Document Highlighting Clear",
callback = function() callback = function()
vim.lsp.buf.clear_references() vim.lsp.buf.clear_references()
end, end,
}, },
}, },
-- disable inlay hints in insert mode -- disable inlay hints in insert mode
disable_inlay_hints_on_insert = { disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints -- only create for language servers that support inlay hints
-- (and only if vim.lsp.inlay_hint is available) -- (and only if vim.lsp.inlay_hint is available)
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false, cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false,
{ {
-- when going into insert mode -- when going into insert mode
event = "InsertEnter", event = "InsertEnter",
desc = "disable inlay hints on insert", desc = "disable inlay hints on insert",
callback = function(args) callback = function(args)
local filter = { bufnr = args.buf } local filter = { bufnr = args.buf }
-- if the inlay hints are currently enabled -- if the inlay hints are currently enabled
if vim.lsp.inlay_hint.is_enabled(filter) then if vim.lsp.inlay_hint.is_enabled(filter) then
-- disable the inlay hints -- disable the inlay hints
vim.lsp.inlay_hint.enable(false, filter) vim.lsp.inlay_hint.enable(false, filter)
-- create a single use autocommand to turn the inlay hints back on -- create a single use autocommand to turn the inlay hints back on
-- when leaving insert mode -- when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", { vim.api.nvim_create_autocmd("InsertLeave", {
buffer = args.buf, buffer = args.buf,
once = true, once = true,
callback = function() callback = function()
vim.lsp.inlay_hint.enable(true, filter) vim.lsp.inlay_hint.enable(true, filter)
end, end,
}) })
end end
end, 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 = {
gh = { gh = {
function() function()
vim.lsp.buf.hover() vim.lsp.buf.hover()
end, end,
desc = "Hover symbol details", desc = "Hover symbol details",
cond = "textDocument/hover", cond = "textDocument/hover",
}, },
gl = { gl = {
function() function()
vim.diagnostic.open_float() vim.diagnostic.open_float()
end, end,
desc = "Hover diagnostics", 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() function()
vim.lsp.buf.declaration() vim.lsp.buf.declaration()
end, end,
desc = "Declaration of current symbol", desc = "Declaration of current symbol",
cond = "textDocument/declaration", cond = "textDocument/declaration",
}, },
["<Leader>uY"] = { ["<Leader>uY"] = {
function() function()
require("astrolsp.toggles").buffer_semantic_tokens() require("astrolsp.toggles").buffer_semantic_tokens()
end, end,
desc = "Toggle LSP semantic highlight (buffer)", desc = "Toggle LSP semantic highlight (buffer)",
cond = function(client) cond = function(client)
return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens
end, 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
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients -- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil -- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright -- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff_lsp" then if client.name == "ruff_lsp" then
client.server_capabilities.hoverProvider = false client.server_capabilities.hoverProvider = false
end end
-- Disable completion feature of pyright -- Disable completion feature of pyright
if client.name == "basedpyright" then if client.name == "basedpyright" then
client.server_capabilities.completionProvider = false client.server_capabilities.completionProvider = false
end end
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 -- Using lazy.nvim
{ {
"ribru17/bamboo.nvim", "ribru17/bamboo.nvim",

View File

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

View File

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

View File

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