Zsh grammar for tree-sitter
npm install tree-sitter-zsh
[![discord][discord]](https://discord.gg/w7nTvsVJhm)
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
[![crates][crates]](https://crates.io/crates/tree-sitter-zsh)
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-zsh)
[![pypi][pypi]](https://pypi.org/project/tree-sitter-zsh)
Zsh grammar for tree-sitter.
> [!NOTE]
> this is not the same as tree-sitter/tree-sitter-zsh
> which has been archived, but rather a complete reworking starting
> from the bash grammar.
For neovim, add the following to your config
``luasrc/grammar.json
vim.api.nvim_create_autocmd("User", {
pattern = "TSUpdate",
callback = function()
require("nvim-treesitter.parsers").zsh = {
install_info = {
"https://github.com/georgeharker/tree-sitter-zsh",
generate_from_json = false, -- only needed if repo does not contain either
queries = 'nvim-queries', -- also install queries from given directory
},
tier = 3,
}
end,
})
`
In addition to enabling treesitter for zsh files.
Install the dependencies:
`sh`
npm install
Build and run the tests:
`sh`
npm run build
npm run test
Run the build and tests in watch mode:
`sh``
npm run test:watch
- Zsh reference docs
- Shell command language specification
- mvdnan/sh - a shell parser in go
- tree-sitter-bash
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-zsh/ci.yml?logo=github&label=CI
[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
[npm]: https://img.shields.io/npm/v/tree-sitter-zsh?logo=npm
[crates]: https://img.shields.io/crates/v/tree-sitter-zsh?logo=rust
[pypi]: https://img.shields.io/pypi/v/tree-sitter-zsh?logo=pypi&logoColor=ffd242