1

This seems like a bizarre behavior to me. I've set the textwidth to 88, but I've noticed that, when editing a .rs file, something sets it to 99. At first I though it must be some plugin or formatting setting, however, this behavior persists when using the --clean flag.

I first noticed this in Neovim, but after some testing it seems like it also happens in Vim, which is weirder, since I don't even have any rust-related vim plugins installed.

I also tested files corresponding to other programming languages and this doesn't seem to happen with them (I tried .py and .lua files).

Does anyone know what is producing this behavior and how I can make my choice of textwidth be applied to .rs files?

3
  • Is the solution proposed working for you? If so, maybe could you accept the solution using the v button next to the arrow voting buttons. It allow the question to rest :-) Apr 27, 2023 at 17:35
  • @VivianDeSmedt Yes, it worked great, thank you :) I have just accepted the solution, sorry for the delay.
    – videbar
    May 4, 2023 at 9:29
  • Thanks for the feedback :-) May 4, 2023 at 9:40

1 Answer 1

0

It is set in the standard rust.vim filetype ($VIM/vim90/ftplugin/rust.vim assuming you are using vim 9.0).

For rust you can disable it by setting g:rust_recommended_style to 0

let g:rust_recommended_style=0

You can also override it by creating a ~/vimfiles/after/ftplugin/rust.vim and put the following content:

setlocal textwidth=88

As mentioned by @romainl more information with :help ft_rust

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.