-
Notifications
You must be signed in to change notification settings - Fork 21
Status line
Jakson Alves de Aquino edited this page Feb 22, 2024
·
1 revision
It is possible to add the status of R.nvim to Neovim status line. The example below is for lualine.nvim and will display the characters "-", "S", or "R" with different colors:
{
"nvim-lualine/lualine.nvim",
config = function()
local rstt =
{
{ "-", "#aaaaaa" }, -- 1: ftplugin/* sourced, but nclientserver not started yet.
{ "S", "#757755" }, -- 2: nclientserver started, but not ready yet.
{ "S", "#117711" }, -- 3: nclientserver is ready.
{ "S", "#ff8833" }, -- 4: nclientserver started the TCP server
{ "S", "#3388ff" }, -- 5: TCP server is ready
{ "R", "#ff8833" }, -- 6: R started, but nvimcom was not loaded yet.
{ "R", "#3388ff" }, -- 7: nvimcom is loaded.
}
local rstatus = function ()
if not vim.g.R_Nvim_status or vim.g.R_Nvim_status == 0 then
-- No R file type (R, Quarto, Rmd, Rhelp) opened yet
return ""
end
return rstt[vim.g.R_Nvim_status][1]
end
local rsttcolor = function ()
if not vim.g.R_Nvim_status or vim.g.R_Nvim_status == 0 then
-- No R file type (R, Quarto, Rmd, Rhelp) opened yet
return { fg = "#000000" }
end
return { fg = rstt[vim.g.R_Nvim_status][2] }
end
require("lualine").setup({
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { {rstatus, color = rsttcolor }},
lualine_z = { "progress", "location" },
},
})
end,
},