vim-pandoc / vim-pandoc-legacy

[UNSUPPORTED/use vim-pandoc/vim-pandoc] vim bundle for pandoc users
143 stars 23 forks source link

bibfile extensions, directories #29

Closed dsanson closed 13 years ago

dsanson commented 13 years ago

I happen to have a directory named bib in my home directory. If I am working with a markdown file in my home directory, vim-pandoc sees this directory, and sets b:pandoc_bibfiles = [ 'bib' ]. That results in an error message when I try to complete, saying that 'bib' is a directory.

This seems like it involves two errors:

  1. A file named bib shouldn't be matched, since it does not have the .bib extension. (Should a hidden file named .bib be matched? Probably not.)
  2. We should check if matched files are directories before adding them to b:pandoc_bibfiles. Really, we should check to see if they are readable text files.
fmoralesc commented 13 years ago

Can you check if changing the line 57 in autoload/pandoc.vim to

    bibfiles = [f for f in glob("*.*") if f.split(".")[-1] in bib_extensions]

solves it? (at least it should solve 1)

dsanson commented 13 years ago

yep, that fixes it: doesn't match the bib folder, or a file named .bib.

fmoralesc commented 13 years ago

I pushed those changes. It should also check if the items in the bibfiles list are readable and not directories.