Here is my ${HOME}/.vimrc :

set textwidth=0
set history=100

(FWIW, inverting their order has no effect, as one would expect.)

It is read by vim (:echo $MYVIMRC returns the correct path), and indeed set history (actually included to check if it was a .vimrc inclusion issue) is taken into account, but not set textwidth :

:verbose set textwidth
    Last set from /usr/share/vim/vimrc

:verbose set history
    Last set from ~/.vimrc

Yet if I source my .vimrc it does set textwidth :

:so ~/.vimrc
:verbose set textwidth
    Last set from ~/.vimrc

What's wrong, and what can I do to force textwidth to be set by my user .vimrc ?

  • What's the output of :scriptnames?
    – Ralf
    Commented May 15, 2019 at 11:26
  • @Ralf Nevermind, see answer. Commented May 15, 2019 at 12:14

1 Answer 1


From /usr/share/vim/vimrc :

" Only do this part when compiled with support for autocommands.
if has("autocmd")


  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

Apparently these settings override basic custom .vimrc settings. I replaced set textwidth=0 in my .vimrc with

  autocmd VimEnter * set textwidth=0

and now vim behaves as I expected.

  • 3
    This looks as if someone copied (parts of) vimrc_example.vim to /usr/share/vim/vimrc. I think this example is not intended as system vimrc, but as a example to start your personal vimrc. Anyway I don't understand where your initial problem comes from, as textwidth=78 is only set for text files.
    – Ralf
    Commented May 15, 2019 at 13:04
  • Indeed, /usr/share/vim/vimrc starts as " An example for a vimrc file"… This is the default vim-7.4` Slackware installation. As for my initial problem, well, I was editing a text file. ;) Commented May 15, 2019 at 13:40
  • 5
    Your solution will only work for the first text file you open (on the command-line), the second one you open will have a textwidth of 78 again. Complain to your Linux distribution, open a bug report asking them to fix that, they shouldn't be shipping vimrc_example as the system-wide vimrc.
    – filbranden
    Commented Jun 8, 2020 at 14:18

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.