Unglobal the command completion function

This commit is contained in:
Lewis Russell 2021-04-16 17:03:55 +00:00
parent ef9da62883
commit 8b2b54de22
2 changed files with 8 additions and 4 deletions

6
lua/gitsigns.lua generated
View File

@ -709,7 +709,7 @@ local function add_debug_functions()
end
function gitsigns_complete(arglead, line)
local function _complete(arglead, line)
local n = #vim.split(line, '%s+')
local matches = {}
@ -729,7 +729,7 @@ local function setup_command()
vim.cmd(table.concat({
'command!',
'-nargs=+',
'-complete=customlist,v:lua.gitsigns_complete',
'-complete=customlist,v:lua.package.loaded.gitsigns._complete',
'Gitsigns',
'lua require("gitsigns")._run_func(<f-args>)',
}, ' '))
@ -945,6 +945,8 @@ M = {
toggle_linehl = toggle_linehl,
toggle_numhl = toggle_numhl,
_complete = _complete,
_current_line_blame = _current_line_blame,
_current_line_blame_reset = _current_line_blame_reset,
toggle_current_line_blame = toggle_current_line_blame,

View File

@ -709,7 +709,7 @@ local function add_debug_functions()
end
-- Needs to be global so can be accessed from v:lua
function gitsigns_complete(arglead: string, line: string): {string}
local function _complete(arglead: string, line: string): {string}
local n: integer = #vim.split(line, '%s+')
local matches: {string} = {}
@ -729,7 +729,7 @@ local function setup_command()
vim.cmd(table.concat({
'command!',
'-nargs=+',
'-complete=customlist,v:lua.gitsigns_complete',
'-complete=customlist,v:lua.package.loaded.gitsigns._complete',
'Gitsigns',
'lua require("gitsigns")._run_func(<f-args>)'
}, ' '))
@ -945,6 +945,8 @@ M = {
toggle_linehl = toggle_linehl,
toggle_numhl = toggle_numhl,
_complete = _complete,
_current_line_blame = _current_line_blame,
_current_line_blame_reset = _current_line_blame_reset,
toggle_current_line_blame = toggle_current_line_blame,