Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanbreckenridge/tree-sitter-rifleconfig
rifle (ranger filemanager file opener) grammar for tree-sitter
https://github.com/seanbreckenridge/tree-sitter-rifleconfig
parser ranger ranger-fm tree-sitter tree-sitter-parser
Last synced: 4 months ago
JSON representation
rifle (ranger filemanager file opener) grammar for tree-sitter
- Host: GitHub
- URL: https://github.com/seanbreckenridge/tree-sitter-rifleconfig
- Owner: seanbreckenridge
- License: mit
- Created: 2024-06-06T00:38:13.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-07-10T22:39:04.000Z (7 months ago)
- Last Synced: 2024-09-27T10:22:41.394Z (4 months ago)
- Topics: parser, ranger, ranger-fm, tree-sitter, tree-sitter-parser
- Language: JavaScript
- Homepage:
- Size: 116 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tree-sitter-rifleconfig
This is a [`tree-sitter`](https://tree-sitter.github.io/tree-sitter/) grammar for your [`rifle config`](https://github.com/ranger/ranger/blob/master/ranger/config/rifle.conf) file. `rifle` is a file-launcher for [`ranger`](https://github.com/ranger/ranger/) (a terminal filemanager).
This successfully parses the default config, my config and anything else I can think to throw at it, but if you notice errors please create an issue!
This parses the config file into conditions/expressions, and highlights the buffer:
![image](https://github.com/seanbreckenridge/tree-sitter-rifleconfig/assets/7804791/739bde0c-1907-41cc-a6ec-7cc3abf96dea)
### Neovim
Install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter), and then add this to your config:
```lua
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.rifleconfig = {
install_info = {
url = "https://github.com/seanbreckenridge/tree-sitter-rifleconfig",
files = {"src/parser.c"},
branch = "main"
}
}-- then setup like normal...
-- require('nvim-treesitter.configs').setup({
```To automatically set the filetype to `rifleconfig`:
- add `vim.filetype.add({filename = {['rifle.conf'] = 'rifleconfig'}})` to your startup script
- or set the modeline (`:help modeline`) by adding `# vim: ft=rifleconfig` to the top of your config file._close nvim and open your rifle.conf_
- `:TSInstall rifleconfig`
- `:edit`
- `:InspectTree`For syntax highlighting and `commenting` support, you can copy the files in `queries` and `after` to your `runtimepath`, or just install this repository with your plugin manager. E.g. for [`lazy`](https://github.com/folke/lazy.nvim):
```lua
{
'seanbreckenridge/tree-sitter-rifleconfig',
ft = 'rifleconfig',
}
```If you want to highlight the commands in each rule with the `bash` tree-sitter parser, `:TSInstall bash`, and then copy this into your `~/.config/nvim/queries/rifleconfig/injections.scm`:
```lisp
; extends(command_list
(command) @injection.content
(#set! injection.include-children)
(#set! injection.language "bash"))
```