Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Changing your `coc-settings.json` file will change the behavior of `coc-bibtex`

### Setting BibTeX File Location

Set `list.source.bibtex.files` to an array containing your `.bib` files. For instance, in `coc-settings.json`:
Set `coc.preferences.bibtex.files` to an array containing your `.bib` files. For instance, in `coc-settings.json`:

~~~json
{
Expand All @@ -38,7 +38,7 @@ Set `list.source.bibtex.files` to an array containing your `.bib` files. For ins
Or in vimrc:

~~~vim
call coc#config('list.source.bibtex', {
call coc#config('coc.preferences.bibtex', {
\ 'files': [
\ '~/my-library.bib'
\ ]
Expand All @@ -55,12 +55,12 @@ By default, the following filetypes are supported for completion:
* pandoc
* markdown

To change this behavior, determine the `filetype` (in Vim) you wish to add. This can be done by running `:set filetype?` with the kind of file you wish to support. Then, edit `coc.source.bibtex.filetypes` to include the `filetype` you wish to support (you will also have to include the default types, too).
To change this behavior, determine the `filetype` (in Vim) you wish to add. This can be done by running `:set filetype?` with the kind of file you wish to support. Then, edit `coc.preferences.bibtex.filetypes` to include the `filetype` you wish to support (you will also have to include the default types, too).

If, for instance, you wanted to add support for `.textile` files, you would need to include the following in your `coc-settings.json` file:

~~~json
coc.source.bibtex.filetypes: [
coc.preferences.bibtex.filetypes: [
"tex",
"plaintex",
"latex",
Expand All @@ -83,12 +83,12 @@ To trigger completion with a citation command in LaTeX, instead of the pandoc-st
~~~json
{
//...
"coc.source.bibtex.triggerPatterns": ["\\\\cite\\{"],
"coc.source.bibtex.triggerCharacters": []
"coc.preferences.bibtex.triggerPatterns": ["\\\\cite\\{"],
"coc.preferences.bibtex.triggerCharacters": []
}
~~~

This will also work for the `\cite{}` command. Changing `coc.source.bibtex.triggerPatterns` to `cite\\{` will work for any of the commands that end in `cite`, not just `\cite`.
This will also work for the `\cite{}` command. Changing `coc.preferences.bibtex.triggerPatterns` to `cite\\{` will work for any of the commands that end in `cite`, not just `\cite`.

#### List

Expand All @@ -100,7 +100,7 @@ In `coc-settings.json`:
{
//...

"list.source.bibtex": {
"coc.preferences.bibtex": {
"citation": {
"before": "\\cite{",
"after": "}"
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"configuration": {
"type": "object",
"properties": {
"list.source.bibtex.files": {
"coc.preferences.bibtex.files": {
"type": "array",
"default": [],
"description": "List of .bib files to read.",
"items": {
"type": "string"
}
},
"list.source.bibtex.citation": {
"coc.preferences.bibtex.citation": {
"type": "object",
"default": {
"before": "[@",
Expand All @@ -66,11 +66,11 @@
"type": "boolean",
"default": false
},
"coc.source.bibtex.shortcut": {
"coc.preferences.bibtex.shortcut": {
"type": "string",
"default": "BIB"
},
"coc.source.bibtex.triggerCharacters": {
"coc.preferences.bibtex.triggerCharacters": {
"type": "array",
"default": [
"@"
Expand All @@ -79,14 +79,14 @@
"type": "string"
}
},
"coc.source.bibtex.triggerPatterns": {
"coc.preferences.bibtex.triggerPatterns": {
"type": "array",
"default": [],
"items": {
"type": "string"
}
},
"coc.source.bibtex.filetypes": {
"coc.preferences.bibtex.filetypes": {
"type": [
"array",
"null"
Expand Down
4 changes: 2 additions & 2 deletions src/cacheFullFilePaths.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {workspace} from 'coc.nvim'
const cacheFullFilePaths = async (): Promise<string[]> => {
const {nvim} = workspace
const config = workspace.getConfiguration('list.source.bibtex')
const config = workspace.getConfiguration('coc.preferences.bibtex')
const files = config.get<string[]>('files', [])
const output = []
if (files.length === 0) {
workspace.showMessage('No .bib files provided; set list.source.bibtex to a list of .bib files')
workspace.showMessage('No .bib files provided; set coc.preferences.bibtex to a list of .bib files')
}
const globRegexp = new RegExp('\\*', 'g');
for (const file of files) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function activate(context: ExtensionContext): Promise<void> {

async function updateCache(): Promise<void> {
const filetype = await nvim.eval('&filetype')
const filetypes = config.get('coc.source.bibtex.filetypes', [
const filetypes = config.get('coc.preferences.bibtex.filetypes', [
'tex',
'plaintex',
'latex',
Expand Down
2 changes: 1 addition & 1 deletion src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class FilesList extends BasicList {
private async cacheFilePaths(): Promise<void> {
const filetype = await workspace.nvim.eval('&filetype')
const config = workspace.getConfiguration()
const filetypes = config.get('coc.source.bibtex.filetypes', [
const filetypes = config.get('coc.preferences.bibtex.filetypes', [
'tex',
'plaintex',
'latex',
Expand Down
2 changes: 1 addition & 1 deletion src/makeCitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface CitationConfiguration {
}

const makeCitation = (id:string):string => {
const config = workspace.getConfiguration('list.source.bibtex')
const config = workspace.getConfiguration('coc.preferences.bibtex')
const {before,after} = config.get<CitationConfiguration>('citation', {before: '[@', after: ']'})
return `${before}${id}${after}`
}
Expand Down