diff options
| author | Christian Clason <christian.clason@uni-due.de> | 2020-11-21 21:00:38 +0100 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2020-11-25 22:35:20 +0100 |
| commit | 6ac8e78304e85b195a878fd1f0889c16e80eb30a (patch) | |
| tree | 91274bf0a5964952e5d674dc80b809896d3a91de | |
| parent | 1bd090e101b7524775a72edf4aa7fa94298b3d53 (diff) | |
move advanced explanation to the end
| -rw-r--r-- | README.md | 58 |
1 files changed, 29 insertions, 29 deletions
@@ -74,38 +74,10 @@ provides commands to automate this process. If the language is already [supporte ```vim :TSInstall {language} ``` -This command supports tab expansion. You can also get a list of all available languages and their installation status with `:TSInstallInfo`. +This command supports tab expansion. You can also get a list of all available languages and their installation status with `:TSInstallInfo`. Parsers not on this list can be added manually by following the steps described under ["Adding unsupported parsers"](#unsupported) below. If you update `nvim-treesitter` and want to make sure the parser is at the latest compatible version (as specified in `nvim-treesitter`'s `lockfile.json`), use `:TSUpdate {language}`. To update all parsers unconditionally, use `:TSUpdate all` or just `:TSUpdate`. -### Adding unsupported parsers - -If you have a parser that is not on the list (either from a repository on Github or a local directory), you can add it manually for use by `nvim-treesitter` as follows: - -1. Clone the repository or [create a new project](https://tree-sitter.github.io/tree-sitter/creating-parsers#project-setup) in, say, `~/projects/tree-sitter-zimbu`. Make sure that the `tree-sitter-cli` executable is installed and in your path; see https://tree-sitter.github.io/tree-sitter/creating-parsers#installation for installation instructions. -2. Run `tree-sitter generate` in this directory (followed by `tree-sitter test` for good measure). -3. Add the following snippet to your `init.vim`: - -```vim -lua <<EOF -local parser_config = require "nvim-treesitter.parsers".get_parser_configs() -parser_config.zimbu = { - install_info = { - url = "~/projects/tree-sitter-zimbu", -- local path or git repo - files = {"src/parser.c"} - }, - filetype = "zu", -- if filetype does not agrees with parser name - used_by = {"bar", "baz"} -- additional filetypes that use this parser -} -EOF -``` - -4. Start `nvim` and `:TSInstall zimbu`. - -You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install straight from `grammar.js`. Once the parser is installed, you can update it (from the latest revision of the `main` branch if `url` is a Github repository) with `:TSUpdate zimbu`. - -Note that this only installs the parser itself; using it for, e.g., highlighting also requires corresponding queries that need to be written and placed in the appropriate directory (e.g., as `queries/zimbu/highlights.scm`). - ## Setup All modules are disabled by default, @@ -273,6 +245,34 @@ List of currently supported languages: - [ ] [yaml](https://github.com/ikatyang/tree-sitter-yaml) <!--parserinfo--> +## <a name="unsupported"></a> Parsers for other languages + +If you have a parser that is not on this list (either from a repository on Github or a local directory), you can add it manually for use by `nvim-treesitter` as follows: + +1. Clone the repository or [create a new project](https://tree-sitter.github.io/tree-sitter/creating-parsers#project-setup) in, say, `~/projects/tree-sitter-zimbu`. Make sure that the `tree-sitter-cli` executable is installed and in your path; see https://tree-sitter.github.io/tree-sitter/creating-parsers#installation for installation instructions. +2. Run `tree-sitter generate` in this directory (followed by `tree-sitter test` for good measure). +3. Add the following snippet to your `init.vim`: + +```vim +lua <<EOF +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.zimbu = { + install_info = { + url = "~/projects/tree-sitter-zimbu", -- local path or git repo + files = {"src/parser.c"} + }, + filetype = "zu", -- if filetype does not agrees with parser name + used_by = {"bar", "baz"} -- additional filetypes that use this parser +} +EOF +``` + +4. Start `nvim` and `:TSInstall zimbu`. + +You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install straight from `grammar.js`. Once the parser is installed, you can update it (from the latest revision of the `main` branch if `url` is a Github repository) with `:TSUpdate zimbu`. + +Note that this only installs the parser itself; using it for, e.g., highlighting also requires corresponding queries that need to be written and placed in the appropriate directory (e.g., as `queries/zimbu/highlights.scm`). + # Roadmap The goal of `nvim-treesitter` is both to provide a simple and easy way to use the interface for Treesitter in Neovim, |
