kaarmu / typst.vim

Vim plugin for Typst
MIT License
282 stars 24 forks source link

[Feature Request] Indentexpr #49

Closed KillTheMule closed 12 months ago

KillTheMule commented 1 year ago

The builtin indenting doesn't really work nicely (setting cindent helps a bit though), so it would be awesome to provide an indentexpr.

kaarmu commented 12 months ago

This indentexpr is very basic. If you find edge cases please report them! :smile:

avonmoll commented 7 months ago

Apologies if this is the wrong place for this question, but I find the indenting behavior odd when used in conjunction with DelimitMate. Here is a bit of the output from :DelimitMateTest:

Open: (|)
Delete: |
Exit: ()|
Space: ( | )
Delete space: (|)
Car return: (
  |
  )
Delete car return: (|)

Open: [|]
Delete: |
Exit: []|
Space: [ | ]
Delete space: [|]
Car return: [
  |
  ]
Delete car return: [|]

Open: {|}
Delete: |
Exit: {}|
Space: { | }
Delete space: {|}
Car return: {
  |
}
Delete car return: {|}

In particular, notice that when ( and [ are expanded by pressing Enter that the closing ) and ], respectively, are also indented. The desired behavior is shown for { followed by Enter wherein the closing } is not indented.