View previous topic :: View next topic |
Author |
Message |
toralf Developer
Joined: 01 Feb 2004 Posts: 3920 Location: Hamburg
|
Posted: Sun Apr 09, 2017 11:12 am Post subject: [solved] vim always wraps lines for *.txt files |
|
|
Code: | echo "bla 123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789." > foo.txt | Then run 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 |
|
|
miket Guru
Joined: 28 Apr 2007 Posts: 483 Location: Gainesville, FL, USA
|
Posted: Mon Apr 10, 2017 4:42 am Post subject: |
|
|
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: ('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 |
|
|
|