How do you get vim to display wrapped lines without inserting newlines?

♀尐吖头ヾ 提交于 2019-11-29 05:41:34

To turn on word wrapping:

:set wrap
:set linebreak

To copy & paste the original text and not any padding works for gvim. For vim in an xterm though, it copies the space padding at EOL (though not the newline). I thought this should work but it doesn't:

:set mouse=a

I found this very helpful - works like a charm.

Basically I just added these lines in my vimrc

" not to break on words
set formatoptions=1
set linebreak

" fixing up moving line by line in the paragraph
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk

If vim is adding in newline characters (not just wrapping the text) then you probably have textwidth turned on ...

:set textwidth=0
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!