1

I have added the following two lines into my .vimrc file

" stop fortran 90 from automatically insert line break beyond 80
set textwidth=0 wrapmargin=0

" stop vim wrapping beyond 80, avoid visual breaking in vim
set nowrap

but still no success. vim keeps breaking lines in my f90 source file as before, which is very annoying. Any further suggestions?

2 Answers 2

7

'textwidth' is local to the buffer. I imagine Vim's default fortran plugin ($RUNTIME/ftplugin/fortran.vim) is setting 'textwidth'.

To override this default add the following to ~/.vim/after/ftplugin/fortran.vim:

setlocal textwidth=0

You can set other fortran setting you wish to override here as well.

You can also use :verbose to see where an option was last set. e.g. :verbose set textwidth?.

For more help see:

:h 'textwidth'
:h after-directory
:h :setlocal
:h :verbose
:h :set
0

If you are old-fashioned, you might want an alias such as

alias vi='vi --noplugin'

Then you can again rely on your own intelligence rather than vi's.

Some of the "modern" plug-ins are rather annoying if you are not used to them.

1
  • 2
    Welcome to Vi and Vim! I’ve edited your post to use code-formatting, and I’ve also used a sh-style alias syntax. One thing that could improve the answer is to explain how this avoids OPs problem (the connection between the noplugin flag and ftplugins/textwidth is not immediately obvious)
    – D. Ben Knoble
    Feb 13, 2020 at 13:50

Your Answer

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

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