nvim

neovim config
git clone _git@git.tontus.eu/nvim.git
Log | Files | Refs | README

lualine.lua (1436B)


      1 local lualine = require('lualine')
      2 
      3 local diagnostics = {
      4 	"diagnostics",
      5 	sources = { "nvim_diagnostic" },
      6 	sections = { "error", "warn" },
      7 	symbols = { error = " ", warn = " " },
      8 	colored = true,
      9 	update_in_insert = false,
     10 	always_visible = true,
     11 	cond = function()
     12 		return vim.bo.filetype ~= "markdown"
     13 	end,
     14 }
     15 
     16 local diff = {
     17 	"diff",
     18 	colored = true,
     19 	symbols = { added = " ", modified = " ", removed = " " },
     20 }
     21 
     22 local mode = {
     23 	"mode",
     24 	fmt = function(str)
     25 		return "-- " .. str .. " --"
     26 	end,
     27 }
     28 
     29 local branch = {
     30 	"branch",
     31 	icon = "",
     32 }
     33 
     34 local progress = function()
     35 	local current_line = vim.fn.line(".")
     36 	local total_lines = vim.fn.line("$")
     37 	local chars = { "", "", "" } --adding more chars will still work
     38 	local line_ratio = current_line / total_lines
     39 	local index = math.ceil(line_ratio * #chars)
     40 	return chars[index] .. " " .. math.floor(line_ratio * 100) .. "%%"
     41 end
     42 
     43 lualine.setup({
     44 options = {
     45 	icons_enabled = true,
     46 	theme = "auto", --auto allows for theme switching
     47 	component_separators = { left = "", right = "" },
     48 	section_separators = { left = "", right = "" },
     49 	disabled_filetypes = { "alpha", "dashboard" },
     50 	always_divide_middle = true,
     51 	},
     52 
     53 sections = {
     54 	lualine_a = { branch },
     55 	lualine_b = { mode },
     56 	lualine_c = { diagnostics },
     57 	lualine_x = { diff, "fileformat", "filetype" },
     58 	lualine_y = { "location" },
     59 	lualine_z = { progress },
     60 	},
     61 	extensions = { 'nvim-tree' },
     62 })