### Configure tree-sitter-manager.nvim setup Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Call the setup function once before using the plugin. This example shows default options and how to override them. ```lua require("tree-sitter-manager").setup({ parser_dir = vim.fn.stdpath("data") .. "/site/parser", query_dir = vim.fn.stdpath("data") .. "/site/queries", languages = {}, ensure_installed = {}, border = nil, auto_install = false, highlight = true, nohighlight = {}, }) ``` -------------------------------- ### Install tree-sitter-manager.nvim with vim-plug Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Add this line to your vim-plug configuration to install the plugin. Then, require the setup function in your init.lua. ```vim Plug 'romus204/tree-sitter-manager.nvim' ``` ```lua require("tree-sitter-manager").setup({}) ``` -------------------------------- ### Install parsers automatically Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Define a list of parsers to be installed automatically during the setup process. ```lua -- Automatic installation via ensure_installed require("tree-sitter-manager").setup({ ensure_installed = { "bash", "c", "cpp", "go", "html", "css", "json", "yaml" } }) ``` -------------------------------- ### Install tree-sitter-manager.nvim with lazy.nvim Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Configuration for installing the plugin using lazy.nvim. Ensure the tree-sitter CLI is installed system-wide. ```lua { "romus204/tree-sitter-manager.nvim", dependencies = {}, -- tree-sitter CLI must be installed system-wide config = function() require("tree-sitter-manager").setup({ -- Default Options -- ensure_installed = {}, -- list of parsers to install at the start of a neovim session -- border = nil, -- border style for the window (e.g. "rounded", "single"), if nil, use the default border style defined by 'vim.o.winborder'. See :h 'winborder' for more info. -- auto_install = false, -- if enabled, install missing parsers when editing a new file -- highlight = true, -- treesitter highlighting is enabled by default -- languages = {}, -- override or add new parser sources -- parser_dir = vim.fn.stdpath("data") .. "/site/parser", -- query_dir = vim.fn.stdpath("data") .. "/site/queries", }) end } ``` -------------------------------- ### Setup API Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt The `setup()` function is used to configure the tree-sitter-manager plugin. It must be called once before using the plugin. ```APIDOC ## tree-sitter-manager.setup() ### Description Initializes the tree-sitter-manager plugin with the provided configuration options. ### Method `setup` ### Parameters #### Request Body - **parser_dir** (string) - Optional - Directory where compiled parser `.so`/`.dll` files are stored. Defaults to `vim.fn.stdpath("data") .. "/site/parser"`. - **query_dir** (string) - Optional - Directory where query files (`highlights.scm`, etc.) are stored. Defaults to `vim.fn.stdpath("data") .. "/site/queries"`. - **languages** (table) - Optional - Override built-in language definitions or add new ones. See |tree-sitter-manager-custom-repos| for details. Defaults to `{}`. - **ensure_installed** (string[]) - Optional - List of parsers to install automatically at startup (if not already installed). Example: `{"lua", "python", "rust"}`. Defaults to `{}`. - **border** (string|table|nil) - Optional - Defines the border style for the TUI. Defaults to `nil`. - **auto_install** (boolean) - Optional - If true, automatically installs parsers on FileType events. Defaults to `false`. - **highlight** (boolean) - Optional - If true, enables automatic query file management for syntax highlighting. Defaults to `true`. - **nohighlight** (string[]) - Optional - List of languages for which highlighting should be disabled. Defaults to `{}`. ### Request Example ```lua require("tree-sitter-manager").setup({ parser_dir = vim.fn.stdpath("data") .. "/site/parser", query_dir = vim.fn.stdpath("data") .. "/site/queries", languages = {}, ensure_installed = { "lua", "python", "rust" }, border = nil, auto_install = false, highlight = true, nohighlight = {}, }) ``` ### Response This function does not return a value. ``` -------------------------------- ### Install tree-sitter-manager.nvim with vim.pack Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Configuration for installing the plugin using vim.pack. The tree-sitter CLI must be installed system-wide. ```lua vim.pack.add { { src = "https://github.com/romus204/tree-sitter-manager.nvim" } } require("tree-sitter-manager").setup({ -- Default Options -- ensure_installed = {}, -- list of parsers to install at the start of a neovim session -- border = nil, -- border style for the window (e.g. "rounded", "single"), if nil, use the default border style defined by 'vim.o.winborder'. See :h 'winborder' for more info. -- auto_install = false, -- if enabled, install missing parsers when editing a new file -- highlight = true, -- treesitter highlighting is enabled by default -- languages = {}, -- override or add new parser sources -- parser_dir = vim.fn.stdpath("data") .. "/site/parser", -- query_dir = vim.fn.stdpath("data") .. "/site/queries", }) ``` -------------------------------- ### Configure ensure_installed option Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt List parsers to install automatically at startup if they are not already installed. This option takes an array of strings. ```lua ensure_installed = { "lua", "python", "rust" } ``` -------------------------------- ### Add a new language parser Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Configure the plugin to install a parser for a language not included by default. This example adds a 'mylang' parser from a custom repository and enables copying its query files. ```lua require("tree-sitter-manager").setup({ languages = { mylang = { install_info = { url = "https://github.com/someone/tree-sitter-mylang", use_repo_queries = true, -- copy queries/ from the cloned repo }, }, }, }) ``` -------------------------------- ### Install tree-sitter-manager.nvim with lazy.nvim Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Use this configuration snippet for lazy.nvim to install the plugin and set up its basic configuration. ```lua { "romus204/tree-sitter-manager.nvim", config = function() require("tree-sitter-manager").setup({}) end } ``` -------------------------------- ### Install Single Tree-sitter Parser Programmatically Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Installs a single parser by its language name. Use this for specific parser installations. Suppress notifications by setting the silent argument to true. ```lua require("tree-sitter-manager")._install_single(lang, silent) ``` -------------------------------- ### Install Single Parser Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Installs a single parser by its language name. This is a low-level function. ```APIDOC ## Install Single Parser ### Description Installs a single parser by language name. This is a low-level function and prefer `:TSManager` for interactive use or `ensure_installed` for declarative installation. ### Method `require("tree-sitter-manager")._install_single(lang, silent)` ### Endpoint N/A (Lua function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **lang** (string) - Required - Language identifier (e.g., "lua") - **silent** (boolean) - Optional - Suppress notifications if true ### Request Example ```lua require("tree-sitter-manager")._install_single("python", true) ``` ### Response None (installs the parser) ``` -------------------------------- ### Define parser repository structures Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Examples of how parser repositories are defined, including revision, URL, and dependency requirements. ```lua -- Example repo entries structure: -- Simple parser { lua = { install_info = { revision = '10fe0054734eec83049514ea2e718b2a56acd0c9', url = 'https://github.com/tree-sitter-grammars/tree-sitter-lua', }, }, } -- Parser with dependencies { cpp = { install_info = { revision = '8b5b49eb196bec7040441bee33b2c9a4838d6967', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, requires = { 'c' }, }, } -- Parser with custom location in monorepo { tsx = { install_info = { location = 'tsx', revision = '75b3874edb2dc714fb1fd77a32013d0f8699989f', url = 'https://github.com/tree-sitter/tree-sitter-typescript', }, requires = { 'ecma', 'jsx', 'typescript' }, }, } ``` -------------------------------- ### Configure Tree-sitter Manager with lazy.nvim Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Initialize the plugin using lazy.nvim, specifying parsers to install automatically and custom directory paths. ```lua { "romus204/tree-sitter-manager.nvim", config = function() require("tree-sitter-manager").setup({ -- Parsers to install automatically on startup ensure_installed = { "lua", "python", "javascript", "typescript", "rust" }, -- Custom paths (optional, defaults shown) parser_dir = vim.fn.stdpath("data") .. "/site/parser", query_dir = vim.fn.stdpath("data") .. "/site/queries", }) end } ``` -------------------------------- ### Control Tree-sitter highlighting manually Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Commands to start, stop, or check the status of Tree-sitter highlighting for the current buffer. ```lua -- Manual Tree-sitter control (if needed): -- Start Tree-sitter for current buffer vim.treesitter.start() -- Stop Tree-sitter for current buffer vim.treesitter.stop() -- Check if Tree-sitter is active local active = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] ``` -------------------------------- ### Manage parser dependencies Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt The plugin automatically resolves and installs required dependencies for complex parsers. ```lua -- Example: Installing 'tsx' automatically installs its dependencies -- tsx requires: ecma, jsx, typescript require("tree-sitter-manager").setup({ ensure_installed = { "tsx" } -- Will also install ecma, jsx, typescript }) ``` -------------------------------- ### Configure Highlight for Specific Languages Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Enable syntax highlighting only for the listed languages. This configuration overrides the default behavior of enabling highlighting for all installed parsers. ```lua highlight = { "lua", "python" } ``` -------------------------------- ### Check System Requirements for Tree-sitter Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Verifies that the Neovim version is at least 0.12, and that essential command-line tools like 'tree-sitter', 'git', and a C compiler (gcc or clang) are available in the system's PATH. ```lua -- System requirements check local function check_requirements() -- Check Neovim version (0.12+ required) local nvim_version = vim.version() assert(nvim_version.major == 0 and nvim_version.minor >= 12, "Neovim 0.12+ required") -- Check tree-sitter CLI local ts_check = vim.fn.executable("tree-sitter") assert(ts_check == 1, "tree-sitter CLI not found in PATH") -- Check git local git_check = vim.fn.executable("git") assert(git_check == 1, "git not found in PATH") -- Check C compiler (gcc or clang) local cc_check = vim.fn.executable("gcc") == 1 or vim.fn.executable("clang") == 1 assert(cc_check, "C compiler (gcc/clang) not found in PATH") print("All requirements satisfied!") end ``` -------------------------------- ### Configure Highlight for Opt-in Mode Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Enable Tree-sitter highlighting exclusively for a predefined list of languages. This provides fine-grained control over which languages benefit from Tree-sitter highlighting. ```lua require("tree-sitter-manager").setup({ highlight = { "lua", "c", "rust" }, }) ``` -------------------------------- ### Open Tree-sitter Manager TUI Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Programmatically opens the Tree-sitter Manager TUI window. ```APIDOC ## Open Tree-sitter Manager TUI ### Description Opens the `:TSManager` TUI window programmatically. ### Method `require("tree-sitter-manager").open()` ### Endpoint N/A (Lua function call) ### Parameters None ### Request Example ```lua require("tree-sitter-manager").open() ``` ### Response None (opens a TUI window) ``` -------------------------------- ### Enable Treesitter Highlighting for Specific Languages (Opt-in) Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Use the `highlight` option for an opt-in approach, enabling Treesitter highlighting only for the languages listed. An empty `highlight = {}` will disable Treesitter highlighting entirely. ```lua require("tree-sitter-manager").setup({ -- Only enable treesitter highlighting for these languages highlight = { "lua", "c" }, -- Disable treesitter highlighting -- highlight = {}, }) ``` -------------------------------- ### Add New Custom Language Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Add a new language definition using a custom repository. Provide the repository URL and specify if queries should be sourced from the repository. ```lua require("tree-sitter-manager").setup({ languages = { mylang = { install_info = { url = "https://github.com/someone/tree-sitter-mylang", use_repo_queries = true, }, }, }, }) ``` -------------------------------- ### Configure Custom Query Directory Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Specify a custom directory for query files if the default location is not suitable. This is useful for organizing language-specific syntax rules. ```lua require("tree-sitter-manager").setup({ query_dir = vim.fn.expand("~/.config/nvim/queries"), }) ``` -------------------------------- ### Open Tree-sitter Manager TUI Programmatically Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Use this function to open the :TSManager TUI window from your Neovim configuration or scripts. ```lua require("tree-sitter-manager").open() ``` -------------------------------- ### Open the TSManager interface Source: https://context7.com/romus204/tree-sitter-manager.nvim/llms.txt Access the interactive TUI for parser management via command or Lua API. ```lua -- Open the parser management interface vim.cmd("TSManager") -- Or call directly from Lua require("tree-sitter-manager").open() ``` -------------------------------- ### Define Custom Language Repository Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Configure custom language definitions, including the repository URL, optional subdirectory, revision, branch, and whether to generate or use repository queries. ```lua languages = { = { install_info = { url = "https://github.com/ப்புகளை...", -- required location = nil, -- subdirectory inside the repo (optional) revision = nil, -- commit SHA to pin (optional) branch = nil, -- branch name (optional) generate = false, -- run `tree-sitter generate` before build use_repo_queries = false, -- copy queries/ from cloned repo }, requires = {}, -- list of language names that must be installed first }, } ``` -------------------------------- ### Override a built-in language with a fork Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Configure the plugin to use a forked repository for a specific language, like C++. This option also enables copying query files from the forked repository. ```lua require("tree-sitter-manager").setup({ languages = { cpp = { install_info = { url = "https://github.com/myfork/tree-sitter-cpp", revision = "abc1234", -- Use the query files that ship with the forked repo instead of -- the bundled queries. The parser's queries/ directory is copied -- automatically during installation. use_repo_queries = true, }, }, }, }) ``` -------------------------------- ### Override Built-in Language with Fork Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Replace a built-in language definition with a fork from a custom repository. Specify the new URL and optionally a specific revision and whether to use the repository's queries. ```lua require("tree-sitter-manager").setup({ languages = { cpp = { install_info = { url = "https://github.com/myfork/tree-sitter-cpp", revision = "abc1234", use_repo_queries = true, }, }, }, }) ``` -------------------------------- ### Opt-out Specific Languages from Highlighting Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Configure the plugin to disable Tree-sitter highlighting for a list of specified languages. This is useful when regex highlighting is preferred for certain file types. ```lua require("tree-sitter-manager").setup({ nohighlight = { "yaml", "zsh" }, }) ``` -------------------------------- ### Disable Treesitter Highlighting for Specific Languages Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/README.md Use the `nohighlight` option to specify languages for which standard regex highlighting should be used instead of Treesitter highlighting. This is useful for languages where Treesitter highlighting might not be desired or optimal. ```lua require("tree-sitter-manager").setup({ -- Use regex highlighting for these languages nohighlight = { "yaml", "zsh" }, }) ``` -------------------------------- ### Exclude Languages from Highlighting Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Prevent Tree-sitter syntax highlighting for specific languages, even when highlighting is enabled globally. This is useful for languages where regex highlighting is preferred. ```lua nohighlight = { "yaml", "zsh" } ``` -------------------------------- ### Disable Tree-sitter Highlighting Completely Source: https://github.com/romus204/tree-sitter-manager.nvim/blob/main/doc/tree-sitter-manager.txt Turn off Tree-sitter syntax highlighting entirely by setting the highlight option to false. This is useful if you prefer alternative highlighting methods or want to disable it globally. ```lua require("tree-sitter-manager").setup({ highlight = false, }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.