From 73e4047c8645dd5fb37f86b650176f275a9cdb4b Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sat, 8 Oct 2022 14:57:06 +0200 Subject: [PATCH] [neovim] Add venv to lualine --- .config/nvim/lua/user/lualine.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/user/lualine.lua b/.config/nvim/lua/user/lualine.lua index a388b8e..83c8f2b 100644 --- a/.config/nvim/lua/user/lualine.lua +++ b/.config/nvim/lua/user/lualine.lua @@ -44,6 +44,15 @@ local spaces = function() return title .. vim.api.nvim_buf_get_option(0, "shiftwidth") end +local venv = function() + local venv = os.getenv("VIRTUAL_ENV") + if venv then + return string.format("  %s", string.match(venv, "[^/]+$")) + end + + return "" +end + local gitblame_status_ok, gitblame = pcall(require, "gitblame") if not gitblame_status_ok then return @@ -66,7 +75,7 @@ lualine.setup({ sections = { lualine_a = { "mode" }, lualine_b = { "branch" }, - lualine_c = { diagnostics, { "filename", path = 3 } }, + lualine_c = { diagnostics, venv, { "filename", path = 3 } }, lualine_x = { { gitblame.get_current_blame_text, cond = gitblame.is_blame_text_available }, diff,