sdiehl / vim-ormolu

Plugin for formatting Haskell source code
MIT License
39 stars 3 forks source link

Format visual selection #4

Closed sdiehl closed 4 years ago

sdiehl commented 4 years ago

Adds support for formatting visual selections for #3 for @denibertovic . This simply pipes the current line selection to stdin of ormolu and then tries to replace the output with stdout. Some weird edge cases where the number of input lines and output lines don't match.

Vimscript is absolutely terrible at visual buffer manipulations open to suggestions of a better way to do this :cry:

denibertovic commented 4 years ago

Thanks @sdiehl ! :cake: I've tested this out and it appears to work OK.

sdiehl commented 4 years ago

Ok cool, there's still some quirks where if output is shorter it breaks but I should be able to merge soon. Let me know if you find any other errors.