summaryrefslogtreecommitdiff
path: root/lua/lv-galaxyline/init.lua
diff options
context:
space:
mode:
authorchristianchiarulli <[email protected]>2021-07-07 21:57:36 -0400
committerchristianchiarulli <[email protected]>2021-07-07 21:57:36 -0400
commit23c7fab3b49560915f0fa6bdf07b399b6d9b75d9 (patch)
treeba23fc11fcebbca91c4c49caef4aeb0e40500678 /lua/lv-galaxyline/init.lua
parenta247d69c82109230656c6eb10a7824794ee5e911 (diff)
more lazy load be careful
Diffstat (limited to 'lua/lv-galaxyline/init.lua')
-rw-r--r--lua/lv-galaxyline/init.lua50
1 files changed, 27 insertions, 23 deletions
diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua
index 6bcf08f5..c7a8fa55 100644
--- a/lua/lv-galaxyline/init.lua
+++ b/lua/lv-galaxyline/init.lua
@@ -127,44 +127,48 @@ table.insert(gls.left, {
})
-- get output from shell command
function os.capture(cmd, raw)
- local f = assert(io.popen(cmd, 'r'))
- local s = assert(f:read('*a'))
+ local f = assert(io.popen(cmd, "r"))
+ local s = assert(f:read "*a")
f:close()
- if raw then return s end
- s = string.gsub(s, '^%s+', '')
- s = string.gsub(s, '%s+$', '')
- s = string.gsub(s, '[\n\r]+', ' ')
+ if raw then
+ return s
+ end
+ s = string.gsub(s, "^%s+", "")
+ s = string.gsub(s, "%s+$", "")
+ s = string.gsub(s, "[\n\r]+", " ")
return s
end
-- cleanup virtual env
-function env_cleanup(venv)
- if string.find(venv, "/") then
- final_venv = venv
- for w in venv:gmatch("([^/]+)") do final_venv=w end
- venv = final_venv
+local function env_cleanup(venv)
+ if string.find(venv, "/") then
+ local final_venv = venv
+ for w in venv:gmatch "([^/]+)" do
+ final_venv = w
end
- return venv
+ venv = final_venv
+ end
+ return venv
end
-local PythonEnv = function ()
- if vim.bo.filetype == 'python' then
- venv = os.getenv('CONDA_DEFAULT_ENV')
+local PythonEnv = function()
+ if vim.bo.filetype == "python" then
+ local venv = os.getenv "CONDA_DEFAULT_ENV"
if venv ~= nil then
- return "🅒 " .. env_cleanup(venv)
+ return "🅒 (" .. env_cleanup(venv) .. ")"
end
- venv = os.getenv('VIRTUAL_ENV')
+ venv = os.getenv "VIRTUAL_ENV"
if venv ~= nil then
- return "🐍 " .. env_cleanup(venv)
+ return "  (" .. env_cleanup(venv) .. ")"
end
- return ''
+ return ""
end
- return ''
+ return ""
end
table.insert(gls.left, {
VirtualEnv = {
provider = PythonEnv,
- highlight = {colors.green, colors.bg},
- event = 'BufEnter'
- }
+ highlight = "StatusLineTreeSitter",
+ event = "BufEnter",
+ },
})
table.insert(gls.right, {