modify lualine, show more info about location

This commit is contained in:
leafee98 2023-12-14 20:54:18 +08:00
parent e3df1c2a03
commit 4f9bbad9d7

View file

@ -1,3 +1,11 @@
function lualine_my_location()
local line = vim.fn.line('.')
local line_cnt = vim.fn.line('$')
local col = vim.fn.virtcol('.')
local col_cnt = vim.fn.virtcol('$') - 1
return string.format('%3d(%d):%d(%d)', line, line_cnt, col, col_cnt)
end
return { return {
{ {
"sainnhe/gruvbox-material", "sainnhe/gruvbox-material",
@ -73,7 +81,7 @@ return {
lualine_c = {'filename'}, lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'}, lualine_y = {'progress'},
lualine_z = {'location'} lualine_z = { lualine_my_location },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
@ -81,7 +89,7 @@ return {
lualine_c = {'filename'}, lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'}, lualine_y = {'progress'},
lualine_z = {'location'} lualine_z = { lualine_my_location },
} }
}, },
init = function(_) init = function(_)