sotte / presenting.vim

A simple tool for presenting slides in vim based on text files.
MIT License
300 stars 50 forks source link

No spaces in filetype are crucial for MD files #7

Closed LIttleAncientForestKami closed 9 years ago

LIttleAncientForestKami commented 9 years ago

at least mentioned now in README

This really puzzled me and blocked me from making a presentation for more than 20 minutes untill I made a careful comparison between working example and non-working one. :-)

I'd like to improve this and make same for other formats and Vim docs, but I don't know them enough to check my work prior to submitting. Can you point me or direct me which checks would be enough? Or are you willing to port this yourself?

sotte commented 9 years ago

I'm currently traveling. I'll look at it in a few days...

But thanks for the pull request! :)

LIttleAncientForestKami commented 9 years ago

Thank you for really fast reply Sotte. Have a save travel, and I just found out it wasn't spaces. Apparently, touching the clause can result in presenting.vim saying "Filetype not supported", which - strangely enough - manifests often after some time. I wonder if I have some cache or what. :/

I only now started learning Vim script to debug this. For now, I've reworked my changes so that the clause from your working examples is used - thus highlighting examples more prominently.

EDIT: Found a so-far reliable replication scenario: if after the clause for markdown filetype (with spaces or without) markdown formatting is added (this or that) then filetype info is lost.

sotte commented 9 years ago

Hey,

just real quick...try a .rst file and check if it happens there? If you have a .markdown file instead of a .md the modline should not be necessary.

LIttleAncientForestKami commented 9 years ago

.rst is safe, even if I cut the modline, add slides, add formatting etc. .md suffers after adding just two headers or one header with formatting .markdown created from .md via cp which had modline (with spaces) did present. With 3 new headers (empty slides, with just headers) got "filetype not supported" message and became non-presentable.

sotte commented 9 years ago

Very interesting...maybe post your .md file. I'll have a look later. But now: vacation :)

LIttleAncientForestKami commented 9 years ago

Sure thing. Enjoy your vacation! :-) Might be I'll get there prior to your return.

Simple debug showed what the problem is:

Why is option changing the value to mkd, I don't know yet, I need to learn more about Vim options.

EDIT: It is set on new buffer or buffer read events by another plugin I use for Markdown, vim-markdown. The plugin sets all md variants to filetype mkd:

" markdown filetype file
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}   set filetype=mkd
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=mkd

I'll add the additional line to separator dictionary for mkd then, since I think it's used in more than one Vim plugin dealing with markdown as filetype. However I'm open to tackling this differently, if you'll prefer so Sotte.

Enjoy your vacation and thanks for the plugin. :-)

sotte commented 9 years ago

Hey @LIttleAncientForestKami,

glad you figured it out! Can you open a new pull request in a separate branch only containing the relevant changes? I want to keep the history clean. Thanks!

LIttleAncientForestKami commented 9 years ago

Sure. Squash commits into one?

sotte commented 9 years ago

The first and second commit are not really relevant. I only want the last one, maybe with a comment about mkd directly in presenting.vim.

LIttleAncientForestKami commented 9 years ago

OK, closing, instead take a look at PR#8: https://github.com/sotte/presenting.vim/pull/8

sotte commented 9 years ago

Thanks!