neoformat icon indicating copy to clipboard operation
neoformat copied to clipboard

Try to use formatters for subfiletypes

Open fenuks opened this issue 3 years ago • 1 comments

This adds support for multiple filetypes e.g. vimwiki.markdown. Currently neoformat only tries first filetype, which is problematic because as far I'm concerned, it's not possible to configure neoformat to use e.g. markdown prettier formatter for vimwiki. Not even :Neoformat prettier would work, because neoformat then searched prettier formatter definition for vimwiki which doesn't exist.

I only changed code for formatting, and didn't touch code for formatter autocompletion. I could search for all filetypes, but then there is problem to decide which formatter definition to use. We can assume that first definition within filetype should be used. So if I my &filetype=vimwiki.markdown, and I run :Neoformat prettier, code should try to find prettier for vimwiki, and then for markdown, and so on. For now, I left current behaviour, i.e. first filetype is used, in my example that would be vimwiki. and :Neoformat prettier would fail to find formatter.

I will mention this in docs when we will agree if that's fine. Also possibly this change should be configurable with global variable, I can add this if requested.

fenuks avatar Oct 27 '21 11:10 fenuks

@sbdchd Can you please give your thoughts on this?

fenuks avatar Nov 05 '21 18:11 fenuks