diff options
Diffstat (limited to '.config/nvim/plugin/50-statusline.lua')
| -rw-r--r-- | .config/nvim/plugin/50-statusline.lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.config/nvim/plugin/50-statusline.lua b/.config/nvim/plugin/50-statusline.lua new file mode 100644 index 0000000..092f08f --- /dev/null +++ b/.config/nvim/plugin/50-statusline.lua @@ -0,0 +1,48 @@ +-- +-- Status line configuration plugin +-- +-- I use lualine, see https://github.com/nvim-lualine/lualine.nvim#configuring-lualine-in-initvim + +vim.pack.add({ + "https://github.com/nvim-tree/nvim-web-devicons", + "https://github.com/nvim-lualine/lualine.nvim", +}) +local lualine = require("lualine") + +local function spell_status() + if vim.o.spelllang == "fr" then + return "+S(fr)" + elseif vim.o.spelllang == "en_us" then + return "+S(en)" + elseif vim.o.spelllang == "en_us,fr" then + return "+S(en,fr)" + end +end + +local function statuses() + return (vim.b.autoformat and "+F" or "") .. (vim.o.spell and spell_status() or "") +end + +local lualine_sections = { + lualine_c = { statuses, "filename" }, + lualine_x = { "encoding", "fileformat", "filetype", "lsp_status" }, +} + +-- Adjust colors when the theme (light/dark) changes +vim.api.nvim_create_autocmd("OptionSet", { + desc = "Adjust color scheme", + pattern = "background", + group = vim.g.dotfiles.augroup, + callback = function() + lualine.setup({ + options = { theme = vim.o.background == "light" and "solarized_light" or "solarized_dark" }, + sections = lualine_sections, + }) + end, +}) + +lualine.setup({ options = { theme = "solarized_light" }, sections = lualine_sections }) + +vim.api.nvim_create_user_command("LualineConfig", function() + vim.notify(vim.inspect(lualine.get_config())) +end, { desc = "Show lualine configuration" }) |
