rust-lang / rust.vim

Vim configuration for Rust.
Apache License 2.0
3.89k stars 295 forks source link

Setting of smartindent unconditionally. #168

Open PurpleMyst opened 7 years ago

PurpleMyst commented 7 years ago

This is the 40th line of ftplugin/rust.vim, including the comments before it:

" smartindent will be overridden by indentexpr if filetype indent is on, but
" otherwise it's better than nothing.
setlocal smartindent nocindent

This line always sets smartindent when opening up a rust file.
However, not all people like having smartindent, and I personally don't utilize it.

I was wondering if there was some reason for it always being set, and if it could be possible to just remove that line from the ftplugin so I didn't have to manually unset it.

My current solution is placing this line in my .vimrc:

autocmd FileType rust setlocal nosmartindent

Thank you in advance for any answer.

chris-morgan commented 7 years ago

I wrote the indent stuff a long, long time ago and I can’t remember why it all wound up the way it did. There were reasons for every single one of the options.

It would probably be a good idea to go over all of the indent functionality with a view to simplifying it and making it more robust. Somewhere along the way it acquired the behaviour that typing # at the start of a line (after any indentation) would move the # to the very start of the line, which is always a bit annoying, but I’ve never gotten round to figuring out what’s going on and fixing it…

chris-morgan commented 6 years ago

(The # being moved to the start of the line was reported separately in #141 and seems to be resolved now, looking like it was actually a Vim bug.)

zovt commented 4 years ago

Wanted to give another thumbs up to this issue, it's very annoying having a filetype plugin mysteriously change my indentation settings