181 lines
5.8 KiB
Lua
181 lines
5.8 KiB
Lua
return {
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
optional = true,
|
|
event = "VeryLazy",
|
|
opts = function()
|
|
local icons = require("lazyvim.config").icons
|
|
local Util = require("lazyvim.util")
|
|
|
|
return {
|
|
options = {
|
|
theme = "catppuccin",
|
|
component_separators = { left = "", right = "" },
|
|
section_separators = { left = "", right = "" },
|
|
globalstatus = true,
|
|
disabled_filetypes = { statusline = { "dashboard", "alpha" } },
|
|
},
|
|
sections = {
|
|
lualine_a = { "mode" },
|
|
lualine_b = { "branch" },
|
|
lualine_c = {
|
|
{
|
|
"diagnostics",
|
|
symbols = {
|
|
error = icons.diagnostics.Error,
|
|
warn = icons.diagnostics.Warn,
|
|
info = icons.diagnostics.Info,
|
|
hint = icons.diagnostics.Hint,
|
|
},
|
|
},
|
|
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
|
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
|
|
-- stylua: ignore
|
|
{
|
|
function() return require("nvim-navic").get_location() end,
|
|
cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end,
|
|
},
|
|
},
|
|
lualine_x = {
|
|
-- stylua: ignore
|
|
{
|
|
function() return require("noice").api.status.command.get() end,
|
|
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
|
color = Util.ui.fg("Statement"),
|
|
},
|
|
-- stylua: ignore
|
|
{
|
|
function() return require("noice").api.status.mode.get() end,
|
|
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
|
color = Util.ui.fg("Constant"),
|
|
},
|
|
-- stylua: ignore
|
|
{
|
|
function() return " " .. require("dap").status() end,
|
|
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
|
|
color = Util.ui.fg("Debug"),
|
|
},
|
|
{
|
|
require("lazy.status").updates,
|
|
cond = require("lazy.status").has_updates,
|
|
color = Util.ui.fg("Special"),
|
|
},
|
|
{
|
|
"diff",
|
|
symbols = {
|
|
added = icons.git.added,
|
|
modified = icons.git.modified,
|
|
removed = icons.git.removed,
|
|
},
|
|
},
|
|
},
|
|
lualine_y = {
|
|
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
|
{ "location", padding = { left = 0, right = 1 } },
|
|
},
|
|
lualine_z = {
|
|
function()
|
|
return " " .. os.date("%R")
|
|
end,
|
|
},
|
|
},
|
|
extensions = { "neo-tree", "lazy" },
|
|
}
|
|
end,
|
|
},
|
|
|
|
-- custom config which piggybacks on the copilot extras in lazy.lua.
|
|
{
|
|
"zbirenbaum/copilot.lua",
|
|
enabled = false,
|
|
cmd = "Copilot",
|
|
build = ":Copilot auth",
|
|
event = "InsertEnter",
|
|
config = function()
|
|
require("copilot").setup({
|
|
panel = {
|
|
enabled = true,
|
|
auto_refresh = true,
|
|
},
|
|
suggestion = {
|
|
enabled = true,
|
|
auto_trigger = true,
|
|
accept = false, -- disable built-in keymapping
|
|
},
|
|
})
|
|
|
|
-- hide copilot suggestions when cmp menu is open
|
|
-- to prevent odd behavior/garbled up suggestions
|
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
|
if cmp_status_ok then
|
|
cmp.event:on("menu_opened", function()
|
|
vim.b.copilot_suggestion_hidden = true
|
|
end)
|
|
|
|
cmp.event:on("menu_closed", function()
|
|
vim.b.copilot_suggestion_hidden = false
|
|
end)
|
|
end
|
|
end,
|
|
},
|
|
{
|
|
{
|
|
"jellydn/CopilotChat.nvim",
|
|
enabled = false,
|
|
dependencies = { "zbirenbaum/copilot.lua" }, -- Or { "github/copilot.vim" }
|
|
opts = {
|
|
mode = "split", -- newbuffer or split , default: newbuffer
|
|
debug = false, -- Enable or disable debug mode, the log file will be in ~/.local/state/nvim/CopilotChat.nvim.log
|
|
},
|
|
build = function()
|
|
vim.defer_fn(function()
|
|
vim.cmd("UpdateRemotePlugins")
|
|
vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
|
|
end, 3000)
|
|
end,
|
|
event = "VeryLazy",
|
|
keys = {
|
|
{ "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
|
|
{ "<leader>cct", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" },
|
|
},
|
|
},
|
|
},
|
|
|
|
-- copilot status in lualine
|
|
-- this is taken from the copilot lazyvim extras at:
|
|
-- https://www.lazyvim.org/plugins/extras/coding.copilot
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
enabled = false,
|
|
optional = true,
|
|
event = "VeryLazy",
|
|
opts = function(_, opts)
|
|
local Util = require("lazyvim.util").ui
|
|
local colors = {
|
|
[""] = Util.fg("Special"),
|
|
["Normal"] = Util.fg("Special"),
|
|
["Warning"] = Util.fg("DiagnosticError"),
|
|
["InProgress"] = Util.fg("DiagnosticWarn"),
|
|
}
|
|
table.insert(opts.sections.lualine_x, 2, {
|
|
function()
|
|
local icon = require("lazyvim.config").icons.kinds.Copilot
|
|
local status = require("copilot.api").status.data
|
|
return icon .. (status.message or "")
|
|
end,
|
|
cond = function()
|
|
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
|
|
return ok and #clients > 0
|
|
end,
|
|
color = function()
|
|
if not package.loaded["copilot"] then
|
|
return
|
|
end
|
|
local status = require("copilot.api").status.data
|
|
return colors[status.status] or colors[""]
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
}
|