summaryrefslogtreecommitdiff
path: root/lua/core/lualine/utils.lua
blob: f2f295929d07ca4c90776abdcc1884d40224cc40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local M = {}

function M.validate_theme()
  local theme = lvim.builtin.lualine.options.theme

  local lualine_loader = require "lualine.utils.loader"
  local ok = pcall(lualine_loader.load_theme, theme)
  if not ok then
    lvim.builtin.lualine.options.theme = "auto"
  end
end

function M.env_cleanup(venv)
  if string.find(venv, "/") then
    local final_venv = venv
    for w in venv:gmatch "([^/]+)" do
      final_venv = w
    end
    venv = final_venv
  end
  return venv
end

return M