mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 10:44:34 +02:00
plugins/cmp-git: move to by-name
This commit is contained in:
parent
a61193abcc
commit
520c2868eb
6 changed files with 300 additions and 304 deletions
66
plugins/by-name/cmp-git/default.nix
Normal file
66
plugins/by-name/cmp-git/default.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "cmp-git";
|
||||
moduleName = "cmp_git";
|
||||
|
||||
imports = [
|
||||
{ cmpSourcePlugins.git = "cmp-git"; }
|
||||
];
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = import ./settings-options.nix { inherit lib; };
|
||||
|
||||
settingsExample = {
|
||||
remotes = [
|
||||
"upstream"
|
||||
"origin"
|
||||
"foo"
|
||||
];
|
||||
github.issues = {
|
||||
filter = "all";
|
||||
limit = 250;
|
||||
state = "all";
|
||||
format = ''
|
||||
function(_, issue)
|
||||
local icon = ({
|
||||
open = '',
|
||||
closed = '',
|
||||
})[string.lower(issue.state)]
|
||||
return string.format('%s #%d: %s', icon, issue.number, issue.title)
|
||||
end
|
||||
'';
|
||||
sort_by = ''
|
||||
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
|
||||
'';
|
||||
};
|
||||
trigger_actions = [
|
||||
{
|
||||
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 = "github_issues";
|
||||
trigger_character = "#";
|
||||
action = ''
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_issues(callback, git_info, trigger_char)
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue