mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-22 00:49:01 +02:00
add: custom lualine theme
This commit is contained in:
parent
3c07e3d75e
commit
c33971749e
5 changed files with 323 additions and 248 deletions
|
@ -26,6 +26,10 @@ vim.g.pcode_colorscheme = "dracula"
|
|||
-- nightfox
|
||||
-- 0 =off 1= on
|
||||
vim.g.pcode_transparent_mode = 0
|
||||
-- rounded
|
||||
-- square
|
||||
-- default
|
||||
vim.g.pcode_lualinetheme = "rounded"
|
||||
-- 0 disable progress
|
||||
-- 1 lualine lsp progress
|
||||
-- 2 fidget progress
|
||||
|
|
|
@ -18,7 +18,7 @@ return {
|
|||
end
|
||||
|
||||
local function diagnostics_indicator(num, _, diagnostics, _)
|
||||
local result = {}
|
||||
local result
|
||||
local symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warning = icons.diagnostics.Warning,
|
||||
|
|
|
@ -4,18 +4,6 @@ return {
|
|||
event = { "InsertEnter", "BufRead", "BufNewFile" },
|
||||
config = function()
|
||||
local component = require "user.utils.lualine_component"
|
||||
local treesitter = component.treesitter
|
||||
local lsp_info = component.lsp_info
|
||||
local diagnostics = component.diagnostics
|
||||
local diff = component.diff
|
||||
local spaces = component.spaces
|
||||
local mode = component.mode
|
||||
local get_branch = component.get_branch
|
||||
local lsp_progress = {}
|
||||
local data_ok, lspprogress = pcall(require, "lsp-progress")
|
||||
if data_ok then
|
||||
lsp_progress = lspprogress.progress
|
||||
end
|
||||
local colors = component.colors
|
||||
|
||||
-- check config for theme
|
||||
|
@ -55,50 +43,22 @@ return {
|
|||
bubbles_theme = vim.fn.fnamemodify("auto", ":t")
|
||||
end
|
||||
|
||||
local gettheme = require "user.utils.lualine_template"
|
||||
local theme_option = vim.g.pcode_lualinetheme or "rounded"
|
||||
local theme = gettheme.rounded(bubbles_theme)
|
||||
if theme_option == "rounded" then
|
||||
theme = gettheme.rounded(bubbles_theme)
|
||||
elseif theme_option == "square" then
|
||||
theme = gettheme.square(bubbles_theme)
|
||||
elseif theme_option == "default" then
|
||||
theme = {}
|
||||
end
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
theme = bubbles_theme,
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
"TelescopePrompt",
|
||||
"packer",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"DressingInput",
|
||||
"toggleterm",
|
||||
"lazy",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"startuptime",
|
||||
"crunner",
|
||||
},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
mode,
|
||||
},
|
||||
lualine_b = { get_branch },
|
||||
lualine_c = { diff, lsp_info, lsp_progress },
|
||||
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{ "location", separator = { right = " " }, padding = 1 },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = { "filename" },
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
options = theme.options,
|
||||
sections = theme.sections,
|
||||
inactive_sections = theme.inactive_sections,
|
||||
tabline = theme.tabline,
|
||||
extensions = theme.extensions,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
local hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 75
|
||||
end
|
||||
local icons = vim.g.pcode_icons
|
||||
local formatter = require("user.utils.formatter")
|
||||
local linter = require("user.utils.linter")
|
||||
local icons = require "user.icons"
|
||||
local formatter = require "user.utils.formatter"
|
||||
local linter = require "user.utils.linter"
|
||||
|
||||
local getLeftSubstring = function(word, length)
|
||||
if #word > length then
|
||||
|
@ -48,7 +48,7 @@ return {
|
|||
local buf_ft = vim.bo.filetype
|
||||
-- start register
|
||||
local buf_clients = {}
|
||||
buf_clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
buf_clients = vim.lsp.get_clients { bufnr = 0 }
|
||||
local buf_client_names = {}
|
||||
if next(buf_clients) == nil then
|
||||
-- TODO: clean up this if statement
|
||||
|
@ -121,7 +121,7 @@ return {
|
|||
},
|
||||
|
||||
-- nvim mode info
|
||||
mode = {
|
||||
mode_rounded = {
|
||||
"mode",
|
||||
padding = 1,
|
||||
separator = { left = " " },
|
||||
|
@ -130,6 +130,15 @@ return {
|
|||
end,
|
||||
},
|
||||
|
||||
mode_square = {
|
||||
"mode",
|
||||
padding = 1,
|
||||
separator = { left = "" },
|
||||
fmt = function(str)
|
||||
return icons.ui.Neovim .. " " .. str
|
||||
end,
|
||||
},
|
||||
|
||||
-- git branch info
|
||||
get_branch = function()
|
||||
if vim.b.gitsigns_head ~= nil then
|
||||
|
|
102
lua/user/utils/lualine_template.lua
Normal file
102
lua/user/utils/lualine_template.lua
Normal file
|
@ -0,0 +1,102 @@
|
|||
local M = {}
|
||||
|
||||
local component = require "user.utils.lualine_component"
|
||||
local treesitter = component.treesitter
|
||||
local lsp_info = component.lsp_info
|
||||
local diagnostics = component.diagnostics
|
||||
local diff = component.diff
|
||||
local spaces = component.spaces
|
||||
local get_branch = component.get_branch
|
||||
local lsp_progress = {}
|
||||
local data_ok, lspprogress = pcall(require, "lsp-progress")
|
||||
if data_ok then
|
||||
lsp_progress = lspprogress.progress
|
||||
end
|
||||
|
||||
M.filetype = {
|
||||
"TelescopePrompt",
|
||||
"packer",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"DressingInput",
|
||||
"toggleterm",
|
||||
"lazy",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"startuptime",
|
||||
"crunner",
|
||||
}
|
||||
|
||||
M.rounded = function(colorscheme)
|
||||
local mode = component.mode_rounded
|
||||
return {
|
||||
options = {
|
||||
theme = colorscheme,
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = M.filetype,
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
mode,
|
||||
},
|
||||
lualine_b = { get_branch },
|
||||
lualine_c = { diff, lsp_info, lsp_progress },
|
||||
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{ "location", separator = { right = " " }, padding = 1 },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = { "filename" },
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
}
|
||||
end
|
||||
|
||||
M.square = function(colorscheme)
|
||||
local mode = component.mode_square
|
||||
return {
|
||||
options = {
|
||||
theme = colorscheme,
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = M.filetype,
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
mode,
|
||||
},
|
||||
lualine_b = { get_branch },
|
||||
lualine_c = { diff, lsp_info, lsp_progress },
|
||||
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{ "location", separator = { right = "" }, padding = 1 },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = { "filename" },
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue