Update treesitter

This commit is contained in:
a.shalimov 2026-09-21 17:19:55 +03:00
parent d623d74c5d
commit 0abf2af78b
5 changed files with 34 additions and 31 deletions

View file

@ -65,8 +65,7 @@ local function fzf_lua_markdown_headings()
end end
local query = vim.treesitter.query.parse('markdown', [[ local query = vim.treesitter.query.parse('markdown', [[
(atx_heading (atx_heading) @heading
(atx_h1_marker)) @heading
]]) ]])
local tree = parser:parse()[1] local tree = parser:parse()[1]
@ -75,7 +74,7 @@ local function fzf_lua_markdown_headings()
for id, node in query:iter_captures(root, bufnr, 0, -1) do for id, node in query:iter_captures(root, bufnr, 0, -1) do
local start_row, start_col, end_row, end_col = node:range() local start_row, start_col, end_row, end_col = node:range()
local lnum = start_row + 1 -- Treesitter is 0-indexed, Vim is 1-indexed local lnum = start_row + 1 -- Treesitter is 0-indexed, Vim is 1-indexed
local text = vim.treesitter.get_node_text(node, bufnr) local text = vim.treesitter.get_node_text(node, bufnr):gsub("%s+$", "")
table.insert(headings, { table.insert(headings, {
lnum = lnum, lnum = lnum,

View file

@ -30,6 +30,10 @@ local servers = {
settings = { settings = {
-- Ruff language server settings go here -- Ruff language server settings go here
logLevel = "error", logLevel = "error",
lint = {
-- I001: import block un-sorted/un-formatted (isort)
ignore = { "I001", "UP032" },
},
}, },
}, },
}, },

View file

@ -1,13 +1,7 @@
return { return {
"nvim-treesitter/nvim-treesitter", 'nvim-treesitter/nvim-treesitter',
-- open this plugin on two events: lazy = false,
-- BufReadPre - open existing file build = ':TSUpdate',
-- BufNewFile - open new file
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate", -- Run whenever this plugin is installed or updated
dependencies = {
"windwp/nvim-ts-autotag", -- Auto-closing functionality within treesitter
},
config = function() config = function()
require "custom/treesitter" require "custom/treesitter"
end, end,

View file

@ -1,18 +1,24 @@
require 'nvim-treesitter.configs'.setup { local parsers = {
ensure_installed = { "python",
"python", "lua",
"lua", "vim",
"vim", "vimdoc",
"vimdoc", "query",
"query", "elixir",
"elixir", "heex",
"heex", "javascript",
"javascript", "html",
"html", "go",
"go", "markdown",
"markdown", "markdown_inline",
},
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
} }
require("nvim-treesitter").install(parsers)
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
pcall(vim.treesitter.start)
end,
})

View file

@ -21,8 +21,8 @@ opt.softtabstop = 2
-- Disable swap files creation -- Disable swap files creation
opt.swapfile = false opt.swapfile = false
-- Add line at 80 symbols -- Add line at 100 symbols
opt.colorcolumn = "99" opt.colorcolumn = "100"
-- config to set up clipboard as default register -- config to set up clipboard as default register
opt.clipboard:append("unnamedplus") opt.clipboard:append("unnamedplus")