Skip to content

IbrahimShahzad/tree-sitter-kamailio-cfg

Repository files navigation

Tree-Sitter-Kamailio-cfg

This is a tree-sitter grammar for Kamailio configuration files.

Some c like grammar is taken from the tree-sitter-c grammar.

Pre-requisites

Usage

  1. Add the following to your nvim init.lua
---@class parser_config
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.kamailio_cfg = {
  install_info = {
    url = 'https://github.com/IbrahimShahzad/tree-sitter-kamailio-cfg',
    files = { 'src/parser.c' },
    branch = 'v0.1.2', -- default branch in case of git repo if different from master
    generate_requires_npm = false, -- if stand-alone parser without npm dependencies
    requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
  },
  filetype = 'kamailio', -- if filetype does not match the parser name
}
vim.treesitter.language.register('kamailio_cfg', 'cfg')
  1. Run :TSInstall kamailio_cfg in nvim.

  2. Copy the queries/highlights.scm to ~/.config/nvim/queries/kamailio_cfg/highlights.scm or add it to runtime path queries folder. see :h rtp

  3. Set the filetype to kamailio_cfg when opening in neovim.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

kamailio cfg grammar for tree-sitter

Resources

License

Stars

Watchers

Forks

Packages

No packages published