Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsers: add tree-sitter-gitignore #3303

Merged
merged 1 commit into from
Aug 17, 2022

Conversation

theHamsta
Copy link
Member

@theHamsta theHamsta commented Aug 15, 2022

Not feeling too confident about the captures yet. Any feedback welcome!

@andy2mrqz

Addresses #2282 (comment)

@theHamsta
Copy link
Member Author

Please note that gitignore is not a known filetype to vim. You need to add something like

augroup filetypedetect
    au! BufRead,BufNewFile .gitignore set filetype=gitignore
augroup end

to your init.vim. Support for the filetype should be contributed to github.com/vim/vim

@shunsambongi
Copy link

@theHamsta I was planning on contributing this parser eventually, but I had become a little busy, so I appreciate this PR. I don't know if it would help you at all, but I was playing around with some highlight queries in https://github.com/shunsambongi/gitignore.nvim/blob/0b8108524dbc0d15a34b6e1ca5bbd75b04a5ddfb/queries/gitignore/highlights.scm

@shunsambongi
Copy link

shunsambongi commented Aug 16, 2022

Please note that gitignore is not a known filetype to vim. You need to add something like

augroup filetypedetect
    au! BufRead,BufNewFile .gitignore set filetype=gitignore
augroup end

to your init.vim. Support for the filetype should be contributed to github.com/vim/vim

I also just wanted to point out that there are a bunch of tools that use ignore files that can be highlighted using the parser being added in this PR. For example, sharkdp/fd (.fdignore), BurntSushi/ripgrep (.rgignore), prettier (.prettierignore), etc. So one would just need to modify the autocmd to support these files.

@theHamsta
Copy link
Member Author

Commited your changes

@theHamsta theHamsta merged commit b245c44 into nvim-treesitter:master Aug 17, 2022
@theHamsta theHamsta deleted the gitignore branch August 17, 2022 06:16
numToStr pushed a commit to numToStr/Comment.nvim that referenced this pull request Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants