all repos

init.lua @ f34d2051bfe62682b9ac90f631c47f0ccd042823

my nvim config
2 files changed, 68 insertions(+), 60 deletions(-)
refactor(treesitter): move  ts-context-commentstring to treesitter file
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2024-10-30 00:01:08 +0200
Parent: 9befaea
M lua/plugins/core.lua

@@ -35,17 +35,4 @@ check_ts = true,

disable_filetype = { "TelescopePrompt", "markdown" }, }, }, - { - "JoosepAlviste/nvim-ts-context-commentstring", - lazy = false, - init = function() - local get_option = vim.filetype.get_option - vim.filetype.get_option = function(filetype, option) ---@diagnostic disable-line: duplicate-set-field - -- stylua: ignore - return option == "commentstring" - and require("ts_context_commentstring.internal").calculate_commentstring() - or get_option(filetype, option) - end - end, - }, }
M lua/plugins/treesitter.lua

@@ -1,53 +1,74 @@

---@type LazySpec return { - "nvim-treesitter/nvim-treesitter", - event = "BufReadPost", - dependencies = { - "RRethy/nvim-treesitter-endwise", - { "nvim-treesitter/nvim-treesitter-context", config = true }, - { - "lukas-reineke/headlines.nvim", - config = function() - require("headlines").setup { - go = { - codeblock_highlight = "ColorColumn", - query = vim.treesitter.query.parse( - "go", - [[([(raw_string_literal) - (interpreted_string_literal)] @codeblock - (#match? @codeblock "--sql" "-- sql" "--SQL" "-- SQL") - (#offset! @codeblock 0 0 1 0))]] - ), - }, - gleam = { - codeblock_highlight = "ColorColumn", - query = vim.treesitter.query.parse( - "gleam", - [[((let - pattern: (identifier) @_identifier - (#any-of? @_identifier "sql" "q" "query") - value: (string (quoted_content) @codeblock)) - (#offset! @codeblock 0 0 1 0))]] - ), - }, - } - end, + { + "nvim-treesitter/nvim-treesitter", + event = "BufReadPost", + dependencies = { + "RRethy/nvim-treesitter-endwise", + { "nvim-treesitter/nvim-treesitter-context", config = true }, + { + "lukas-reineke/headlines.nvim", + config = function() + require("headlines").setup { + go = { + codeblock_highlight = "ColorColumn", + query = vim.treesitter.query.parse( + "go", + [[([(raw_string_literal) + (interpreted_string_literal)] @codeblock + (#match? @codeblock "--sql" "-- sql" "--SQL" "-- SQL") + (#offset! @codeblock 0 0 1 0))]] + ), + }, + gleam = { + codeblock_highlight = "ColorColumn", + query = vim.treesitter.query.parse( + "gleam", + [[((let + pattern: (identifier) @_identifier + (#any-of? @_identifier "sql" "q" "query") + value: (string (quoted_content) @codeblock)) + (#offset! @codeblock 0 0 1 0))]] + ), + }, + } + end, + }, + }, + build = function() + pcall(vim.cmd.TSUpdate) + end, + ---@type TSConfig + ---@diagnostic disable-next-line: missing-fields + opts = { + auto_install = true, + ensure_installed = { + "sql", + "markdown", + "markdown_inline", + "vim", + "query", + }, + indent = { enable = true, disable = { "python" } }, + highlight = { enable = true, additional_vim_regex_highlighting = false }, + autopairs = { enable = true }, + endwise = { enable = true }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, }, - build = function() - pcall(vim.cmd.TSUpdate) - end, - ---@type TSConfig - ---@diagnostic disable-next-line: missing-fields - opts = { - auto_install = true, - ensure_installed = { "sql", "markdown", "markdown_inline", "vim", "query" }, - indent = { enable = true, disable = { "python" } }, - highlight = { enable = true, additional_vim_regex_highlighting = false }, - autopairs = { enable = true }, - endwise = { enable = true }, + { + "JoosepAlviste/nvim-ts-context-commentstring", + lazy = false, + init = function() + local get_option = vim.filetype.get_option + vim.filetype.get_option = function(filetype, option) ---@diagnostic disable-line: duplicate-set-field + -- stylua: ignore + return option == "commentstring" + and require("ts_context_commentstring.internal").calculate_commentstring() + or get_option(filetype, option) + end + end, }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, }