Skip to content

Latest commit

 

History

History
275 lines (187 loc) · 8.24 KB

README.md

File metadata and controls

275 lines (187 loc) · 8.24 KB

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#insert_quote() 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 here. The most useful alternative is probably a regular blankspace. Might be specified like this:

let g:BibleDelimiter = " "

Using the plugin

The following arguments can be passed to bible#insert_quote():

bible#insert_quote(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#insert_quote()<CR>
vnoremap <leader>b y :call bible#insert_quote(@*)<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 arguments. 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#insert_quote().

Example 1:

Input:

:call bible#insert_quote()

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#insert_quote()<CR>
vnoremap <C-I> y :call bible#insert_quote(@*)<CR>

Example 2:

Input:

:call bible#insert_quote('', "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#insert_quote('', "KJV")<CR>
vnoremap <C-I>k y :call bible#insert_quote(@*, "KJV")<CR>

Example 3:

Input:

:call bible#insert_quote('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 version. 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#insert_quote('', 'nlt-se', '\\4', 'en', ' ', 0)<CR>
vnoremap <C-I>n y :call bible#insert_quote(@*, '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#insert_quote('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#insert_quote('', 'jfa-rc', '\\4', 'pt', ' ', 1)<CR>
vnoremap <C-I>j y :call bible#insert_quote(@*, 'jfa-rc', '\\4', 'pt', ' ', 1)<CR>

Example 5:

Input:

:call bible#insert_quote('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#insert_quote('', SpaRV', '> \\3. \\4', 'es', ' ', 0)<CR>
vnoremap <C-I>r y :call bible#insert_quote(@*, 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.