mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-01 11:13:24 +00:00
fix: no command completions if query/line is an alias
basically, i have a `c` alias which is `git commit`, this would resolve to `git commit` literally to try and complete `commit`, which wouldnt match. this fixes that, and instead itll suggest commands that start with `c`. if there is a space after and completion is requested, itll use the alias properly
This commit is contained in:
parent
4e5f8b5c80
commit
2790982ad1
@ -6,8 +6,12 @@ function hilbish.completion.handler(line, pos)
|
||||
local ctx = line:gsub('^%s*(.-)$', '%1')
|
||||
if ctx:len() == 0 then return {}, '' end
|
||||
|
||||
ctx = hilbish.aliases.resolve(ctx)
|
||||
local res = hilbish.aliases.resolve(ctx)
|
||||
local resFields = string.split(res, ' ')
|
||||
local fields = string.split(ctx, ' ')
|
||||
if #fields > 1 and #resFields > 1 then
|
||||
fields = resFields
|
||||
end
|
||||
local query = fields[#fields]
|
||||
|
||||
if #fields == 1 then
|
||||
|
Loading…
x
Reference in New Issue
Block a user