lualine working directory
This commit is contained in:
parent
5abd75b202
commit
e74618efd4
@ -17,6 +17,7 @@ function M.config()
|
|||||||
bg = '#252526',
|
bg = '#252526',
|
||||||
inset = '#569cd6',
|
inset = '#569cd6',
|
||||||
|
|
||||||
|
working_dir = '#569cd6',
|
||||||
branch = '#dcdcaa',
|
branch = '#dcdcaa',
|
||||||
filetype = '#c5a6c0',
|
filetype = '#c5a6c0',
|
||||||
filename = '#91bde1',
|
filename = '#91bde1',
|
||||||
@ -61,15 +62,20 @@ function M.config()
|
|||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_c = {
|
lualine_c = {
|
||||||
{ -- filetype
|
{ -- working dir
|
||||||
"filetype",
|
function ()
|
||||||
colored = false,
|
local cwd = vim.fn.getcwd()
|
||||||
color = { fg = scolors.filetype, gui = "bold" },
|
-- substr the cwd starting at the last "/" character
|
||||||
cond = conditions.buffer_not_empty,
|
local cwd_name = string.sub(cwd,-cwd:reverse():find("/")+1)
|
||||||
|
return cwd_name
|
||||||
|
end,
|
||||||
|
color = { fg = scolors.working_dir, gui = "bold" },
|
||||||
|
icon="",
|
||||||
padding = { left = 2, right = 1 },
|
padding = { left = 2, right = 1 },
|
||||||
},
|
},
|
||||||
{ -- file name
|
{ -- file name
|
||||||
"filename",
|
"filename",
|
||||||
|
icon="",
|
||||||
color = { fg = scolors.filename, gui = "bold" },
|
color = { fg = scolors.filename, gui = "bold" },
|
||||||
padding = { left = 1, right = 1 },
|
padding = { left = 1, right = 1 },
|
||||||
},
|
},
|
||||||
@ -79,10 +85,12 @@ function M.config()
|
|||||||
color = { fg = scolors.branch, gui = "bold" },
|
color = { fg = scolors.branch, gui = "bold" },
|
||||||
padding = { left = 1, right = 1 },
|
padding = { left = 1, right = 1 },
|
||||||
},
|
},
|
||||||
{ -- working dir
|
{ -- filetype
|
||||||
function () return vim.fn.getcwd() end,
|
"filetype",
|
||||||
color = { fg = scolors.branch, gui = "bold" },
|
colored = false,
|
||||||
padding = { left = 0, right = 1 },
|
color = { fg = scolors.filetype, gui = "bold" },
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
padding = { left = 1, right = 1 },
|
||||||
},
|
},
|
||||||
{ -- git diff
|
{ -- git diff
|
||||||
"diff",
|
"diff",
|
||||||
@ -142,74 +150,17 @@ function M.config()
|
|||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_a = {},
|
lualine_a = {
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = {
|
|
||||||
{ -- filetype
|
|
||||||
"filetype",
|
|
||||||
colored = false,
|
|
||||||
color = { fg = scolors.filetype, gui = "bold" },
|
|
||||||
cond = conditions.buffer_not_empty,
|
|
||||||
padding = { left = 2, right = 1 },
|
|
||||||
},
|
|
||||||
{ -- file name
|
{ -- file name
|
||||||
"filename",
|
"filename",
|
||||||
|
icon="",
|
||||||
color = { fg = scolors.filename, gui = "bold" },
|
color = { fg = scolors.filename, gui = "bold" },
|
||||||
padding = { left = 1, right = 1 },
|
padding = { left = 1, right = 1 },
|
||||||
},
|
},
|
||||||
{ -- git diff
|
|
||||||
"diff",
|
|
||||||
symbols = { added = " ", modified = "柳", removed = " " },
|
|
||||||
diff_color = {
|
|
||||||
added = { fg = scolors.added },
|
|
||||||
modified = { fg = scolors.modified },
|
|
||||||
removed = { fg = scolors.removed },
|
|
||||||
},
|
|
||||||
cond = conditions.hide_in_width,
|
|
||||||
padding = { left = 1, right = 1 },
|
|
||||||
},
|
|
||||||
{ -- nvim diagnostics
|
|
||||||
"diagnostics",
|
|
||||||
sources = { "nvim_diagnostic" },
|
|
||||||
symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
|
||||||
diagnostics_color = {
|
|
||||||
color_error = { fg = scolors.error },
|
|
||||||
color_warn = { fg = scolors.warn },
|
|
||||||
color_info = { fg = scolors.info },
|
|
||||||
},
|
|
||||||
padding = { left = 1, right = 1 },
|
|
||||||
},
|
|
||||||
{ -- git branch
|
|
||||||
"branch",
|
|
||||||
icon = "",
|
|
||||||
padding = { left = 1, right = 1 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lualine_x = {
|
|
||||||
{ -- location in file (line:col)
|
|
||||||
"location",
|
|
||||||
padding = { left = 0, right = 1 },
|
|
||||||
},
|
|
||||||
{ -- progress through file (%)
|
|
||||||
-- slightly modified from default "progress"
|
|
||||||
-- always 3 chars long, no TOP
|
|
||||||
-- https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/components/progress.lua
|
|
||||||
function ()
|
|
||||||
local cur = vim.fn.line('.')
|
|
||||||
local total = vim.fn.line('$')
|
|
||||||
if cur == total then
|
|
||||||
return 'BOT'
|
|
||||||
elseif cur / total < 0.10 then
|
|
||||||
return ' ' .. math.floor(cur / total * 100) .. '%%'
|
|
||||||
else
|
|
||||||
return math.floor(cur / total * 100) .. '%%'
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
"progress",
|
|
||||||
color = { gui = "none" },
|
|
||||||
padding = { left = 0, right = 1 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user