vim-bible


Ⅰ. 插件描述

Simple vim plugin to insert Bible passages.

Ⅱ. 基本信息

创建日期:  2014-08-29
使用用户:  1
Github星:  8
插件作者:  roggan87

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'roggan87/vim-bible'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'roggan87/vim-bible'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'roggan87/vim-bible'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

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

Ⅳ. 文档说明

vim-bible

Vim-bible is a simple vim plugin that makes it easy to insert a Bible passage
into vim. The plugin is inspired by this plugin.

To use the plugin, run :call Bible() in vim and enter your query. You can also
map the command like described in Using the plugin.

Note: You need to have Diatheke/Sword installed. This is the backend being

used to extract the Bible text.

Installation

With Pathogen:

cd ~/.vim/bundle
git clone git://github.com/roggan87/vim-bible.git

Settings

g:BibleTranslation

This is the default Bible translation that will be used. Specify the name of the
module here. If you're not sure about the correct abbreviation, you can run:

diatheke -b system -k modulelist

In your ~/.vimrc specify the translation like this:

let g:BibleTranslation = "KJV"

g:BibleFormat

This is how you want the text to be formatted before inserted into the document.
It is formatted like a sed replacement string, with a few backreferences
available:

  1. The name of the book
  2. The chapter
  3. The verse
  4. The text itself

Here are some examples of how it may look like. Note how the backreferences are
double escaped.

:let g:BibleFormat = "\\3. \\4"
16. For God so loved the world...

:let g:BibleFormat = "(\\2:\\3) \\4"
(3:16) For God so loved the world...

:let g:BibleFormat = "> (\\3) \\4"
> (16) For God so loved the world...

:let g:BibleFormat = "\\4"
For God so loved the world...

g:BibleLocale

The locale specifies your language (mainly used for names on books, references
etc.). It consists of two characters. You may try your own locale with the
following command:

# Note how the query is language specific (swedish/sv)
diatheke -b KJV -l sv -k 1 Mos 1:1

In the ~/.vimrc file:

let g:BibleLocale = "sv"

g:BibleOmitModuleName

Diatheke ends the passage with the name of the translation inside parenthesis.
By default vim-bible removes it. If you want to include the module name, use the
following setting:

let g:BibleOmitModuleName = 0

g:BibleDelimiter

If you want another character than a newline between every verse, specify it

  1. The most useful alternative is probably a regular blankspace. Might be
  2. like this:
let g:BibleDelimiter = " "

Using the plugin

The following arguments can be passed to Bible():

Bible(query, translation, format, locale, delimiter, omitModuleName)

query: This is the bible reference to be inserted. If set to "" or omitted,
the user will be prompted for the query.

translation: The bible translation to be used. If set to "" or omitted, the
default translation will be used (g:BibleTranslation), and if the default
translation is not set, the user will be prompted for the translation.

format, locale, delimiter, omitModuleName, are the equivalents of
g:BibleFormat, g:BibleLocale,
g:BibleDelimiter,
g:BibleOmitModuleName.

If you don't use several translations the easiest way to configure the plugin
is by setting up the global defaults. Here is an example:

let g:BibleTranslation = "nlt-se"
let g:BibleFormat = "\\4"
let g:BibleLocale = "en"
let g:BibleDelimiter = " "

nnoremap <leader>b y :call Bible()<CR>
vnoremap <leader>b y :call Bible(@*)<CR> "Use selection as query

With those mappings you can type <leader>b in normal mode, enter the
query, and the text is inserted. You may also select a query in visual
mode and run <leader>b to insert the corresponding Bible passage.

If you use several translations, you need to expand the prior global values as

  1. In the following examples you can use how to use the plugin directly
    (which might not be very comfortable) and how to map the Bible().

Example 1:

Input:

:call Bible()

Explanation: This type of settings will use the defaults. It will prompt for a
Query passage and translation. In this example we used John 3:16-17 and
KJV.

