Closed courtyardz closed 9 years ago
As seen in the demo, the Soft/HardPencil command doesn't change line endings. It's only through your explicit editing of text that will lead to breaks being inserted by Vim's formatting machinery. And of course you can gwip
to format manually yourself.
This is by design, as forcing global document changes will be disruptive, especially with text you've carefully formatted.
Sorry if that wasn't clear in the docs.
I see. Thank you for clarifying so quickly. In that case I might have a feature request for you:
I had planned on using hard line wraps even for prose specifically because getting smooth scrolling with scrolloff=999
set (which keeps the cursor centered in the buffer) seems to require them. I know that this is probably impossible (see this SO Q&A), but if you could somehow get soft-mode vim-pencil to not only move but display "virtual line" by "virtual line," this would definitely enhance your plugin and seems very much in line with it's prose experience goals.
As it is now, if I want smooth scrolling during editing I'll have to, like you say, globally reformat at my own peril. But, of course, it only makes sense to store soft-wrapped files if I want to be able to easily read/edit on mobile, so I would also need some autocmd BufWritePre/Post
commands that make sure I'm always only saving soft-wrapped versions, even as I edit hard-wrapped lines. Complicated! Looks like I'll just have to get used to jumpy scrolling...
I fear that the virtual scrolling jumpiness when wrap is enabled will only be solved with a low-level change to vim itself. (Or more likely neovim, given its recent momentum.)
If you end up using hard line breaks, you may want to check out my vim-wheel plugin as an alternative to scrolloff=999.
I'll check it out! Thanks for the tips and of course for vim-pencil
When toggling between hard/soft modes on a file with long lines (I've commented out any vim-pencil
autocmd
s for the sake of debugging):SoftPencil
works as expected (settingwrap
w/o cutting off words, remapping nav keys, etc.), while:HardPencil
, though it setsnowrap
andtextwidth=80
correctly, does not create hard line breaks upon mode switch. The lines simply run off the screen until an edit is attempted, at which point the line is finally auto formatted to the appropriatetextwidth
.I can't tell 100% from the documentation -- isn't vim-pencil supposed to create and undo hard line breaks upon mode switches? If so, what would be interfering with this initial wrap (my .vimrc and a list of plugins are below)? Note also that, after hard line breaks have been created via auto format on a given line, calling
:SoftPencil
does not rejoin these lines into the original line, now softly wrapped, it merely soft wraps the lines that have not yet been touched by autoformat.If not, where would you recommend I insert this behavior into my vim-pencil version (just some
execute "normal gggqG"
commands, etc.)? I just thought this was the whole point of vim-pencil!Hopefully this helps other users get set-up with vim-pencil, as I have spent some time trying to figure out where my setup might have gone wrong.
Current plugins
.vimrc
It is unlikely that conflicts are here... I leave the setting of
formatoptions
, etc. to vim-pencil, though in vim-pencil section below I have experimented (to no avail) with setting, e.g.,textwidth
to some non-zero value manually.