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

后端 未结 3 2022
醉话见心
醉话见心 2020-12-16 13:00

I\'m getting back in touch with my inner (g)vim due to an unscheduled MacBook mother(board) of a meltdown (my emergency backup Linux box won\'t run TextMate). All told I\'m

相关标签:
3条回答
  • 2020-12-16 13:25

    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
    
    0 讨论(0)
  • 2020-12-16 13:35

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

    :set textwidth=0
    
    0 讨论(0)
  • 2020-12-16 13:41

    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
    
    0 讨论(0)
提交回复
热议问题