Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdownListMarker at start of previous line does not disable autoformat #31

Open
reedes opened this issue Apr 24, 2015 · 15 comments
Open
Labels

Comments

@reedes
Copy link
Collaborator

reedes commented Apr 24, 2015

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

reedes pushed a commit that referenced this issue Apr 24, 2015
To make it easier to add new items to a list in HardPencil mode
@reedes
Copy link
Collaborator Author

reedes commented Apr 24, 2015

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 pushed a commit that referenced this issue May 6, 2015
For tpope's markdown syntax, restored standard autoformat behavior for unordered lists, which is generally pretty good.

Ordered lists had annoying behavior for autoformat, so simply disabling autoformat if detected when insert is entered. This isn't ideal, but it's not clear what else can be done now.

Fixed bug for PFormatToggle, where it wasn't properly disabling Vim's autoformat.

Provided help in README for mapping key to toggle autoformat.
@brianarn
Copy link

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. :)

@reedes
Copy link
Collaborator Author

reedes commented Jan 19, 2016

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.

@bitprophet
Copy link

bitprophet commented Apr 18, 2016

I'm encountering this as well (latest HEAD of pencil, just got it today ❤️), 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?)

@reedes
Copy link
Collaborator Author

reedes commented Apr 19, 2016

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.

@bitprophet
Copy link

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!

@reedes
Copy link
Collaborator Author

reedes commented Nov 8, 2016

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.

@joeybaker
Copy link

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

@reedes
Copy link
Collaborator Author

reedes commented Jun 1, 2017

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.

@devsnek
Copy link

devsnek commented Mar 22, 2018

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.

@zeorin
Copy link

zeorin commented Jul 13, 2018

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.

@sjktje
Copy link

sjktje commented Mar 27, 2019

Any news on this? :-)

@alerque alerque added the bug label Nov 16, 2019
@alerque
Copy link
Member

alerque commented Nov 16, 2019

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

@thesofakillers
Copy link

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

@jchook
Copy link

jchook commented Jul 30, 2020

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants