When prettier tells me to take one line with a whole object and put every property on a new line, I want a key to autofix that. I know prettier has things that can be auto-fixed, but I have no idea how to trigger it with ALE (or prettier).

(note: I'm programming in JS. An object would be something like { prop1: 1, prop2: 2 })

  • Maybe try :h ale-fix? (I've never use ale but a glance at the front page of the github site says you can trigger per-buffer fixing. Individual lines may need to be specified in config, though.)
    – B Layer
    Jul 3, 2019 at 21:35
  • RTFM eh? Well.... it worked! Thanks for the help! Jul 5, 2019 at 0:48
  • Well, you're advice was good, but actually the command I found does the whole file not one line. Jul 5, 2019 at 0:50
  • I'll probably have to do some vim scripting to accomplish this. I'm busy right now, so I'll have to come back to it. (FYI :ALEFix prettier fixed the whole file, which is a step in the right direction) Jul 5, 2019 at 0:52
  • 2
    I guess it is a bit RTFM-ish. ;) Glad it helped anyways. The part that suggested to me that ale-fix could be controlled with line granularity is this from the fourth paragraph of that help section: Each function for fixing errors must accept either one argument (buffer) or two arguments (buffer, lines), representing the buffer being fixed and the lines to fix. .. but I may be misreading things. If you have a followup question (esp. involving vimscript) feel free to ask here.
    – B Layer
    Jul 8, 2019 at 11:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.