Giter Site home page Giter Site logo

jellyapple102 / tree-sitter-dfraw Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 10.47 MB

tree-sitter parser and syntax highlighter for the Dwarf Fortress raw language

License: MIT License

Python 1.12% C++ 2.59% JavaScript 3.77% Rust 9.76% Scheme 0.29% C 82.47%

tree-sitter-dfraw's Introduction

tree-sitter-dfraw

A simple language parser and highlighter made with tree-sitter

tokyonight tokyonight one tokyonight two

nightfly nightfly one nightfly two

Using with nvim-treesitter

Please refer to the adding parsers section on the nvim-treesitter page for more information.

Example config:

local parser_config = require'nvim-treesitter.parsers'.get_parser_configs()
parser_config.dfraw = {
	install_info = {
		url = 'https://github.com/JellyApple102/tree-sitter-dfraw',
		files = { 'src/parser.c' },
		branch = 'main'
	},
	filetype = 'text',
	used_by = { 'dfraw' }
}

Wrap in lua << EOF and EOF to use in init.vim.
Then run :TSInstall dfraw to install the parser.

In order for syntax highlighting to work you copy queries/highlights.scm file from this repo to your nvim-treesitter location queries/dfraw/highlights.scm. More information can be found on the nvim-treesitter page.

By default it is setup to start for any file of type 'text' or 'dfraw'. If you would not like to use it for all text files you can add a custom filetype to neovim. Example .config/nvim/scripts.vim:

if did_filetype()
	finish
endif
if getline(1) =~# '[a-z_]'
	setfiletype dfraw
endif

This will match any file whose first line is just lowercase letters_and_underscores, and set the filetype to 'dfraw'. Than change the config option filetype = 'dfraw' and remove the used_by option to only use 'dfraw' type files.

More information on custom filetypes here.

Highlight Colors

Feel free to change the highlight groups set by highlights.scm. I have found that some colors schemes use the same or similar colors for different groups. I have set them to what I like best using the tokyonight theme.

Use :highlight to view your current highlight groups and colors.

tree-sitter-dfraw's People

Contributors

jellyapple102 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.