/opfmt

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

Primary LanguageLuaMIT LicenseMIT

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