vim-erlang-runtime is set up for indenting Erlang files that works for already existing files and does not work for any newly created ones. To elaborate, when starting a function body whenever I modify an old file, the indent of the new line is 4 spaces and in a new file it is 8 and it seems like vim ignores any rules.
% old file func() -> ␣␣␣␣ code. % new file func() -> ␣␣␣␣␣␣␣␣
I compared the files side by side, removed the plugin, added static indent instructions in
.vimrc and then reinstalled it but no joy.
The only difference in the output of
:sets is that the old files show
shiftwidth=4 (as it should) but the new files are missing this option.
:filetype filetype detection:ON plugin:ON indent:ON :set filetype filetype=erlang
I have used the exact same configuration on Fedora, Arch and this issue is on Ubuntu (whether it matters or not). I always clone my dotfiles from github and I haven't touch them for a while now.
I am sure there's an easy solution to this that I am overlooking but after 90 minutes of research and trying things out I am still not closer.
:set shiftwidth=4 works but it sucks to issue this command every time I open a new file.)
UPDATE === Removed all the plugin, installed vim-erlang-runtime plugin only and then reinstalled all, and now it works on new files as well. Except for the one file that was created before all this where it still doesn't work.
... aaand by changing directory and starting a new file with
touch, I am back to square one. SibiCoder's workaround does the job perfectly but it would be good to know what causes this.