summaryrefslogtreecommitdiff
path: root/lua/plugins/extra/feline.lua
blob: 037db34beedf4f4fa5b4800b87bb8b232e8a878f (plain) (blame)
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
return {
	{
		"feline-nvim/feline.nvim",
		dependencies = { "nvim-navic", "catppuccin", "nvim-tree/nvim-web-devicons" },
		config = function()
			local ctp_feline = require("catppuccin.groups.integrations.feline")
      ctp_feline.setup({
        assets = {
          left_separator = "",
          right_separator = "",
        },
      })

			local catpuccin_components = ctp_feline.get()
			require("feline").setup({ components = catpuccin_components })

			local catpuccin_winbar_components = { active = { {}, {}, {} }, inactive = {} }
			--catpuccin_winbar_components.inactive = catpuccin_components.inactive

			-- Removes the mode_icon and its left padding
			--table.remove(catpuccin_components.active[1], 2)
			--table.remove(catpuccin_components.active[1], 1)
			--local catpuccin_winbar_components = catpuccin_components

			--local yaml_schema_component = {
			--provider = function()
			--local schema = require("yaml-companion").get_buf_schema(0)
			--return schema.result[1].name
			--end,
			--enabled = function()
			--local enabled = catpuccin_components.active[3][1].enabled
			--if vim.bo.filetype == "yaml" and enabled then
			--return true
			--end
			--end,
			--hl = catpuccin_components.active[3][1].hl,
			--left_sep = catpuccin_components.active[3][1].left_sep,
			--right_sep = catpuccin_components.active[3][1].right_sep,
			--}

			local navic_component = {
				provider = function()
					local location = require("nvim-navic").get_location()
					if location == "" then
						return location
					end
					return "> " .. require("nvim-navic").get_location()
				end,
				enabled = function()
					local ok, navic = pcall(require, "nvim-navic")
					if ok then
						return navic.is_available()
					end
				end,
				hl = {
					bg = require("catppuccin.palettes").get_palette().base,
					fg = catpuccin_components.active[3][1].hl.fg,
				},
			}

			--table.insert(catpuccin_components.active[3], 1, yaml_schema_component)
			-- Overwrite the useless LSP component
			--catpuccin_components.active[3][2] = yaml_schema_component

			-- this is a hack to properly align the next component
			catpuccin_winbar_components.active[1][1] = {
				provider = function()
					return "    "
				end,
				hl = {
					bg = require("catppuccin.palettes").get_palette().base,
					fg = require("catppuccin.palettes").get_palette().base,
				},
			}

			catpuccin_winbar_components.active[1][2] = navic_component
			catpuccin_winbar_components.inactive = catpuccin_winbar_components.active

			require("feline").winbar.setup({
				components = catpuccin_winbar_components,
			})
		end,
	},
}