Skip to content

Can we use tree-sitter as a pager? #2707

Closed Answered by yehorb
Freed-Wu asked this question in Q&A
Discussion options

You must be logged in to vote

Direct answer - no. As it says in the README, "Tree-sitter is a parser generator tool and an incremental parsing library." It is not possible to use the tree-sitter application to read an input and provide paged, formatted, or colored output.

If your question is more akin to "Can pager applications such as bat or less use tree-sitter to provide syntax highlighting? - yes, they can, and it is up to the maintainer (or up to you) to add such support.

A quick search for currently available solutions revealed syncat.

You can also use nvim to open files in read-only mode and use it as an ad-hoc pager, but you will not get colored output into a terminal this way.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Freed-Wu
Comment options

You must be logged in to vote
7 replies
@Freed-Wu
Comment options

@amaanq
Comment options

@yehorb
Comment options

@ahlinc
Comment options

@Freed-Wu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants