/cmp-tmux

Tmux completion source for nvim-cmp and nvim-compe

Primary LanguageLuaMIT LicenseMIT

cmp-tmux

Tmux completion source for nvim-cmp.

If you're looking for a nvim-compe version of this extension, use the following branch.

This extension pulls text from your current tmux session and provides it as a completion source.

By default this extension uses adjacent panes as sources. See configuration to enable all panes.

Requirements

Installation

Use your package manager of choice. For example packer.nvim:

use {
  'andersevenrud/cmp-tmux'
}

Setup

require('cmp').setup({
  sources = {
    { name = 'tmux' }
  }
})

Configuration

To configure this extension, add an options table (defaults shown):

require('cmp').setup({
  sources = {
    {
      name = 'tmux',
      option = {
        -- Source from all panes in session instead of adjacent panes
        all_panes = false,

        -- Completion popup label
        label = '[tmux]',

        -- Trigger character
        trigger_characters = { '.' },

        -- Specify trigger characters for filetype(s)
        -- { filetype = { '.' } }
        trigger_characters_ft = {},

        -- Keyword patch mattern
        keyword_pattern = [[\w\+]],

        -- Capture full pane history
        -- `false`: show completion suggestion from text in the visible pane (default)
        -- `true`: show completion suggestion from text starting from the beginning of the pane history.
        --         This works by passing `-S -` flag to `tmux capture-pane` command. See `man tmux` for details.
        capture_history = false,
      }
    }
  }
})

License

MIT