From b5b7ba0ebdee02374875b0071257c1324ef03771 Mon Sep 17 00:00:00 2001 From: thek4n Date: Mon, 15 Jan 2024 20:49:29 +0300 Subject: [PATCH] nvim lualine --- .../.config/nvim/lua/base/plugins/lualine.lua | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/home/user/.config/nvim/lua/base/plugins/lualine.lua b/home/user/.config/nvim/lua/base/plugins/lualine.lua index ddd3987..083986a 100644 --- a/home/user/.config/nvim/lua/base/plugins/lualine.lua +++ b/home/user/.config/nvim/lua/base/plugins/lualine.lua @@ -1,7 +1,41 @@ + +function get_formatted_cwd() + return vim.fn.getcwd():gsub(os.getenv("HOME"), "~") +end + +local function get_virtual_env() + return vim.fs.basename(os.getenv("VIRTUAL_ENV")) +end + +function get_formatted_virtual_env() + if vim.bo.filetype == 'python' then + return "<" .. get_virtual_env() .. ">" + end + return "" +end + +function detect_indent_type() + local shiftwidth = vim.bo.shiftwidth + if vim.bo.expandtab then + return shiftwidth .. " spaces" + else + return shiftwidth .. " tab" + end +end + return { 'nvim-lualine/lualine.nvim', config = function() - require("lualine").setup() + require("lualine").setup({ + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'get_formatted_cwd()'}, + lualine_x = {'get_formatted_virtual_env()', 'detect_indent_type()', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'}, + }, + }) end, dependencies = { 'kyazdani42/nvim-web-devicons' } }