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
|
-- nightfox
|
||||||
-- 0 =off 1= on
|
-- 0 =off 1= on
|
||||||
vim.g.pcode_transparent_mode = 0
|
vim.g.pcode_transparent_mode = 0
|
||||||
|
-- rounded
|
||||||
|
-- square
|
||||||
|
-- default
|
||||||
|
vim.g.pcode_lualinetheme = "rounded"
|
||||||
-- 0 disable progress
|
-- 0 disable progress
|
||||||
-- 1 lualine lsp progress
|
-- 1 lualine lsp progress
|
||||||
-- 2 fidget progress
|
-- 2 fidget progress
|
||||||
|
@ -38,8 +42,8 @@ vim.g.pcode_format_on_save = 1
|
||||||
-- untuk referesi support language kunjungi link dibawah
|
-- untuk referesi support language kunjungi link dibawah
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
vim.g.pcode_lsp_installer = {
|
vim.g.pcode_lsp_installer = {
|
||||||
-- "yamlls",
|
-- "yamlls",
|
||||||
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
||||||
}
|
}
|
||||||
|
|
||||||
-- use for lsp diagnostics virtual text
|
-- use for lsp diagnostics virtual text
|
||||||
|
@ -51,49 +55,49 @@ vim.g.pcode_lspghost_text = false
|
||||||
-- untuk referesi support language kunjungi link dibawah
|
-- untuk referesi support language kunjungi link dibawah
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
vim.g.pcode_mason_ensure_installed = { -- sebelumnya register_lsp
|
vim.g.pcode_mason_ensure_installed = { -- sebelumnya register_lsp
|
||||||
-- "yamlls",
|
-- "yamlls",
|
||||||
-- "intelephense",
|
-- "intelephense",
|
||||||
-- "marksman",
|
-- "marksman",
|
||||||
-- "csharp_ls",
|
-- "csharp_ls",
|
||||||
-- "clangd",
|
-- "clangd",
|
||||||
-- "dartls",
|
-- "dartls",
|
||||||
-- "kotlin_language_server",
|
-- "kotlin_language_server",
|
||||||
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
||||||
}
|
}
|
||||||
vim.g.pcode_unregister_lsp = {
|
vim.g.pcode_unregister_lsp = {
|
||||||
"jdtls", -- tambahkan di bawah ini
|
"jdtls", -- tambahkan di bawah ini
|
||||||
}
|
}
|
||||||
|
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
||||||
vim.g.pcode_null_ls_ensure_installed = {
|
vim.g.pcode_null_ls_ensure_installed = {
|
||||||
"stylua",
|
"stylua",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- dap instal hanya support linux dan mac
|
-- dap instal hanya support linux dan mac
|
||||||
-- https://github.com/jay-babu/mason-nvim-dap.nvim/blob/main/lua/mason-nvim-dap/mappings/source.lua
|
-- https://github.com/jay-babu/mason-nvim-dap.nvim/blob/main/lua/mason-nvim-dap/mappings/source.lua
|
||||||
-- atau gunakan :MasonInstall
|
-- atau gunakan :MasonInstall
|
||||||
vim.g.pcode_dap_ensure_installed = {
|
vim.g.pcode_dap_ensure_installed = {
|
||||||
-- "python",
|
-- "python",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- https://github.com/folke/which-key.nvim
|
-- https://github.com/folke/which-key.nvim
|
||||||
vim.g.pcode_whichkey = {
|
vim.g.pcode_whichkey = {
|
||||||
-- contoh penambahan
|
-- contoh penambahan
|
||||||
["k"] = {
|
["k"] = {
|
||||||
name = "Example",
|
name = "Example",
|
||||||
k = { '<cmd>lua print("Testing")<cr>', "Example" },
|
k = { '<cmd>lua print("Testing")<cr>', "Example" },
|
||||||
},
|
},
|
||||||
["r"] = {
|
["r"] = {
|
||||||
name = "Run",
|
name = "Run",
|
||||||
j = { "<cmd>Jaq float<CR>", "Run With Jaq" },
|
j = { "<cmd>Jaq float<CR>", "Run With Jaq" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- https://github.com/CRAG666/code_runner.nvim
|
-- https://github.com/CRAG666/code_runner.nvim
|
||||||
-- ready default java, python, typescript, javascript, rust, cpp, scss
|
-- ready default java, python, typescript, javascript, rust, cpp, scss
|
||||||
vim.g.pcode_coderunner = {
|
vim.g.pcode_coderunner = {
|
||||||
go = "go run $fileName",
|
go = "go run $fileName",
|
||||||
html = "live-server $dir/$fileName",
|
html = "live-server $dir/$fileName",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- config for optional cmp
|
-- config for optional cmp
|
||||||
|
|
|
@ -18,7 +18,7 @@ return {
|
||||||
end
|
end
|
||||||
|
|
||||||
local function diagnostics_indicator(num, _, diagnostics, _)
|
local function diagnostics_indicator(num, _, diagnostics, _)
|
||||||
local result = {}
|
local result
|
||||||
local symbols = {
|
local symbols = {
|
||||||
error = icons.diagnostics.Error,
|
error = icons.diagnostics.Error,
|
||||||
warning = icons.diagnostics.Warning,
|
warning = icons.diagnostics.Warning,
|
||||||
|
|
|
@ -4,18 +4,6 @@ return {
|
||||||
event = { "InsertEnter", "BufRead", "BufNewFile" },
|
event = { "InsertEnter", "BufRead", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local component = require "user.utils.lualine_component"
|
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
|
local colors = component.colors
|
||||||
|
|
||||||
-- check config for theme
|
-- check config for theme
|
||||||
|
@ -55,50 +43,22 @@ return {
|
||||||
bubbles_theme = vim.fn.fnamemodify("auto", ":t")
|
bubbles_theme = vim.fn.fnamemodify("auto", ":t")
|
||||||
end
|
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 {
|
require("lualine").setup {
|
||||||
options = {
|
options = theme.options,
|
||||||
theme = bubbles_theme,
|
sections = theme.sections,
|
||||||
component_separators = { left = "", right = "" },
|
inactive_sections = theme.inactive_sections,
|
||||||
section_separators = { left = "", right = "" },
|
tabline = theme.tabline,
|
||||||
disabled_filetypes = {
|
extensions = theme.extensions,
|
||||||
"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 = {},
|
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,193 +1,202 @@
|
||||||
local hide_in_width = function()
|
local hide_in_width = function()
|
||||||
return vim.fn.winwidth(0) > 75
|
return vim.fn.winwidth(0) > 75
|
||||||
end
|
end
|
||||||
local icons = vim.g.pcode_icons
|
local icons = require "user.icons"
|
||||||
local formatter = require("user.utils.formatter")
|
local formatter = require "user.utils.formatter"
|
||||||
local linter = require("user.utils.linter")
|
local linter = require "user.utils.linter"
|
||||||
|
|
||||||
local getLeftSubstring = function(word, length)
|
local getLeftSubstring = function(word, length)
|
||||||
if #word > length then
|
if #word > length then
|
||||||
return string.sub(word, 1, length) .. "..."
|
return string.sub(word, 1, length) .. "..."
|
||||||
else
|
else
|
||||||
return word
|
return word
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local unique_list = function(list)
|
local unique_list = function(list)
|
||||||
local seen = {}
|
local seen = {}
|
||||||
local result = {}
|
local result = {}
|
||||||
|
|
||||||
for _, val in ipairs(list) do
|
for _, val in ipairs(list) do
|
||||||
if not seen[val] then
|
if not seen[val] then
|
||||||
table.insert(result, val)
|
table.insert(result, val)
|
||||||
seen[val] = true
|
seen[val] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- treesitter info
|
-- treesitter info
|
||||||
treesitter = {
|
treesitter = {
|
||||||
function()
|
function()
|
||||||
return icons.ui.Paint .. " TS"
|
return icons.ui.Paint .. " TS"
|
||||||
end,
|
end,
|
||||||
color = function()
|
color = function()
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
local ts = vim.treesitter.highlighter.active[buf]
|
local ts = vim.treesitter.highlighter.active[buf]
|
||||||
return { fg = ts and not vim.tbl_isempty(ts) and "#50fa7b" or "#FF5555" }
|
return { fg = ts and not vim.tbl_isempty(ts) and "#50fa7b" or "#FF5555" }
|
||||||
end,
|
end,
|
||||||
cond = hide_in_width,
|
cond = hide_in_width,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Lsp info
|
-- Lsp info
|
||||||
lsp_info = {
|
lsp_info = {
|
||||||
function()
|
function()
|
||||||
local msg = "LSP Inactive"
|
local msg = "LSP Inactive"
|
||||||
local buf_ft = vim.bo.filetype
|
local buf_ft = vim.bo.filetype
|
||||||
-- start register
|
-- start register
|
||||||
local buf_clients = {}
|
local buf_clients = {}
|
||||||
buf_clients = vim.lsp.get_clients({ bufnr = 0 })
|
buf_clients = vim.lsp.get_clients { bufnr = 0 }
|
||||||
local buf_client_names = {}
|
local buf_client_names = {}
|
||||||
if next(buf_clients) == nil then
|
if next(buf_clients) == nil then
|
||||||
-- TODO: clean up this if statement
|
-- TODO: clean up this if statement
|
||||||
if type(msg) == "boolean" or #msg == 0 then
|
if type(msg) == "boolean" or #msg == 0 then
|
||||||
return "LSP Inactive"
|
return "LSP Inactive"
|
||||||
end
|
end
|
||||||
return msg
|
return msg
|
||||||
end
|
end
|
||||||
-- add client
|
-- add client
|
||||||
for _, client in pairs(buf_clients) do
|
for _, client in pairs(buf_clients) do
|
||||||
if client.name ~= "null-ls" and client.name ~= "copilot" then
|
if client.name ~= "null-ls" and client.name ~= "copilot" then
|
||||||
table.insert(buf_client_names, client.name)
|
table.insert(buf_client_names, client.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add formatter
|
-- add formatter
|
||||||
local supported_formatters = formatter.list_registered(buf_ft)
|
local supported_formatters = formatter.list_registered(buf_ft)
|
||||||
vim.list_extend(buf_client_names, supported_formatters)
|
vim.list_extend(buf_client_names, supported_formatters)
|
||||||
|
|
||||||
-- add linter
|
-- add linter
|
||||||
local supported_linters = linter.linter_list_registered(buf_ft)
|
local supported_linters = linter.linter_list_registered(buf_ft)
|
||||||
vim.list_extend(buf_client_names, supported_linters)
|
vim.list_extend(buf_client_names, supported_linters)
|
||||||
|
|
||||||
-- decomple
|
-- decomple
|
||||||
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
||||||
local unique_client_names = unique_list(buf_client_names)
|
local unique_client_names = unique_list(buf_client_names)
|
||||||
msg = table.concat(unique_client_names, ", ")
|
msg = table.concat(unique_client_names, ", ")
|
||||||
return msg
|
return msg
|
||||||
end,
|
end,
|
||||||
icon = icons.ui.Gear .. "",
|
icon = icons.ui.Gear .. "",
|
||||||
padding = 1,
|
padding = 1,
|
||||||
cond = hide_in_width,
|
cond = hide_in_width,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- diagnostics info
|
-- diagnostics info
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
sources = { "nvim_diagnostic" },
|
sources = { "nvim_diagnostic" },
|
||||||
sections = { "error", "warn" },
|
sections = { "error", "warn" },
|
||||||
symbols = {
|
symbols = {
|
||||||
error = icons.diagnostics.BoldError .. " ",
|
error = icons.diagnostics.BoldError .. " ",
|
||||||
warn = icons.diagnostics.BoldWarning .. " ",
|
warn = icons.diagnostics.BoldWarning .. " ",
|
||||||
},
|
},
|
||||||
colored = true,
|
colored = true,
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
always_visible = false,
|
always_visible = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- git info
|
-- git info
|
||||||
diff = {
|
diff = {
|
||||||
"diff",
|
"diff",
|
||||||
colored = true,
|
colored = true,
|
||||||
symbols = {
|
symbols = {
|
||||||
added = icons.git.LineAdded .. " ",
|
added = icons.git.LineAdded .. " ",
|
||||||
modified = icons.git.LineModified .. " ",
|
modified = icons.git.LineModified .. " ",
|
||||||
removed = icons.git.LineRemoved .. " ",
|
removed = icons.git.LineRemoved .. " ",
|
||||||
},
|
},
|
||||||
cond = hide_in_width,
|
cond = hide_in_width,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- tab info
|
-- tab info
|
||||||
spaces = {
|
spaces = {
|
||||||
function()
|
function()
|
||||||
-- local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth")
|
-- local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||||
-- local shiftwidth = vim.api.nvim_get_option_value("shiftwidth", { scope = "buf", bufnr = 0 })
|
-- local shiftwidth = vim.api.nvim_get_option_value("shiftwidth", { scope = "buf", bufnr = 0 })
|
||||||
local shiftwidth = vim.fn.shiftwidth()
|
local shiftwidth = vim.fn.shiftwidth()
|
||||||
return icons.ui.Tab .. " " .. shiftwidth
|
return icons.ui.Tab .. " " .. shiftwidth
|
||||||
end,
|
end,
|
||||||
padding = 1,
|
padding = 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- nvim mode info
|
-- nvim mode info
|
||||||
mode = {
|
mode_rounded = {
|
||||||
"mode",
|
"mode",
|
||||||
padding = 1,
|
padding = 1,
|
||||||
separator = { left = " " },
|
separator = { left = " " },
|
||||||
fmt = function(str)
|
fmt = function(str)
|
||||||
return icons.ui.Neovim .. " " .. str
|
return icons.ui.Neovim .. " " .. str
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- git branch info
|
mode_square = {
|
||||||
get_branch = function()
|
"mode",
|
||||||
if vim.b.gitsigns_head ~= nil then
|
padding = 1,
|
||||||
return icons.git.Branch2 .. " " .. getLeftSubstring(vim.b.gitsigns_head, 6)
|
separator = { left = "" },
|
||||||
else
|
fmt = function(str)
|
||||||
return icons.git.Branch2 .. vim.fn.fnamemodify("", ":t")
|
return icons.ui.Neovim .. " " .. str
|
||||||
end
|
end,
|
||||||
end,
|
},
|
||||||
|
|
||||||
-- default colorscheme
|
-- git branch info
|
||||||
colors = {
|
get_branch = function()
|
||||||
blue = "#50fa7b",
|
if vim.b.gitsigns_head ~= nil then
|
||||||
cyan = "#f1fa8c",
|
return icons.git.Branch2 .. " " .. getLeftSubstring(vim.b.gitsigns_head, 6)
|
||||||
black = "#1a1b26",
|
else
|
||||||
black_transparant = "none",
|
return icons.git.Branch2 .. vim.fn.fnamemodify("", ":t")
|
||||||
white = "#c6c6c6",
|
end
|
||||||
red = "#ff757f",
|
end,
|
||||||
skyblue_1 = "#bd93f9",
|
|
||||||
grey = "#5f6a8e",
|
|
||||||
yellow = "#ffb86c",
|
|
||||||
fg_gutter = "#3b4261",
|
|
||||||
green1 = "#bd93f9",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- default lualine theme
|
-- default colorscheme
|
||||||
bubbles_theme = function(colors)
|
colors = {
|
||||||
return {
|
blue = "#50fa7b",
|
||||||
normal = {
|
cyan = "#f1fa8c",
|
||||||
a = { fg = colors.black, bg = colors.skyblue_1 },
|
black = "#1a1b26",
|
||||||
b = { fg = colors.white, bg = colors.grey },
|
black_transparant = "none",
|
||||||
c = { fg = colors.white, bg = colors.black_transparant },
|
white = "#c6c6c6",
|
||||||
},
|
red = "#ff757f",
|
||||||
|
skyblue_1 = "#bd93f9",
|
||||||
|
grey = "#5f6a8e",
|
||||||
|
yellow = "#ffb86c",
|
||||||
|
fg_gutter = "#3b4261",
|
||||||
|
green1 = "#bd93f9",
|
||||||
|
},
|
||||||
|
|
||||||
insert = {
|
-- default lualine theme
|
||||||
a = { fg = colors.black, bg = colors.blue },
|
bubbles_theme = function(colors)
|
||||||
b = { fg = colors.blue, bg = colors.grey },
|
return {
|
||||||
},
|
normal = {
|
||||||
visual = {
|
a = { fg = colors.black, bg = colors.skyblue_1 },
|
||||||
a = { fg = colors.black, bg = colors.cyan },
|
b = { fg = colors.white, bg = colors.grey },
|
||||||
b = { fg = colors.cyan, bg = colors.grey },
|
c = { fg = colors.white, bg = colors.black_transparant },
|
||||||
},
|
},
|
||||||
replace = {
|
|
||||||
a = { bg = colors.red, fg = colors.black },
|
insert = {
|
||||||
b = { bg = colors.fg_gutter, fg = colors.red },
|
a = { fg = colors.black, bg = colors.blue },
|
||||||
},
|
b = { fg = colors.blue, bg = colors.grey },
|
||||||
command = {
|
},
|
||||||
a = { bg = colors.yellow, fg = colors.black },
|
visual = {
|
||||||
b = { bg = colors.fg_gutter, fg = colors.yellow },
|
a = { fg = colors.black, bg = colors.cyan },
|
||||||
},
|
b = { fg = colors.cyan, bg = colors.grey },
|
||||||
terminal = {
|
},
|
||||||
a = { bg = colors.green1, fg = colors.black },
|
replace = {
|
||||||
b = { bg = colors.fg_gutter, fg = colors.green1 },
|
a = { bg = colors.red, fg = colors.black },
|
||||||
},
|
b = { bg = colors.fg_gutter, fg = colors.red },
|
||||||
inactive = {
|
},
|
||||||
a = { fg = colors.white, bg = colors.black_transparant },
|
command = {
|
||||||
b = { fg = colors.white, bg = colors.black_transparant },
|
a = { bg = colors.yellow, fg = colors.black },
|
||||||
c = { fg = colors.black, bg = colors.black_transparant },
|
b = { bg = colors.fg_gutter, fg = colors.yellow },
|
||||||
},
|
},
|
||||||
}
|
terminal = {
|
||||||
end,
|
a = { bg = colors.green1, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.green1 },
|
||||||
|
},
|
||||||
|
inactive = {
|
||||||
|
a = { fg = colors.white, bg = colors.black_transparant },
|
||||||
|
b = { fg = colors.white, bg = colors.black_transparant },
|
||||||
|
c = { fg = colors.black, bg = colors.black_transparant },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
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