plugins.cmp-git.settings

Options provided to the require('cmp_git').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  github = {
    issues = {
      filter = "all";
      filter_fn = {
        __raw = ''
          function(trigger_char, issue)
            return string.format('%s %s %s', trigger_char, issue.number, issue.title)
          end
        '';
      };
      format = {
        label = {
          __raw = ''
            function(_, issue)
              local icon = ({
                open = '',
                closed = '',
              })[string.lower(issue.state)]
              return string.format('%s #%d: %s', icon, issue.number, issue.title)
            end
          '';
        };
      };
      limit = 250;
      sort_by = {
        __raw = ''
          function(issue)
            local kind_rank = issue.pull_request and 1 or 0
            local state_rank = issue.state == 'open' and 0 or 1
            local age = os.difftime(os.time(), require('cmp_git.utils').parse_github_date(issue.updatedAt))
            return string.format('%d%d%010d', kind_rank, state_rank, age)
          end
        '';
      };
      state = "all";
    };
  };
  remotes = [
    "upstream"
    "origin"
    "foo"
  ];
  trigger_actions = [
    {
      action = ''
        function(sources, trigger_char, callback, params, git_info)
          return sources.git:get_commits(callback, params, trigger_char)
        end
      '';
      debug_name = "git_commits";
      trigger_character = ":";
    }
    {
      action = ''
        function(sources, trigger_char, callback, params, git_info)
          return sources.github:get_issues(callback, git_info, trigger_char)
        end
      '';
      debug_name = "github_issues";
      trigger_character = "#";
    }
  ];
}

Declared by:

plugins.cmp-git.settings.enableRemoteUrlRewrites

Whether to enable remote URL rewrites.

Plugin default: false

Type: null or boolean or raw lua code

Default: null

Declared by:

plugins.cmp-git.settings.filetypes

Filetypes for which to trigger.

Plugin default: ["gitcommit" "octo"]

Type: null or (list of (string or raw lua code))

Default: null

Declared by:

plugins.cmp-git.settings.remotes

List of git remotes.

Plugin default: ["upstream" "origin"]

Type: null or (list of (string or raw lua code))

Default: null

Declared by:

plugins.cmp-git.settings.trigger_actions

If you want specific behaviour for a trigger or new behaviour for a trigger, you need to add an entry in the trigger_actions list of the config. The two necessary fields are the trigger_character and the action.

Plugin default:

[
  {
    debug_name = "git_commits";
    trigger_character = ":";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
        return sources.git:get_commits(callback, params, trigger_char)
      end
    \'\';
  }
  {
    debug_name = "gitlab_issues";
    trigger_character = "#";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
          return sources.gitlab:get_issues(callback, git_info, trigger_char)
      end
    \'\';
  }
  {
    debug_name = "gitlab_mentions";
    trigger_character = "@";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
          return sources.gitlab:get_mentions(callback, git_info, trigger_char)
      end
    \'\';
  }
  {
    debug_name = "gitlab_mrs";
    trigger_character = "!";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
        return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
      end
    \'\';
  }
  {
    debug_name = "github_issues_and_pr";
    trigger_character = "#";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
        return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
      end
    \'\';
  }
  {
    debug_name = "github_mentions";
    trigger_character = "@";
    action = \'\'
      function(sources, trigger_char, callback, params, git_info)
        return sources.github:get_mentions(callback, git_info, trigger_char)
      end
    \'\';
  }
]

Type: null or (list of ((submodule) or raw lua code))

Default: null

Declared by: