Skip to content

codybuell/cmp-lbdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmp-lbdb

lbdb completion source for nvim-cmp. Names, emails, and email header recipient formatted completions are provided for contacts found in lbdb.

screenshot

Installation

Use your favorite plugin manager:

  • vim-plug

    Plug 'codybuell/cmp-lbdb'
  • pathogen

    git clone https://github.com/codybuell/cmp-lbdb.git ~/.config/nvim/bundle/cmp-lbdb
  • native package manager

    git clone https://github.com/codybuell/cmp-lbdb.git ~/.config/nvim/pack/bundle/opt/cmp-lbdb
    packadd! cmp-lbdb

Usage

-- setup with defaults (markdown and mail file types)
require('cmp').setup({
  -- snip...
  sources = {
    -- snip...
    { name = lbdb },
    -- snip...
  }
})

-- or alternatively, enable with overrides
require('cmp').setup({
  -- snip...
  sources = {
    -- snip...
    {
      name = 'lbdb',
      option = {
        filetypes = {
          'mail',
          'markdown',
          'gitcommit'
        },
        blacklist = {
          'user@host.com',
          '.*noreply.*',
        },
        mail_header_only = true,
      },
    },
    -- snip...
  }
})

Options

filetypes (type: table)

Default: { 'mail', 'markdown' }

Sets what filetypes the completion source will be made available.

blacklist (type: table)

Default: { '.*not?.?reply.*' }

The blacklist sets what emails to exclude from the completion list. The default value will catch variations of noreply, no-reply, do-not-reply, and so on. Lua pattern matching can be used.

mail_header_only (type: boolean)

Default: false

If set to true completions will only be provided when in the email header (any line stating with To:, From:, Cc:, etc) of a buffer of mail filetype. All other enabled filetypes will source completions as normal.