unite-bibtex


Ⅰ. 插件描述

a BibTeX source for unite.vim

Ⅱ. 基本信息

创建日期:  2015-05-22
使用用户:  2
Github星:  15
插件作者:  Mark Sprevak

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'msprev/unite-bibtex-looking-forward'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'msprev/unite-bibtex-looking-forward'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'msprev/unite-bibtex-looking-forward'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/msprev/unite-bibtex

Ⅳ. 文档说明

This plugin is no longer being maintained. Unite is no
longer maintained, so it makes sense to wind down this too. **Here
is a much faster replacement for this source, designed for fzf:
fzf-bibtex**

I can confirm that unite-bibtex still works under the last version of
Unite with vim built with Python 2 (although not vim built with Python
3, Neovim, or Denite).

For a variety of reasons (some hinted above), I have switched from Unite
to fzf. The new source linked
above has no dependency on vim's python version, or indeed on vim (it could be
used with another text editor). It looks similar to the picture above,
but it is a lot faster than unite-bibtex.

unite-bibtex

A BibTeX source for unite.vim

The keys of the selected candidates are inserted at the cursor.

BibTeX files are listed in the variable g:unite_bibtex_bib_files.

The buffer-specific variable `b:unite_bibtex_bib_files` overrides this.
Multiple BibTeX files can be passed to both.

Citations are by default inserted in [pandoc][]'s citation format (e.g. @SomeKey93; @AnotherKey94).
You can change this, on a per buffer basis, by setting the variables:

  • let b:unite_bibtex_prefix = '\citet{
  • let b:unite_bibtex_postfix = '}
  • let b:unite_bibtex_separator = ', '

Parsing BibTeX databases is computationally intensive, so the source caches the results.

The cache is updated if the underlying BibTeX file has been changed.
The cache directory is set by `g:unite_bibtex_cache_dir`.
This variable must be set for the source to work.

Requirements

  • [unite][]
  • vim built with Python 2

Use

  1. Install [bibtexparser][]: pip2 install bibtexparser
  2. Install [unite][]
  3. Install this plugin (e.g. via [vim-plug][])
  4. Set variable: let g:unite_bibtex_bib_files=['/path/to/your/bib/file1.bib']
  5. Set variable: let g:unite_bibtex_cache_dir='/path/to/your/temp_dir'
  6. :Unite bibtex in vim
  7. :messages to see any errors or warnings from the BibTeX parser

Variables

The following variables can be set:

  • g:unite_bibtex_bib_files, b:unite_bibtex_bib_files <-- at least 1 of these must be set
  • g:unite_bibtex_cache_dir <-- must be set
  • b:unite_bibtex_prefix, if not set assumes '@'
  • b:unite_bibtex_postfix, if not set assumes ''
  • b:unite_bibtex_separator, if not set assumes '; '

bibwatch.py

This plugin includes a separate Python executable, bibwatch.

bibwatch runs in the background in the terminal and watches for changes to selected BibTeX files.

Once it detect a change, it updates the corresponding unite-bibtex cache.
This means your Unite bibtex source in vim will be populated with zero or minimal lag, even for very large BibTeX databases.

bibwatch is in unite-bibtex/pythonx/core inside the unite-bibtex plugin.

Go to this directory in the terminal to run `./bibwatch.py`
Pass paths to any BibTeX files you want watched.
Pass your cache directory (as defined in `g:unite_bibtex_cache_dir`) as the value of `--cache`.
For example:

./bibwatch.py /path/to/your/bib/file1.bib /path/to/your/bib/file2.bib --cache /path/to/your/temp_dir

Press Control+C to terminate bibwatch.

Troubleshooting

You can correct your .bib file with pybtex:

pip2 install pybtex
pybtex-convert /path/to/your.bib out.bib

Similar projects

Release notes

  • 1.0 (25 September 2015):

    • new: implement bibwatch, separate executable
    • new: implement persistent cache
    • new: support multiple BibTeX files
    • new: support buffer local and global settings
    • new: configuration variables for prefix, postfix, and separator for citations
    • fix: refactor code base
    • fix: update to work with latest version of bibtexparser
    • breaking change: BibTeX files now set with new variable g:unite_bibtex_bib_files

添加新评论