From 0abf2af78b45376666ab6efbc72f227d439fc0bc Mon Sep 17 00:00:00 2001 From: "a.shalimov" Date: Mon, 21 Sep 2026 17:19:55 +0300 Subject: [PATCH] Update treesitter --- ftplugin/markdown.lua | 5 ++-- lua/custom/lsp.lua | 4 ++++ lua/custom/plugins/treesitter.lua | 12 +++------- lua/custom/treesitter.lua | 40 ++++++++++++++++++------------- plugin/options.lua | 4 ++-- 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua index d32d7ff..59f4a87 100644 --- a/ftplugin/markdown.lua +++ b/ftplugin/markdown.lua @@ -65,8 +65,7 @@ local function fzf_lua_markdown_headings() end local query = vim.treesitter.query.parse('markdown', [[ - (atx_heading - (atx_h1_marker)) @heading + (atx_heading) @heading ]]) 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 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 text = vim.treesitter.get_node_text(node, bufnr) + local text = vim.treesitter.get_node_text(node, bufnr):gsub("%s+$", "") table.insert(headings, { lnum = lnum, diff --git a/lua/custom/lsp.lua b/lua/custom/lsp.lua index b2e71ad..b89c18a 100644 --- a/lua/custom/lsp.lua +++ b/lua/custom/lsp.lua @@ -30,6 +30,10 @@ local servers = { settings = { -- Ruff language server settings go here logLevel = "error", + lint = { + -- I001: import block un-sorted/un-formatted (isort) + ignore = { "I001", "UP032" }, + }, }, }, }, diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index 2b2979a..b7faedc 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -1,13 +1,7 @@ return { - "nvim-treesitter/nvim-treesitter", - -- open this plugin on two events: - -- BufReadPre - open existing file - -- 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 - }, + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate', config = function() require "custom/treesitter" end, diff --git a/lua/custom/treesitter.lua b/lua/custom/treesitter.lua index 6ab4f17..1d3ac0d 100644 --- a/lua/custom/treesitter.lua +++ b/lua/custom/treesitter.lua @@ -1,18 +1,24 @@ -require 'nvim-treesitter.configs'.setup { - ensure_installed = { - "python", - "lua", - "vim", - "vimdoc", - "query", - "elixir", - "heex", - "javascript", - "html", - "go", - "markdown", - }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, +local parsers = { + "python", + "lua", + "vim", + "vimdoc", + "query", + "elixir", + "heex", + "javascript", + "html", + "go", + "markdown", + "markdown_inline", } + +require("nvim-treesitter").install(parsers) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function() + pcall(vim.treesitter.start) + end, +}) + diff --git a/plugin/options.lua b/plugin/options.lua index c95973e..71c8096 100644 --- a/plugin/options.lua +++ b/plugin/options.lua @@ -21,8 +21,8 @@ opt.softtabstop = 2 -- Disable swap files creation opt.swapfile = false --- Add line at 80 symbols -opt.colorcolumn = "99" +-- Add line at 100 symbols +opt.colorcolumn = "100" -- config to set up clipboard as default register opt.clipboard:append("unnamedplus")