Moved filename from lualine to incline

This commit is contained in:
2024-09-24 22:35:12 +02:00
parent 540e7f811d
commit d61284f62f
2 changed files with 12 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ return {
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
local incline = require("incline") local incline = require("incline")
local devicons = require("nvim-web-devicons")
incline.setup({ incline.setup({
highlight = { highlight = {
@@ -19,11 +18,14 @@ return {
}, },
}, },
render = function(props) render = function(props)
local devicons = require("nvim-web-devicons")
local helpers = require("incline.helpers")
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t") local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then if filename == "" then
filename = "[No Name]" filename = "[No Name]"
end end
local ft_icon, ft_color = devicons.get_icon_color(filename) local ft_icon, ft_color = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified
local function get_git_diff() local function get_git_diff()
local icons = { removed = "", changed = "", added = "" } local icons = { removed = "", changed = "", added = "" }
@@ -66,6 +68,9 @@ return {
return { return {
{ get_diagnostic_label() }, { get_diagnostic_label() },
{ get_git_diff() }, { get_git_diff() },
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
" ",
{ filename, gui = modified and "bold,italic" or "bold" },
} }
end, end,
}) })

View File

@@ -86,10 +86,10 @@ return {
return { bg = mode_color[vim.fn.mode()], fg = colors.bg } return { bg = mode_color[vim.fn.mode()], fg = colors.bg }
end, end,
} }
local filename = { -- local filename = {
"filename", -- "filename",
color = { fg = colors.magenta, bg = "None", gui = "bold" }, -- color = { fg = colors.magenta, bg = "None", gui = "bold" },
} -- }
local branch = { local branch = {
"branch", "branch",
icon = "", icon = "",
@@ -283,7 +283,8 @@ return {
}, },
sections = { sections = {
lualine_a = { mode }, lualine_a = { mode },
lualine_b = { filename, branch }, -- lualine_b = { filename, branch },
lualine_b = { branch },
-- lualine_c = { diagnostics, sep, harpoon }, -- lualine_c = { diagnostics, sep, harpoon },
lualine_c = { sep, harpoon }, lualine_c = { sep, harpoon },
-- lualine_x = { copilot, diff, fileformat, lazy, mason }, -- lualine_x = { copilot, diff, fileformat, lazy, mason },