vim-pencil icon indicating copy to clipboard operation
vim-pencil copied to clipboard

markdownListMarker at start of previous line does not disable autoformat

Open reedes opened this issue 10 years ago • 15 comments

Occurs in HardPencil mode and interferes with ability to add new items to a list.

reedes avatar Apr 24 '15 06:04 reedes

This disables autoformat within the list items, which is a step down.

Need to determine if there's a way to get the best of both worlds: autoformat within list items AND ease of adding new list items without unintended reformat of multiple lines.

reedes avatar Apr 24 '15 15:04 reedes

I believe this is the issue I just ran into.

  • If I start at the end of a list item, then hit Enter, HardPencil seems to understand that I'm still in a list and it lets me keep going
  • If I add a new line (say, via o in normal mode) and that line is a new list item (which it is, thanks to plasticboy/vim-markdown), as soon as I type a \w character, the list item collapses back up and things get wonky.

It's not been too hard to work around yet, but it certainly was weird and confusing at first. :)

brianarn avatar Jan 19 '16 16:01 brianarn

Thanks for the report and for working around the problem.

I've recently experienced some odd list behavior, but with the tpope syntax plugin. I'm not sure of the cause.

It's time that I added regression tests (vader, e.g.) to better track all of these edge cases.

reedes avatar Jan 19 '16 18:01 reedes

I'm encountering this as well (latest HEAD of pencil, just got it today :heart:), and I'm also using the tpope markdown plugin (albeit a slightly old copy). Line-item character, space, text, Enter, everything's ok; then any character (other than a second newline) triggers autoformat and oops, both lines are now merged.

Unlike in Brian's case, any method of arriving on a new line - Enter in insert mode or o in visual mode - has identical results for me.

EDIT: This may be fodder for a separate ticket, but I also can't work around this with :TogglePencil (or :NoPencil etc). (Those may be straight-up broken for me, actually. FWIW I'm on MacOS Yosemite's bundled vim 7.3 at the moment, unclear how much pencil wants eg 7.4?)

bitprophet avatar Apr 18 '16 21:04 bitprophet

Re 7.3: As I had developed pencil a few months after 7.4 became available, it's likely that all my testing had been with that version. (I'm open to backwards compatibility, though I'd have to rely on others to port and test it.)

Re the line-item issue, I haven't yet had a chance to revisit but intend to do in the coming weeks. Hopefully I can do better than to blacklist markdownListMarker which would disable autoformat in lists.

reedes avatar Apr 19 '16 01:04 reedes

Turns out my MacVim binary is 7.4(.258) and it's got the same issue re: inability to disable Pencil. Opened #38 to track. Thanks!

bitprophet avatar Apr 20 '16 00:04 bitprophet

Outlining appears to be broken when using the plasticboy/vim-markdown syntax plugin with Vim's autoformat (which pencil's HardPencil mode relies upon).

This appears to be due to dynamic text handling found in that plugin. It would likely happen independently of pencil with Vim's autoformat enabled, but I haven't dug into it.

reedes avatar Nov 08 '16 00:11 reedes

@reedes have you had a chance to make any progress on this? ❤️

joeybaker avatar May 31 '17 17:05 joeybaker

Sorry, I've been distracted by non-vim projects.

If outlining is broken independent of pencil with Vim's autoformat enabled (via set formatoptions+=a), then I'd consider this a bug with the syntax plugin which should support autoformat. That is what needs to be tested.

reedes avatar Jun 01 '17 20:06 reedes

i'm getting this same issue with newlines getting poofed away in markdown lists, i have tpope's md plugin and this enabled. reading through this there didn't seem to be a real fix and its getting annoying enough that i've taken to disabling pencil for markdown files. if there's any fixes that people have please let me know, i do love using this plugin.

devsnek avatar Mar 22 '18 01:03 devsnek

This is still an issue for me, using tpope's markdown plugin or plasticboy's one.

The syntax groups are just for the list marker, not the whole item, and I think that's perhaps where the issue lies.

zeorin avatar Jul 13 '18 10:07 zeorin

Any news on this? :-)

sjktje avatar Mar 27 '19 13:03 sjktje

Definitely a bug this one :wink:! Also occurs with vim-pandoc's syntax.

alerque avatar Nov 16 '19 11:11 alerque

Has anyone come up with a workaround for this? Other than temporarily disabling Pencil.

thesofakillers avatar Jul 30 '20 15:07 thesofakillers

It's not a great workaround but I use PencilSoft to author markdown and Prettier to format it.

I also find that using textwidth with PencilSoft makes for an acceptable "middle ground" solution:

function SetPencilOptions()
  call pencil#init({ 'wrap': 'soft' })
  set textwidth=80
  set colorcolumn=80
endfunction
autocmd FileType markdown,mkd,text call SetPencilOptions()

jchook avatar Jul 30 '20 17:07 jchook