2022-05-11 21:00:57 -05:00
|
|
|
local present, lualine = pcall(require, 'lualine')
|
2022-01-08 15:24:29 -06:00
|
|
|
if not present then
|
2022-05-11 21:00:57 -05:00
|
|
|
return
|
2022-01-08 15:24:29 -06:00
|
|
|
end
|
|
|
|
|
2022-06-04 21:25:49 -05:00
|
|
|
-- Thanks to rockyzhang24 (github.com/rockyzhang24)
|
|
|
|
|
|
|
|
local function simplifiedMode(str)
|
|
|
|
return ' ' .. (str == 'V-LINE' and 'VL' or (str == 'V-BLOCK' and 'VB' or str:sub(1, 1)))
|
|
|
|
end
|
|
|
|
|
|
|
|
-- For location, show total lines
|
|
|
|
local function customLocation(str)
|
|
|
|
return string.gsub(str, '%w+', '%1' .. '/%%L', 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- For progress, add a fancy icon
|
|
|
|
local function customProgress(str)
|
|
|
|
return ' ' .. str
|
|
|
|
end
|
|
|
|
|
|
|
|
-- For filename, show the filename and the filesize
|
|
|
|
local function fileNameAndSize(str)
|
|
|
|
-- For doc, only show filename
|
|
|
|
if string.find(str, '.*/doc/.*%.txt') then
|
|
|
|
str = vim.fn.expand('%:t')
|
|
|
|
end
|
|
|
|
local size = require('lualine.components.filesize')()
|
|
|
|
return size == '' and str or str .. ' [' .. size .. ']'
|
|
|
|
end
|
2022-01-08 15:24:29 -06:00
|
|
|
|
2022-07-01 20:18:40 -05:00
|
|
|
local function show_macro_recording()
|
|
|
|
local recording_register = vim.fn.reg_recording()
|
|
|
|
if recording_register == '' then
|
|
|
|
return ''
|
|
|
|
else
|
|
|
|
return 'Recording @' .. recording_register
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-01-18 13:31:48 -06:00
|
|
|
lualine.setup({
|
2022-05-11 21:00:57 -05:00
|
|
|
options = {
|
|
|
|
icons_enabled = true,
|
|
|
|
theme = 'auto',
|
2022-06-04 21:25:49 -05:00
|
|
|
-- component_separators = { left = '', right = '' },
|
|
|
|
-- section_separators = { left = '', right = '' },
|
|
|
|
-- component_separators = { left = '', right = '' },
|
|
|
|
-- section_separators = { left = '', right = '' },
|
|
|
|
component_separators = { left = '', right = '' },
|
|
|
|
section_separators = { left = '', right = '' },
|
2022-05-11 21:00:57 -05:00
|
|
|
disabled_filetypes = {},
|
|
|
|
always_divide_middle = true,
|
2022-06-04 21:25:49 -05:00
|
|
|
globalstatus = true, -- requires neovim 0.7 or highter
|
2022-05-11 21:00:57 -05:00
|
|
|
},
|
|
|
|
sections = {
|
2022-06-04 21:25:49 -05:00
|
|
|
-- Left
|
|
|
|
lualine_a = {
|
|
|
|
{
|
|
|
|
'mode',
|
|
|
|
fmt = simplifiedMode,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lualine_b = {
|
|
|
|
{
|
|
|
|
'branch',
|
|
|
|
icon = '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'diff',
|
|
|
|
symbols = { added = '+', modified = '~', removed = '-' },
|
|
|
|
-- symbols = { added = ' ', modified = ' ', removed = ' ' },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'diagnostics',
|
|
|
|
sources = { 'nvim_diagnostic' },
|
|
|
|
-- symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' },
|
|
|
|
symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' },
|
|
|
|
},
|
2022-07-01 20:18:40 -05:00
|
|
|
{
|
|
|
|
show_macro_recording,
|
|
|
|
},
|
2022-06-04 21:25:49 -05:00
|
|
|
},
|
2022-05-11 21:00:57 -05:00
|
|
|
lualine_c = {
|
|
|
|
{
|
|
|
|
'filename',
|
2022-06-04 21:25:49 -05:00
|
|
|
path = 3,
|
|
|
|
symbols = {
|
|
|
|
modified = '[+]',
|
|
|
|
readonly = '[]',
|
|
|
|
unnamed = '[No Name]',
|
|
|
|
},
|
|
|
|
fmt = fileNameAndSize,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Right
|
|
|
|
lualine_x = {
|
|
|
|
'encoding',
|
|
|
|
'fileformat',
|
|
|
|
'filetype',
|
|
|
|
},
|
|
|
|
lualine_y = {
|
|
|
|
{
|
|
|
|
'location',
|
|
|
|
fmt = customLocation,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lualine_z = {
|
|
|
|
{
|
|
|
|
'progress',
|
|
|
|
fmt = customProgress,
|
2022-05-11 21:00:57 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inactive_sections = {
|
|
|
|
lualine_a = {},
|
|
|
|
lualine_b = {},
|
|
|
|
lualine_c = { 'filename' },
|
2022-06-04 21:25:49 -05:00
|
|
|
lualine_x = {
|
|
|
|
{
|
|
|
|
'location',
|
|
|
|
fmt = customLocation,
|
|
|
|
},
|
|
|
|
},
|
2022-05-11 21:00:57 -05:00
|
|
|
lualine_y = {},
|
|
|
|
lualine_z = {},
|
|
|
|
},
|
|
|
|
tabline = {},
|
2022-06-04 21:25:49 -05:00
|
|
|
extensions = {
|
|
|
|
'aerial',
|
|
|
|
'fugitive',
|
|
|
|
'nvim-tree',
|
|
|
|
'neo-tree',
|
|
|
|
'quickfix',
|
|
|
|
'toggleterm',
|
|
|
|
},
|
2022-01-18 13:31:48 -06:00
|
|
|
})
|