Discussion:
vim-pandoc
David Sanson
2011-08-27 16:30:38 UTC
Permalink
Hi All,

There has been a recent spate of significant improvements to the vim-pandoc
bundle. Felipe Morales has been responsible for most of them: the syntax
file is now much better, correctly recognizing most of Pandoc's extended
markdown; the convert-and-open commands should now work on OS X, Linux
(you'll need xdg-open installed), and Windows.

For my part, I finally got around to getting citation autocompletion
working. And I wrote up some documentation that explains all the things that
the plugin does.

And Wei Dai fixed a bunch of newbie mistakes I had made when I wrote the
plugin, ensuring that it should now be much better behaved.

We moved it all over to a shared repository so we can do a better job of
keeping future improvements synchronized. So if you use vim to write
Pandoc's extended markdown, check it out:
https://github.com/vim-pandoc/vim-pandoc

(My installation recommendation: use the pathogen plugin and clone the
vim-pandoc respository into the ~/.vim/bundle folder.)

Best,
David
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/jpqD3-hF7ckJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
John MacFarlane
2011-08-27 16:50:25 UTC
Permalink
Neat! Thanks, all.
Post by David Sanson
Hi All,
There has been a recent spate of significant improvements to the
vim-pandoc bundle. Felipe Morales has been responsible for most of
them: the syntax file is now much better, correctly recognizing most of
Pandoc's extended markdown; the convert-and-open commands should now
work on OS X, Linux (you'll need xdg-open installed), and Windows.
For my part, I finally got around to getting citation autocompletion
working. And I wrote up some documentation that explains all the things
that the plugin does.
the plugin, ensuring that it should now be much better behaved.
We moved it all over to a shared repository so we can do a better job
of keeping future improvements synchronized. So if you use vim to write
https://github.com/vim-pandoc/vim-pandoc
(My installation recommendation: use the pathogen plugin and clone the
vim-pandoc respository into the ~/.vim/bundle folder.)
Best,
David
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
To view this discussion on the web visit
[1]https://groups.google.com/d/msg/pandoc-discuss/-/jpqD3-hF7ckJ.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/pandoc-discuss?hl=en.
References
1. https://groups.google.com/d/msg/pandoc-discuss/-/jpqD3-hF7ckJ
Joseph Reagle
2011-08-27 20:54:04 UTC
Permalink
Post by David Sanson
For my part, I finally got around to getting citation autocompletion
working. And I wrote up some documentation that explains all the things that
the plugin does.
I don't use vim, but I'm envious of bibtex key autocompletion! I use Kate and Word for editing my markdown and in Word I make use of the JabRef macro for inserting keys but its query mechanism isn't that great (you can do a query, and it simply returns all the relevant keys); I'd love to see an autocomplete popup with key and and first few words of title. (Plus; the JabRef leaves the keys in special fields '<Smith2009>' that can't be edited until saved as a text file and reloaded, and then they are simple text (so I replace '<...>' with '[@...]).

Does anyone know of nice editors or macros with bibtex key autocompletion/insertion?
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
David Sanson
2011-08-27 22:34:03 UTC
Permalink
Post by Joseph Reagle
I'd love to see an autocomplete popup with key and and first few words
of title.
Yes, that would be ideal. Right now vim-pandoc just returns a popup with a
list of matching keys (invoked either by ctrl-x ctrl-o or by hitting tab if
you are using the SuperTab bundle) , and the autocompletion in my [Textmate
bundle] just cycles through matching keys (invoked by hitting ESC after
typing part of a citekey). Both bundles make use of a simple ruby script to
harvest the keys. Here is a version that you can run as a script from the
command line

#!/usr/bin/env ruby

bib = /path/to/bibfile
string = ARGV.shift

File.open(bib) { |file|
text = file.read
keys = []
keys = keys + text.scan(/@.*?\{(#{string}.*?),/i)
keys.uniq!
keys.sort!
puts keys
}

It shouldn't be too complicated to harvest key-title pairs instead of keys,
and in vim, at least, the completion function call knows how to handle this
sort of thing, so getting the ideal behavior isn't far off.
Post by Joseph Reagle
Does anyone know of nice editors or macros with bibtex key
autocompletion/insertion?
Aside from Textmate and Vim? A lot of editors have autocompletion for bibtex
citations when writing latex documents, so you might be able to adapt that.
But I don't know of any that provide pandoc-specific support, or, for that
matter, support for autocompleting bare citekeys (rather than completing
citekeys within a `\cite{` context or the like). Bibdesk used to offer an
[Input Manager], but they dropped it.

Another strategy is to use dictionary autocompletion. On Macs, there is
system wide support (more or less) for dictionary autocompletion: just hit
ESC (or F5 if ESC does something else) in the middle of a word, and you'll
get a popup suggesting word completions (you can try this in TextEdit, for
example). I assume other OSs have similar functionality? So you ought to be
able to add all your citekeys to the system dictionary and use that. (The
ruby script above will give you a list of all your citekeys if you just run
it without any arguments; pipe the results through something like `sed
's/^/@/` and pipe that into a text file, and you a list of pandoc style
citation keys. Getting that into the form of a "dictionary" will depend on
your OS. Of course, you'll have to do this again every time you add new
entries to your bibtex file.) The advantage of this, if you can get it
working, is it gives you autocompletion even in editors that have very few
features, like Writeroom.

David

[Textmate bundle]: https://github.com/dsanson/Pandoc.tmbundle
[Input Manager]:
http://bibdesk.sourceforge.net/manual/BibDesk%20Help_54.html
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/ith8kh3cPKcJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Joseph Reagle
2011-08-28 02:14:50 UTC
Permalink
Dirk Laurie
2011-08-27 22:09:07 UTC
Permalink
Post by David Sanson
We moved it all over to a shared repository so we can do a better job of
keeping future improvements synchronized. So if you use vim to write
https://github.com/vim-pandoc/vim-pandoc
In ftdetect/pandoc.vim and doc/pandoc.txt, change 'text' to 'txt'.

Dirk
David Sanson
2011-08-27 22:56:32 UTC
Permalink
Post by Dirk Laurie
In ftdetect/pandoc.vim and doc/pandoc.txt, change 'text' to 'txt'.
Dirk
We can add ftdetect support for *.txt files if that's what people want. I
was worried that treating all *.txt files as pandoc files was a bit too
aggressive. On the other hand, *.text is Gruber's preferred extension for
markdown files, so that seemed like fair game, given the somewhat aggressive
decision to claim all markdown files as pandoc files.

David
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/e59I7fKGUk0J.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Dirk Laurie
2011-08-28 08:54:27 UTC
Permalink
Post by David Sanson
Post by Dirk Laurie
In ftdetect/pandoc.vim and doc/pandoc.txt, change 'text' to 'txt'.
Dirk
We can add ftdetect support for *.txt files if that's what people want.
Well, it's easy to do that for oneself, and I have in fact already done
so. I thought it was a typo, since the documentation file is called
pandoc.txt, and therefore is not recognized by ftdetect as shipped.
Post by David Sanson
I was worried that treating all *.txt files as pandoc files was a bit too
aggressive. On the other hand, *.text is Gruber's preferred extension for
markdown files, so that seemed like fair game, given the somewhat aggressive
decision to claim all markdown files as pandoc files.
It takes a couple of clicks to switch off syntax highlighting if it is
distracting in some other *.txt file.

Either way, modifying one's local ftdetect/pandoc.vim or switching
syntax off for a specific edit session, is very little trouble.

But I suppose one must think of a future in which pandoc.vim is included
in the Vim distribution.

So I'll change my suggestion to:

Rename pandoc.txt to pandoc.text.

Dirk
David Sanson
2011-08-28 14:37:21 UTC
Permalink
Post by Dirk Laurie
Rename pandoc.txt to pandoc.text
Vim only scans help files with the "txt" extension (that's not quite true,
but close enough). I added a modeline to the bottom of pandoc.txt that sets
its filetype to pandoc.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/sKcZ7nQj4I0J.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Dirk Laurie
2011-09-02 15:11:18 UTC
Permalink
Post by David Sanson
There has been a recent spate of significant improvements to the
vim-pandoc bundle.
...
Post by David Sanson
https://github.com/vim-pandoc/vim-pandoc
It no longer highlights two trailing spaces (i.e. hard linebreak)
as the old version did.

Dirk
Dirk Laurie
2011-09-02 16:00:24 UTC
Permalink
Post by Dirk Laurie
Post by David Sanson
There has been a recent spate of significant improvements to the
vim-pandoc bundle.
...
Post by David Sanson
https://github.com/vim-pandoc/vim-pandoc
It no longer highlights two trailing spaces (i.e. hard linebreak)
as the old version did.
Arggh! I just pulled the latest version and many, many things
look different from the one I got just after David's 27 August
post. I get the impression that both David and Felipe are working
hard on the current version, but independently, so I think I want
to get back to the 27 August version and wait for the activity to
simmer down!

How can I do that?

Dirk
David Sanson
2011-09-02 18:40:55 UTC
Permalink
Sorry about that. When I posted, I thought things were settling down! But
Felipe has been on a bit of a tear. He is just completing a bottom up
rewrite of the syntax file, for example, which should fix a lot of things.
He also rewrote the convert-and-open commands so that they work on linux and
windows, not just OS X.

We had disabled the highlighting of hard linebreaks because it seemed to be
associated with slow downs.

If you want to go back to August 27th, assuming you are using git, go to the
vim-pandoc directory and execute

git checkout a19acff

If that's not quite what you wanted, take a look at

https://github.com/vim-pandoc/vim-pandoc/commits/

Find the commit you want and take the commit id (that long string on letters
and numbers at the end of the url), and

git checkout <commit id>

We are aiming to get to a point where things are settled down, at which
point we'll plop a version on it and publish it on vimscripts.

David
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/njAXwqWqYJcJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Felipe Morales
2011-09-02 16:08:36 UTC
Permalink
Post by Dirk Laurie
Post by Dirk Laurie
Post by David Sanson
There has been a recent spate of significant improvements to the
vim-pandoc bundle.
...
Post by David Sanson
https://github.com/vim-pandoc/vim-pandoc
It no longer highlights two trailing spaces (i.e. hard linebreak)
as the old version did.
Arggh! I just pulled the latest version and many, many things
look different from the one I got just after David's 27 August
post. I get the impression that both David and Felipe are working
hard on the current version, but independently, so I think I want
to get back to the 27 August version and wait for the activity to
simmer down!
How can I do that?
Dirk
Hi Dirk,
can you tell me what problems did you see? I'm rewriting the syntax
file, but those changes are not in master yet. Can you test it out?
Those are in the new-syntax branch:

git checkout new-syntax

You can also go back N revisions with

git checkout HEAD^N

Regards.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Dirk Laurie
2011-09-03 10:04:30 UTC
Permalink
Post by Felipe Morales
can you tell me what problems did you see?
The version on master at the time did things like: I start a document
with `## heading`. It is highlighted. Fine. A little later, I decide
I need some text before the heading. Nice open line so the heading will
still be recognized by Pandoc. Whoops! No more highlighting for that
heading.
Post by Felipe Morales
I'm rewriting the syntax file, but those changes are not in master
yet. Can you test it out?
Yes. It's OK so far, but I do miss the hard linebreak highlighting.
It's almost always a mistake in the case of my documents, so the
warning is really helpful.

Dirk
Felipe Morales
2011-09-03 15:44:27 UTC
Permalink
We've fixed that problem on the headings with the new changes, which
are already
in master. We've also re-added the highlighting of problematic spaces
in the end of
lines.

If you're using hardbreaks, set g:pandoc_use_hard_breaks to 1 in
your .vimrc and then the text will be be broken automatically. It
shouldn't leave any
space at the end of lines. You can also add

let g:pandoc_auto_format = 1

so paragraphs are reflown if you insert text in the middle of them,
but that has some
issues, and can be slow.
Post by Dirk Laurie
Post by Felipe Morales
can you tell me what problems did you see?
The version on master at the time did things like: I start a document
with `## heading`.  It is highlighted.  Fine.  A little later, I decide
I need some text before the heading.  Nice open line so the heading will
still be recognized by Pandoc.  Whoops!  No more highlighting for that
heading.
Post by Felipe Morales
I'm rewriting the syntax file, but those changes are not in master
yet. Can you test it out?
Yes.  It's OK so far, but I do miss the hard linebreak highlighting.
It's almost always a mistake in the case of my documents, so the
warning is really helpful.
Dirk
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.
Loading...