Hi,

> My guess is, you have a filetype plugin for text files, that sets the 
> textwidth. Check your :scriptnames output and as mentioned by Ken,
> use :verbose set tw?
> to find out, where it was set.

Christian,

:scriptnames gives the following list if started with no options:

  1: /etc/vim/vimrc
  2: /usr/share/vim/vim74/syntax/syntax.vim
  3: /usr/share/vim/vim74/syntax/synload.vim
  4: /usr/share/vim/vim74/syntax/syncolor.vim
  5: /usr/share/vim/vim74/filetype.vim
  6: /usr/share/vim/vimfiles/ftdetect/cmake.vim
  7: /usr/share/vim/vimfiles/ftdetect/gentoo.vim
  8: /usr/share/vim/vim74/ftplugin.vim
  9: ~/.vimrc
 10: /usr/share/vim/vimfiles/plugin/bugsummary.vim
 11: /usr/share/vim/vimfiles/plugin/gentoo-common.vim
 12: /usr/share/vim/vimfiles/plugin/newebuild.vim
 13: /usr/share/vim/vimfiles/plugin/newinitd.vim
 14: /usr/share/vim/vimfiles/plugin/newmetadata.vim
 15: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 16: /usr/share/vim/vim74/plugin/gzip.vim
 17: /usr/share/vim/vim74/plugin/logiPat.vim
 18: /usr/share/vim/vim74/plugin/matchparen.vim
 19: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 20: /usr/share/vim/vim74/plugin/rrhelper.vim
 21: /usr/share/vim/vim74/plugin/spellfile.vim
 22: /usr/share/vim/vim74/plugin/tarPlugin.vim
 23: /usr/share/vim/vim74/plugin/tohtml.vim
 24: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 25: /usr/share/vim/vim74/plugin/zipPlugin.vim
 26: /usr/share/vim/vim74/scripts.vim
 27: /usr/share/vim/vim74/ftplugin/text.vim

If started with "-u NONE -N" it gives nothing.

> Because the /etc/vim/vimrc uses autocmd, textwidth is set when you
> open a file.
> As you can see in the line 162, setting g:leave_my_textwidth_alone
> might solve the problem.
> Try to add this line in your .vimrc:
> 
>   let g:leave_my_textwidth_alone=1
> 
> Another solution might be:
> 
>   autocmd FileType text setlocal textwidth=0

Ken,

The first solution does work, the second doesn't (if added to ~/.vimrc).

> This is why ":set &all" must be used: because package maintainers
> change the Vim defaults. See also:
> 
> https://groups.google.com/d/msg/vim_dev/JQPWhn8DeRE/GNkcqbW4AwAJ
> 
> Maybe Bram could explicitly discourage package maintainers from
> changing the defaults.

Justin,

if I add "set &all" to ~/.vimrc or enter ":set &all" in vim, it says
"Unknown option: &all". If I undrestood you correctly, it supposed to
do the same as options "-u NONO -N".

> Many Linux distributions, when they compile Vim, change the default
> "system vimrc" location and set it to /etc/vimrc rather than
> $VIM/vimrc. My openSUSE distro does the same, of course with a
> (probably) different /etc/vimrc. You can see that referenced in the
> Gentoo Vim by executing the ":version" command; about halfway down the
> output, as the first line after the list of features
> yes-or-no-compiled-in, you will (I bet) see a line saying "system
> vimrc file: /etc/vimrc".

Tony,

In my case it says:
system vimrc file: "/etc/vim/vimrc"
Exactly the file, where I found a problem of setting the textwidth
variable.

All,

I'll try to persuade the Gentoo team to remove this setting
from /etc/vim/vimrc and in the meantime will keep this in my ~/.vimrc:

let g:leave_my_textwidth_alone=1

Thank you for your help!

Regards

-----Original Message-----
Date: Sun, 3 Jan 2016 15:04:34 +0100
From: Tony Mechelynck <[email protected]>
To: vim_dev <[email protected]>
Cc: [email protected], Ken Takata <[email protected]>
Subject: Re: Bug: Unable to set textwidth via vimrc


On Sat, Jan 2, 2016 at 7:06 AM, tot-to <[email protected]> wrote:
> Hi Ken,
>
> Thanks, it says "Last set from /etc/vim/vimrc"
>
> I've found the place in that file, where it sets the variable. This is
> apparently distribution (Gentoo) specific settings:  

Many Linux distributions, when they compile Vim, change the default
"system vimrc" location and set it to /etc/vimrc rather than
$VIM/vimrc. My openSUSE distro does the same, of course with a
(probably) different /etc/vimrc. You can see that referenced in the
Gentoo Vim by executing the ":version" command; about halfway down the
output, as the first line after the list of features
yes-or-no-compiled-in, you will (I bet) see a line saying "system
vimrc file: /etc/vimrc".

Since I compile my own Vim, I don't have this problem: by default it has
$VIM = /usr/local/share/vim
$VIMRUNTIME = /usr/local/share/vim/vim74
system vimrc = $VIM/vimrc
user vimrc = $HOME/.vimrc

but since I want to use the same set of custom plugins even when (e.g.
because a change of libraries temporarily broke my own Vim) I have to
use openSUSE Vim, I "cheat" a little: near the top of my vimrc, after
Vim has started, set $VIMRUNTIME as above, and found that there was no
/usr/local/share/vim/vimrc, I set $VIM to /usr/share/vim (the openSUSE
value) and that's where (in a "vimfiles" subdirectory) I keep my
custom plugins.


Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google
Groups "vim_dev" group. To unsubscribe from this group and stop
receiving emails from it, send an email to
[email protected]. For more options, visit
https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui