0

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
  textwidth=78
    Last set from /usr/share/vim/vimrc

:verbose set history
  history=100
    Last set from ~/.vimrc

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

:so ~/.vimrc
:verbose set textwidth
  textwidth=0
    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 May 15 at 11:26
  • @Ralf Nevermind, see answer. – Skippy le Grand Gourou May 15 at 12:14
0

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.

  • 2
    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 May 15 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. ;) – Skippy le Grand Gourou May 15 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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