Skip to content

Commit e73bb48

Browse files
authored
feat(nvim): add heirline component.
1 parent 03a7020 commit e73bb48

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

doc/VectorCode.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ contains instructions to integrate VectorCode with the following plugins:
109109
- olimorris/codecompanion.nvim <https://github.com/olimorris/codecompanion.nvim>;
110110
- nvim-lualine/lualine.nvim <https://github.com/nvim-lualine/lualine.nvim>;
111111
- CopilotC-Nvim/CopilotChat.nvim <https://github.com/CopilotC-Nvim/CopilotChat.nvim>;
112-
- ravitemer/mcphub.nvim <https://github.com/ravitemer/mcphub.nvim>.
112+
- ravitemer/mcphub.nvim <https://github.com/ravitemer/mcphub.nvim>;
113+
- rebelot/heirline.nvim <https://github.com/rebelot/heirline.nvim>.
113114

114115

115116
CONFIGURATION *VectorCode-neovim-plugin-configuration*

docs/neovim.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ contains instructions to integrate VectorCode with the following plugins:
9494
- [olimorris/codecompanion.nvim](https://github.com/olimorris/codecompanion.nvim);
9595
- [nvim-lualine/lualine.nvim](https://github.com/nvim-lualine/lualine.nvim);
9696
- [CopilotC-Nvim/CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim);
97-
- [ravitemer/mcphub.nvim](https://github.com/ravitemer/mcphub.nvim).
97+
- [ravitemer/mcphub.nvim](https://github.com/ravitemer/mcphub.nvim);
98+
- [rebelot/heirline.nvim](https://github.com/rebelot/heirline.nvim).
9899

99100
## Configuration
100101

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---@class VectorCode.Heirline.Opts: VectorCode.Lualine.Opts
2+
--- Other heirline component fields (like `hl`, `on_click`, `update`, etc.)
3+
---@field component_opts table
4+
5+
---@type VectorCode.Heirline.Opts
6+
local default_opts = { show_job_count = false, component_opts = {} }
7+
8+
---@param opts VectorCode.Heirline.Opts?
9+
return function(opts)
10+
opts = vim.tbl_deep_extend("force", default_opts, opts or {}) --[[@as VectorCode.Heirline.Opts]]
11+
local lualine_comp = require("vectorcode.integrations").lualine(opts)
12+
local heirline_component = {
13+
provider = function(_)
14+
return lualine_comp[1]()
15+
end,
16+
condition = function(_)
17+
return lualine_comp.cond()
18+
end,
19+
}
20+
21+
return vim.tbl_deep_extend("force", heirline_component, opts.component_opts)
22+
end

lua/vectorcode/integrations/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ return {
22
codecompanion = require("vectorcode.integrations.codecompanion"),
33
copilotchat = require("vectorcode.integrations.copilotchat"),
44
lualine = require("vectorcode.integrations.lualine"),
5+
heirline = require("vectorcode.integrations.heirline"),
56
}

lua/vectorcode/integrations/lualine.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
local vc_config = require("vectorcode.config")
22

3-
---@param opts {show_job_count: boolean}?
3+
---@class VectorCode.Lualine.Opts
4+
---Whether to show the number of running async jobs.
5+
---@field show_job_count boolean
6+
7+
---@param opts VectorCode.Lualine.Opts?
48
return function(opts)
5-
opts = vim.tbl_deep_extend("force", { show_job_count = false }, opts or {})
9+
opts = vim.tbl_deep_extend("force", { show_job_count = false }, opts or {}) --[[@as VectorCode.Lualine.Opts]]
610
local cacher = vc_config.get_cacher_backend()
711
return {
812
function()

0 commit comments

Comments
 (0)