OCamlPro / ocp-indent

Indentation tool for OCaml, to be used from editors like Emacs and Vim.
http://www.typerex.org/ocp-indent.html
Other
200 stars 63 forks source link

ocp-indent with vim #184

Closed qlambert-pro closed 9 years ago

qlambert-pro commented 9 years ago

Hi, I am having trouble using ocp-indent with vim. As far as I can tell the script is called but what is stored in s:indents always seem to be interpreted as 0 level of indentation.

I couldn't find any documentation for systemlist, so that led me to think that I may need to install something else for it to work since other users do not seem to have trouble using it.

Can someone tell me if the problem does come from there and what would be the solution ?

qlambert-pro commented 9 years ago

so I managed to fix it by modifying the script, namely I replaced: let cmdline = "ocp-indent --numeric --indent-empty --lines " . a:lnum . '-' let s:indents = systemlist(cmdline, getline('1','$')) by: let cmdline = "ocp-indent " . bufname("") . " --numeric --indent-empty --lines " . a:lnum . "-" let s:indents = split(system(cmdline), "\n")

AltGr commented 9 years ago

The issue should probably remain open unless the problem has been solved ?

I don't understand what went wrong, though, and ocp-indent should read from stdin rather than the buffer file, or results would get weird on unsaved buffers...

qlambert-pro commented 9 years ago

You are right, I forgot to update, but I made some other modifications. I can make a pull request with the fixed version I am using that does read from the standard input. Let me know if you are interested.

AltGr commented 9 years ago

Please do! Thanks :)