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

Pencil and Markdown issue with lists

Open KRSHK opened this issue 3 years ago • 8 comments

Hi ! I'm actually using Pencil in addition to markdown-vim. I setup my pencil plugin but when I begin a list, when writing a new list entry, the cursor goes back, and continue the previous line as following:

This is the wanted behavior:

- first element of my list
- second element of the list

But this is how it reacts when I press Enter to begin a new line, markdown-vim add automatically a new dash, but when I start to write my new entry, Pencil remove the dash and the new line to continue my writing after my first entry:

- first element of my list second element of my list

Any idea ?

KRSHK avatar Oct 08 '20 07:10 KRSHK

Which markdown-vim are you using? There is more than one plugin by that name in the wild.

alerque avatar Oct 08 '20 07:10 alerque

Which markdown-vim are you using? There is more than one plugin by that name in the wild.

The one from plasticboy

KRSHK avatar Oct 08 '20 08:10 KRSHK

@alerque I am using built in one as well as VimWiki and in both cases the problem persists.

hauleth avatar Dec 09 '20 13:12 hauleth

It also happens with * lists. It may be a duplicate of #31

lyz-code avatar Feb 09 '21 09:02 lyz-code

I found a workaround in this issue on plasticboy markdown.

autocmd BufRead,BufNewFile *.md setlocal comments=fb:>,fb:*,fb:+,fb:-

However, new list items no longer automatically starts with - or * . At least now lists are usable in hardwrap mode.

The relevant section of my .vimrc looks like this.

au FileType markdown setlocal textwidth=80
let g:vim_markdown_new_list_item_indent=0
au FileType markdown setlocal comments=fb:>,fb:*,fb:+,fb:-
au FileType markdown setlocal fo+=2ca

omichaelo avatar Apr 02 '21 23:04 omichaelo

Has there been any update on this issue? I have also experienced this problem with :HardPencil in latex files. Luckily, it does not seem to appear in :SoftPencil mode, but when :Pencil activates :HardPencil by default in latex files, it can be quite obnoxious. Screencast from 2023-06-24 07-23-10.webm

cachandlerdev avatar Jun 24 '23 14:06 cachandlerdev

I don't have any specific fix to offer re list behavior, but I recall when I coded Pencil that behavior could be dependent on the syntax plugin, such as plasticboy which actively managed lists.

Ideally Pencil's defaults will work cleanly with all the syntax plugins. But that'll require someone to dive into figuring out better Pencil defaults.

Re hardpencil behavior with Latex, that's likely an autoformat issue that needs tweaking of the blacklist. (Best pursued as a separate issue)

reedes avatar Jul 12 '23 04:07 reedes

Plasticboy's markdown syntax plugin is now under the preservim umbrella now to, so we have access to both ends of the stick. Anybody is welcome to contribute whatever it takes to make them work together cleanly, and yes working out of the box with all major syntax plugins is the goal.

alerque avatar Aug 12 '23 19:08 alerque