Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559800 - app-editors/vim sets textwidth=78, no matter what is set in ~/.vimrc
Summary: app-editors/vim sets textwidth=78, no matter what is set in ~/.vimrc
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-06 17:13 UTC by tot-to
Modified: 2022-07-29 10:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tot-to 2015-09-06 17:13:14 UTC
Previously, I haven't set textwidth in .vimrc and it was no autowrapping by default in all files.

At some point (probably after an upgrade) it stared to do autowrap, but only for *.txt files, i.e. if I open such file and enter the command
:set tw
I get
textwidth=78
Of course, I can set it manually to 0, but it'll be forgotten on the next run. So, I've added this string to my ~/.vimrc:
set textwidth=0
But it turned out, that this doesn't change the behaviour at all.
I've tested with latest versions for amd64 and ~amd64, i.e. 7.4.769 and 7.4.827.

Reproducible: Always

Steps to Reproduce:
1. echo 'set textwidth=0' >> ~/.vimrc
2. vim textfile.txt
3. type ":set textwidth"
Actual Results:  
textwidth=78

Expected Results:  
textwidth=0
Comment 1 tot-to 2016-01-04 00:05:01 UTC
I've found where it comes from. This part of /etc/vim/vimrc:

159   " In text files, limit the width of text to 78 characters, but be careful
160   " that we don't override the user's setting.
161   autocmd BufNewFile,BufRead *.txt
162         \ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") |
163         \     setlocal textwidth=78 |
164         \ endif

It says, that it should not override the user's settings, but it does. Also, a few lines above it says, that it's one of the Gentoo-specific settings for ebuilds. But txt files are not ebuilds. The link with "more information" points to the page 404.

I suggest to just remove this part of /etc/vim/vimrc

The workaround is:
echo 'let g:leave_my_textwidth_alone=1' >> ~/.vimrc
Comment 2 sul 2016-07-03 06:01:12 UTC
Really helpful workaround. Thank you. =)
Comment 3 Patrice Clement gentoo-dev 2018-01-14 00:22:12 UTC
Hi

I haven't been able to reproduce this bug. Here's what I set in my ~/.vimrc file:
set textwidth=79

and it is actually equal to 79 if I query it in vim. Maybe something is up in your setup? Somebody else in this bug report pointed out a workaround. Hopefully it helps solve this problem.