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

@@ -41,8 +41,9 @@ return {
}, },
}, },
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" },
},
}, },
}, },

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

@@ -24,6 +24,15 @@ return {
{ "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 },
-- 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 },
-- interface -- interface
-- { "HiPhish/rainbow-delimiters.nvim", enabled = true }, -- { "HiPhish/rainbow-delimiters.nvim", enabled = true },

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,
}, },