preservim / vim-pencil

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

hard wrap does not handle code blocks well in markdown #48

Closed laishulu closed 8 years ago

laishulu commented 8 years ago

when in hard wrap mode, I can't input exactly as the following:

this is a code block

Pencil will auto reposition this is a code block to the end of the first ```

reedes commented 8 years ago

A difficult problem to address, as when you enter Insert mode you're not yet in a blacklisted highlight group, which would disable autoformat.

As a workaround, I'd suggest manually disabling autoformat with a mapping per the README...

noremap <silent> <F7> :<C-u>PFormatToggle<cr>
inoremap <silent> <F7> <C-o>:PFormatToggle<cr>

It'd be nice to have an alternative way to enter Insert mode where autoformat would be automatically disabled. Keeping this open to explore that.

cpdean commented 8 years ago

additionally, markdown lists get messed up by the auto linewrap stuff :/

reedes commented 8 years ago

There's at least one separate issue (#37, e.g.) for the lists. It's a separate problem because Vim's autoformat will handle them properly in certain configurations, but not in others.

The code block issue is a matter of having a good mechanism of disabling Vim's autoformat for the duration of the Insert.

reedes commented 8 years ago

New optional buffer-scoped modifier key mapping will ideally offer the additional control desired to suspend autoformat for the Insert.