preservim / vim-pencil

Rethinking Vim as a tool for writing
Other
1.58k stars 39 forks source link

What exactly is 'soft' line wrapping? #51

Closed latepaul closed 8 years ago

latepaul commented 8 years ago

I just installed this plugin as I wanted to explore using vim to write prose. I think I may be confused as to what 'soft' wrapping mode actually is because in all my attempts to use it so far it doesn't do anything.

So I've got the textwidth set to 74 (default I think but I set it explicitly anyway). In hard wrapping mode if I try to type more than 74 chars it inserts a line break at a convenient point and moves me on to the next line. I understand this and it works how I expect.

In soft mode I can just keep typing until I myself decide to hit enter and insert a line break. Which is the behaviour I'm used to from using Vim as a code editor. I was expecting soft wrap mode to be something like it wrapping the lines visually but there being no line breaks inserted. I suppose it is doing this but at the terminal width not at 74 characters.

Sorry if this is not appropriate for an 'issue', I realise it's not a bug or enhancement but I couldn't find anywhere to ask the question (I tried IRC but got no response).

Thanks.

reedes commented 8 years ago

Sorry, but I'm not on IRC.

The SoftPencil mode uses vim's 'set wrap' command along with some related configuration. So as you type a long line, it should be automatically wrapping at the right edge of the buffer's window, preserving word breaks. No hard line breaks should be inserted, except those that you supply. If that's not what you're seeing, then something odd is going on!

latepaul commented 8 years ago

Thanks. That's what I'm seeing and figured out it was normal/intended which is why I closed the issue. Thanks for responding.

stevenroose commented 5 years ago

So how does it make sense for hard wrap to use text width but soft warp to use the full buffer width? What's the reasoning?

arisolt commented 1 year ago

So how does it make sense for hard wrap to use text width but soft warp to use the full buffer width? What's the reasoning?

basically there is no way in the underlying Vim functionality to soft wrap at an arbitrary width, without adjusting the window/screen dimensions. See, for example: https://vi.stackexchange.com/questions/8961/soft-linewrap-width and https://stackoverflow.com/questions/989093/soft-wrap-at-80-characters-in-vim-in-window-of-arbitrary-width