astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

Add stdin support #34

Closed Andrew15-5 closed 1 year ago

Andrew15-5 commented 1 year ago

I'm using Neovim with sbdchd/neoformat and it nicely works with formatters that support stdin (all of them). But typst-fmt doesn't support stdin. It already can output to a different or the same file, but it also should be able to just purge formatted file content to stdout. So, something like a --stdin flag/option would be a great feature. It will get data from stdin and output it to stdout unless output option is present.

Andrew15-5 commented 1 year ago

I found how to use non-stdin-compatible formatters:

let g:neoformat_typst_typstfmt = {
  \ 'exe': 'typst-fmt',
  \ 'replace': 1,
  \ }
let g:neoformat_enabled_typst = ['typstfmt']
astrale-sharp commented 1 year ago

Great idea!

astrale-sharp commented 1 year ago

It's on the work on the bin branch

astrale-sharp commented 1 year ago

added!