From 8be2dc64a2e0a94a429d66c411eb7d500566508f Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Fri, 15 May 2020 14:19:29 +0200 Subject: Expose internal api. - add `exposed_state` to expose 'current_node' and 'cursor_pos' for a current buffer to the user. - add `get_buf_state` and `get_node_api` for users. - add documentation about api functions. - remove `node_movement` module which should be done in user side. --- README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2c5a3ce71..13b6a3fd0 100644 --- a/README.md +++ b/README.md @@ -102,16 +102,6 @@ require'nvim-treesitter.configs'.setup { scope_decremental = "grm", -- decrement to the previous scope } }, - node_movement = { -- allows cursor movement in node hierarchy - enable = true, - disable = { 'cpp', 'rust' }, - keymaps = { -- mappings for scope movement (normal mappings) - parent_scope = "", -- default is to move with alt key hold - child_scope = "", - next_scope = "", - previous_scope = "", - } - }, ensure_installed = 'all' -- one of 'all', 'language', or a list of languages } EOF @@ -136,12 +126,25 @@ Some of these features are : - [x] Incremental selection - [ ] Syntax based code folding - [x] Consistent syntax highlighting (the api is not quite stable yet) - - [x] Cursor movement in scope hierachy - [x] Statusline indicator (`require'nvim-treesitter'.statusline(size)`) You can find the roadmap [here](https://github.com/nvim-treesitter/nvim-treesitter/projects/1). The roadmap and all features of this plugin are open to change, and any suggestion will be highly appreciated! +## Api + +Nvim-treesitter exposes an api to extend node capabilites. You can retrieve the api like this: +```lua +local ts_node_api = require 'nvim-treesitter'.get_node_api() +``` + +You can also retrieve the current state of the current buffer with: +```lua +local buf_state = require'nvim-treesitter'.get_buf_state() +``` + +More information is available in neovim documentation (`:help nvim-treesitter-api`). + ## Supported Languages For treesitter to work, we need to use query files such as those you can find in `queries/{lang}/{locals,highlights}.scm`