diff options
Diffstat (limited to 'lua/lv-galaxyline/init.lua')
-rw-r--r-- | lua/lv-galaxyline/init.lua | 50 |
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, { |