Works in Neovim 0.9.5 if you have copilot enabled by default and toggle it with :Copilot disable/enable
.
Create a lualine component file {nvim-dir}/lua/lualine/components/copilot_status.lua
local M = require('lualine.component'):extend()
local highlight = require("lualine.highlight")
function M:init(options)
options.padding = 2
M.super.init(self, options)
self.highlights = {
enabled = highlight.create_component_highlight_group({ fg = "#50FA7B" }, "copilot_status_enabled", options),
disabled = highlight.create_component_highlight_group({ fg = "#FA5050" }, "copilot_status_disabled", options),
}
end
function M:update_status()
local copilot_enabled = (vim.g.copilot_enabled or 1) == 1
if copilot_enabled then
return highlight.component_format_highlight(self.highlights.enabled) .. '' -- nerdfont dea9
else
return highlight.component_format_highlight(self.highlights.disabled) .. '' -- nerdfont dea7
end
end
return M
Then add copilot_status
to the desired lualine section
require('lualine').setup({
sections = {
lualine_x = {
'copilot_status',
'encoding',
'fileformat',
'filetype'
},
},
})