Output:

John 3:16: For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
John 3:17: For God sent not his Son into the world to condemn the world; but that the world through him might be saved.
(KJV)

Example of mappings using ctrl+i:

nnoremap <C-I> y :call Bible()<CR>
vnoremap <C-I> y :call Bible(@*)<CR>

Example 2:

Input:

:call Bible('', "KJV")

Explanation: This command will explicitly use the KJV bible translation, but
will still prompt the user for the Query passage.

Output:

John 3:16: For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
John 3:17: For God sent not his Son into the world to condemn the world; but that the world through him might be saved.
(KJV)

Example of mappings using ctrl+i + k:

nnoremap <C-I>k y :call Bible('', "KJV")<CR>
vnoremap <C-I>k y :call Bible(@*, "KJV")<CR>

Example 3:

Input:

:call Bible('John 3:16-17', 'nlt-se', '\\4', 'en', ' ', 0)

Explanation: This type of settings will print the verses together as a full
paragraph without querying for a Bible passage. It will also append the bible

  1. The example uses the nlt-se (New Living Translation, Second Edition)
    Bible translation in English. Example:

Output:

For God loved the world so much that he gave his one and only Son, so that everyone who believes in him will not perish but have eternal life. God sent his Son into the world not to judge the world, but to save the world through him. (nlt-se)

Example mappings using ctrl-i + n:

nnoremap <C-I>n y :call Bible('', 'nlt-se', '\\4', 'en', ' ', 0)<CR>
vnoremap <C-I>n y :call Bible(@*, 'nlt-se', '\\4', 'en', ' ', 0)<CR>

With those mappings you can type <C-I>n in normal mode, enter the
query, and the text is inserted. You may also select a query in visual
mode and run <C-I>n to insert the corresponding Bible passage.

Example 4:

Input:

:call Bible('John 3:16-17', 'jfa-rc', '\\4', 'pt', ' ', 1)

Explanation: This type of call is similar to the prior, except that it will
remove the module name. The example uses the jfa-rc (João Ferreira de
Almeida, versão revisada corrigida) Bible translation in Portuguese. Example:

Output:

Porque Deus amou o Mundo de tal maneira que deu o seu Filho unigénito, para que todo aquele que nele crê não pereça, mas tenha a vida eterna. Porque Deus enviou o seu Filho ao mundo, não para que condenasse o mundo, mas para que o mundo fosse salvo por ele.

Example of mappings using ctrl-i + j:

nnoremap <C-I>j y :call Bible('', 'jfa-rc', '\\4', 'pt', ' ', 1)<CR>
vnoremap <C-I>j y :call Bible(@*, 'jfa-rc', '\\4', 'pt', ' ', 1)<CR>

Example 5:

Input:

:call Bible('John 3:16-17', 'SpaRV', 'Verse \\3. \\4', 'es', '\n', 0)

Explanation: This type of call is similar to the prior, except that it will
change the formatting. It will show the module name also. The example uses the
SpaRV (Reina Valera 1909) Bible translation in Spanish. Example

Output:

Verse 16. Porque de tal manera amó Dios al mundo, que ha dado á su Hijo unigénito, para que todo aquel que en él cree, no se pierda, mas tenga vida eterna.
Verse 17. Porque no envió Dios á su Hijo al mundo, para que condene al mundo, mas para que el mundo sea salvo por él.
(SpaRV)

Example of mappings using ctrl-i + r:

nnoremap <C-I>r y :call Bible('', SpaRV', '> \\3. \\4', 'es', ' ', 0)<CR>
vnoremap <C-I>r y :call Bible(@*, SpaRV', '> \\3. \\4', 'es', ' ', 0)<CR>

Copyright & license

(c) Robert Rosman 2014

Licensed under GNU GPL v3.

Contributors

  • [@vonpupp]. Decoupled configuration from plugin and added multi-translation Bible support.

添加新评论