summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/lualine/utils.lua
blob: 48756a76fac994df3f31d10c5d0ee515867dbb5d (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
25
26
27
local M = {}

function M.validate_theme()
  local theme = options.builtin.lualine.options.theme
  if type(theme) == "table" then
    return
  end

  local lualine_loader = require "lualine.utils.loader"
  local ok = pcall(lualine_loader.load_theme, theme)
  if not ok then
    options.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