ElmCast / elm-vim

Elm plugin for Vim
BSD 3-Clause "New" or "Revised" License
572 stars 102 forks source link

Added the ability to use a differently-named elm-format binary #146

Closed otaconix closed 2 months ago

otaconix commented 6 years ago

On macOS' homebrew, elm-format is installed as two separate binaries:

elm-vim only ever looked for 'elm-format', but now the name of the binary can be overridden by setting g:elm_format_binary.

jesse-c commented 6 years ago

From what I've seen, it's common to allow the user to set the path for the linter/formatter in these types of plugins, so maybe doing that instead of setting a name would allow more flexibility, and accomplish the same thing?

otaconix commented 6 years ago

Do you mean an absolute path, as in the full path to the executable (/usr/bin/elm-format), or path as in the environment variable (PATH=/usr/bin:/usr/local/bin:/bin)?

Because the latter isn't good enough (the binary still has a different name), and the former can be achieved with the code in this pull request as-is: simply let g:elm_format_binary = '/my/custom/path/elm-format'.

jesse-c commented 6 years ago

I was thinking more of the former, a full path to the executable. Ah okay, cool that it can be done as-is. Maybe that could be added to the explanation?

otaconix commented 6 years ago

To be pedantic, it depends on what vim thinks your shell is (see :help 'shell'). If it's a POSIX shell, and your g:elm_format_binary contains no slashes, it will search your PATH. If g:elm_format_binary contains a slash, I guess it'll be considered a relative path (though I'm not sure what would then be considered the current working directory).

Anyhow, I'm definitely open to suggestions on how to put all or some of the above information into the documentation.

Also, to be honest, I haven't actually tried putting more than a name in g:elm_format_binary. I hadn't even thought of it, and your question led me down a rabbit hole of vimdoc and POSIX specs.

jesse-c commented 6 years ago

Ah I guess that makes it tricky to be reliable. Honestly, the commit you pushed up is fine for me.