fix(hint): correct variable and setup on init (#82)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
1aad15d33d
commit
7e6705c0b1
@ -138,10 +138,6 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
|||||||
---@type string | fun(): any
|
---@type string | fun(): any
|
||||||
list_opener = "copen",
|
list_opener = "copen",
|
||||||
},
|
},
|
||||||
--- @class AvanteHintsConfig
|
|
||||||
hints = {
|
|
||||||
enbaled = true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ M.defaults = {
|
|||||||
},
|
},
|
||||||
--- @class AvanteHintsConfig
|
--- @class AvanteHintsConfig
|
||||||
hints = {
|
hints = {
|
||||||
enbaled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ H.autocmds = function()
|
|||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
local tab = tonumber(ev.file)
|
local tab = tonumber(ev.file)
|
||||||
M._init(tab or api.nvim_get_current_tabpage())
|
M._init(tab or api.nvim_get_current_tabpage())
|
||||||
if not M.current.selection.did_setup then
|
if Config.hints.enabled and not M.current.selection.did_setup then
|
||||||
M.current.selection:setup_autocmds()
|
M.current.selection:setup_autocmds()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -106,7 +106,9 @@ H.autocmds = function()
|
|||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
M._init(api.nvim_get_current_tabpage())
|
M._init(api.nvim_get_current_tabpage())
|
||||||
|
if Config.hints.enabled then
|
||||||
M.current.selection:setup_autocmds()
|
M.current.selection:setup_autocmds()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- automatically setup Avante filetype to markdown
|
-- automatically setup Avante filetype to markdown
|
||||||
|
@ -62,9 +62,6 @@ end
|
|||||||
|
|
||||||
function Selection:setup_autocmds()
|
function Selection:setup_autocmds()
|
||||||
Selection.did_setup = true
|
Selection.did_setup = true
|
||||||
if Config.hints.enabled == false then
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
api.nvim_create_autocmd({ "ModeChanged" }, {
|
api.nvim_create_autocmd({ "ModeChanged" }, {
|
||||||
group = self.augroup,
|
group = self.augroup,
|
||||||
pattern = { "n:v", "n:V", "n:" }, -- Entering Visual mode from Normal mode
|
pattern = { "n:v", "n:V", "n:" }, -- Entering Visual mode from Normal mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user