I believe your problem is not related to the Octave syntax file. It only introduces syntax coloring properties.
I believe the problem comes with the lines that associate the octave file type to the buffers corresponding to the *.m
and *.oct
files:
augroup octavedetect
au! BufRead,BufNewFile *.m,*.oct set filetype=octave
augroup END
By default *.m
files are associated to the matlab
file type and come with the matlab
auto-indentation.
With the new lines the octave indentation is reset to your Neovim default indentation.
You can restore it to the matlab
indentation with the following lines into your init.vim
:
augroup octavetype
au! BufRead,BufNewFile *.m,*.oct setlocal indentexpr=GetMatlabIndent()
augroup END
Or by adding an octave.vim
file into ~/.config/nvim/ftplugin/
with the following content:
setlocal indentexpr=GetMatlabIndent()
But maybe should we search for a more Octave specific auto-indentation.
Maybe could you consider installing the following plugin octave that bring both colorization and Octave specific auto-indentation?
init.vim
to get Octave coloring, restart Neovim and give us the result of the following commands:set ft?
and:set autoindent?
:set cindent?
:set indentexpr?
?
in my command. The consequence is that you set the option (and then it returns itself). Could you restart Neovim and repeat the commands with the trailing?
included? I'm already 99% convince that you had matlab auto-indentation that is indeed relatively good for Octave although probably not 100% perfect.