summaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config/nvim/lua/tobyvin/plugins/lualine.lua
blob: 2b326f24513f0a610e7befff5828bb2b2c6f9736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
local M = {
	"nvim-lualine/lualine.nvim",
	cond = not vim.g.started_by_firenvim,
	event = "VeryLazy",
	dependencies = {
		"kyazdani42/nvim-web-devicons",
	},
}

function M.config()
	local lualine = require("lualine")

	local diagnostic = require("tobyvin.utils.diagnostic")

	lualine.setup({
		options = {
			component_separators = "",
			section_separators = "",
			ignore_focus = {
				"TelescopePrompt",
				"TelescopeResults",
			},
		},

		sections = {
			lualine_a = {
				{
					"mode",
					fmt = function(str)
						return str:sub(1, 1)
					end,
				},
			},
			lualine_b = {
				"branch",
				{
					"diff",
					source = function()
						local gitsigns = vim.b["gitsigns_status_dict"]
						if gitsigns then
							return {
								added = gitsigns.added,
								modified = gitsigns.changed,
								removed = gitsigns.removed,
							}
						end
					end,
					padding = { left = 0, right = 1 },
				},
			},
			lualine_c = {
				{
					"diagnostics",
					source = { diagnostic.count },
					symbols = {
						error = diagnostic.signs.error.text,
						warn = diagnostic.signs.warn.text,
						info = diagnostic.signs.info.text,
						hint = diagnostic.signs.hint.text,
					},

					diagnostics_color = {
						error = diagnostic.signs.error.hl,
						warn = diagnostic.signs.warn.hl,
						info = diagnostic.signs.info.hl,
						hint = diagnostic.signs.hint.hl,
					},
					update_in_insert = true,
				},
			},
			lualine_x = {
				"encoding",
				"fileformat",
				"filetype",
			},
		},

		inactive_sections = {
			lualine_c = {
				{
					"filename",
					path = 1,
				},
			},
			lualine_x = {
				"filetype",
				"location",
			},
		},
		tabline = {
			lualine_b = {
				function()
					return vim.fn.fnamemodify(vim.fn.getcwd(), ":~")
				end,
			},
			lualine_c = {
				{
					"filename",
					path = 1,
					shorten = true,
					file_status = false,
				},
			},
			lualine_y = {
				"tabs",
			},
		},

		extensions = {
			"fzf",
			"man",
			"nvim-dap-ui",
			"symbols-outline",
			"quickfix",
			"toggleterm",
		},
	})
end

return M