Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] vim always wraps lines for *.txt files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Sun Apr 09, 2017 11:12 am    Post subject: [solved] vim always wraps lines for *.txt files Reply with quote

Code:
echo "bla 123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789." > foo.txt
Then run
Code:
vi foo.txt
press "A" (to append the line) and an arbitrary character will wrap the line even if "set nowrap" is set in .vimrc. But a
Code:
vi -Nu NONE foo.txt"
or
Code:
vi -Nu ~/.vimrc foo.txt
does help to circumvent the issue.

This only happens if the file ends with ".txt".

Any hints ? (vim-8.0.0386, hardened Gentoo)
Update: #vim told me :
Code:
try "set formatoptions-=t"
and indeed, that helped here.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 483
Location: Gainesville, FL, USA

PostPosted: Mon Apr 10, 2017 4:42 am    Post subject: Reply with quote

The parameter you want to set is 'textwidth'. It's useful if you want to control the column at which vim should split text lines. The setting is available for any type of file; it's just that /etc/vim/vimrc sets it to 78 for files with the .txt extension.

To do the thing you want--disable the line wrapping altogether--hit <escape> and type this line:
Code:
:set tw=0
('tw' is the abbreviation for 'textwidth' that vim allows.)

You can set the default behavior in your ~/.vimrc if you like. Add this line:
Code:
autocmd BufEnter *.txt set textwidth=0

Note that here I typed out 'textwidth' in full for clarity in the .vimrc.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum