You're looking for something like the
l flag in
t Auto-wrap text using textwidth
l Long lines are not broken in insert mode: When a line was longer than
'textwidth' when the insert command started, Vim does not
automatically format it.
The default setting is
formatoptions=tcq. To test it out run
:set formatoption to see if it has a
l flag. Then run
:set formatioptions-=t and you should be able to clack away well past your tw=80.
But I think the
l flag is really the best option, so If the
l flag is not present (the default) run
:set formatioptions+=l. If the
t flag is still set the line will wrap after passing
tw=80, but when adding to a line already longer than 80 characters, the line will not keep wrapping automatically.
The catch to removing the
t is vim will no longer automatically formats the other text and you have to run something like
gqip (format inside paragraph) on the lines you want to be less than 80. There is a
c flag that instead looks at comments specifically. It will wrap the comment and automatically add the comment leader for you. In conjunction with the
j flag, when you go and hit
J to combine the lines it will do it cleanly, meaning it will remove the comment leader from the line being appended.
:help fo-table and
:help formatoptions to find the flags and other useful info. If
l didn't do the trick and removing
t is the best option, you can also add something like...
highlight rightMargin term=bold ctermfg=blue guifg=orange
nnoremap <localleader>h :match rightMargin /.\%>81v/
nnoremap <localleader>H :match none<cr>
to your vimrc. Using this I can toggle on and off highlighting text in the 81st column onward, giving a nice unobtrusive way of knowing which lines are too long.
Edit: Changed the answer so the solution (in my last edit) was more front and center. the
l flag was the right answer here.