/cmp-lbdb

lbdb completion source for nvim-cmp

Primary LanguageLuaMIT LicenseMIT

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',
      filetypes = { 'mail', 'markdown', 'gitcommit' }
      blacklist = {
        'user@host.com',
        '.*noreply.*',
      },
    },
    -- 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.