mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 04:50:03 -04:00
feat: provide a statusline indicator
It will show the current branch at the cursor going the tree as such. root->node->subnode->leaf If an argument is provided to `statusline`, then the tree will be truncated as follows : ..->subnode->subnode
This commit is contained in:
parent
5cc7407c7f
commit
7682a1a49f
3 changed files with 36 additions and 1 deletions
|
|
@ -5,11 +5,12 @@ local M = {}
|
|||
|
||||
function M.has_parser(lang)
|
||||
local lang = lang or api.nvim_buf_get_option(0, 'filetype')
|
||||
if not lang or #lang == 0 then return false end
|
||||
return #api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) > 0
|
||||
end
|
||||
|
||||
function M.get_parser(bufnr, lang)
|
||||
if M.has_parser() then
|
||||
if M.has_parser(lang) then
|
||||
local buf = bufnr or api.nvim_get_current_buf()
|
||||
local lang = lang or api.nvim_buf_get_option(buf, 'ft')
|
||||
if not M[buf] then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue