Skip to content

Commit

Permalink
feat: support GH command auto-completion with ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
wassimk committed Jun 11, 2024
1 parent 5d2fd53 commit bbf1bdb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/gh-navigator/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ function M.setup()
bang = false,
desc = 'GitHub Navigator',
complete = function(arg_lead, cmdline, _)
local subcmd_key, subcmd_arg_lead = cmdline:match('^GH[!]*%s(%S+)%s(.*)$')
local subcmd_key, subcmd_arg_lead = cmdline:match("^['<,'>]*GH[!]*%s(%S+)%s(.*)$")

if subcmd_key and subcmd_arg_lead and subcommand_tbl[subcmd_key] and subcommand_tbl[subcmd_key].complete then
return subcommand_tbl[subcmd_key].complete(subcmd_arg_lead)
end
if cmdline:match('^GH[!]*%s+%w*$') then

if cmdline:match("^['<,'>]*GH[!]*%s+%w*$") then
local subcommand_keys = vim.tbl_keys(subcommand_tbl)
return vim
.iter(subcommand_keys)
Expand Down

0 comments on commit bbf1bdb

Please sign in to comment.