Skip to content
/ opfmt Public

[Experimental] Format operators and delimiters as you type, using tree-sitter

License

Notifications You must be signed in to change notification settings

creasty/opfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 7, 2022
93165f9 · Oct 7, 2022

History

25 Commits
Oct 7, 2022
Aug 31, 2022
Oct 7, 2022
Sep 13, 2022
Aug 31, 2022
Oct 7, 2022

Repository files navigation

opfmt

Format operators and delimiters as you type, using tree-sitter.

Motivation

TBA.

// Without opfmt:
foo+=123*fn('abc',{ bar:[4,5] });

// With opfmt:
foo += 123 * fn('abc', { bar: [4, 5] });

Quick start

Install nvim-treesitter.

require('nvim-treesitter.configs').setup {
  opfmt = {
    enable = true,
  },
}

Supported languages

  • ecma
    • javascript
    • jsx
    • typescript
    • tsx
  • lua
  • toml
  • vim
  • proto

Todo

  • Describe motivation
    • Make a simple movie
    • Write down goals and non-goals
    • Comparison with other formatters?
  • Features
    • Merge two consecutive operators if applicable
    • Support has_child? query
  • Bugfixes
    • Fix a bug regarding match_case node in vim

About

[Experimental] Format operators and delimiters as you type, using tree-sitter

Topics

Resources

License

Stars

Watchers

Forks