On my Ubuntu OS I’m using VS Codium for my OCaml coding. One thing that I find very inconvenient is the way Codium
sytematically adds indentation when a code snippet is simply copy/pasted.
To show a typical example, here is an original snippet :
The same snippet after being copy/pasted once :
The same snippet after being copy/pasted twice :
As you see, the indentation on the left keeps growing with each new copy/paste action
Can I fix this by changing an option in the settings, or by doing my copy/paste in a particular way ?
1 Like
If you use ocamlformat, you won’t have to care about this. Just set it to format on save and it will fix up the formatting.
It seems that I already have ocamlformat installed, see below ? (I’m not very familiar with ocamlformat)
I’ve read the doc you linked to in its entirety, and I’m still very confused, see below.
I haven’t seen any instructions on how to “set it to format on save” anywhere. The “Editor Setup” instructions in the docs, at ocamlformat 0.26.2 (latest) · OCaml Package only covers emacs and vim.
Is that because other editors such as Codium do not really support integration with ocamlformat ?
Looking into my editor’s settings didn’t help either :
In VSCode the editor setting is called ‘Editor > Format On Save’.
Can you specify what you have done so far to set up ocamlformat?
There is also a setting Format on paste
. Disabling or enabling that may help too.
1 Like