vim: better status line (lualine)

This commit is contained in:
Fernando Schauenburg 2022-02-01 20:38:51 +01:00
parent 6e2995c930
commit 45eadf6291
2 changed files with 77 additions and 33 deletions

View file

@ -23,38 +23,34 @@ else
} }
end end
local percent_lines = '%3p%%×%L' local progress = { '%3p%%×%L %3l:%-2v', padding = { left = 0, right = 1 } }
local relative_path = { 'filename', path = 1 } local relative_path = { 'filename', path = 1 }
local git_diff = { local encoding = function ()
'diff', local fenc = vim.opt.fileencoding:get()
diff_color = { if fenc ~= '' then
added = { fg = colors.green }, modified = { fg = colors.yellow }, return fenc
removed = { fg = colors.red }, end
}, return vim.opt.encoding:get()
} end
local fileformat = { 'fileformat', padding = { left = 0, right = 1} }
require('lualine').setup { require('lualine').setup {
options = { options = {
icons_enabled = false, icons_enabled = true,
component_separators = { left = '', right = '' }, component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' }, section_separators = { left = '', right = '' },
disabled_filetypes = {},
always_divide_middle = true,
theme = { theme = {
normal = { normal = {
a = { fg = colors.base03, bg = colors.blue, }, a = { fg = colors.base03, bg = colors.blue, gui='bold' },
b = { fg = colors.base03, bg = colors.base00 }, b = { fg = colors.base2, bg = colors.base00 },
c = { fg = colors.base1, bg = colors.base02 }, c = { fg = colors.base1, bg = colors.base02 },
-- x == c
-- y == b
z = { fg = colors.base03, bg = colors.base0 },
}, },
insert = { a = { fg = colors.base03, bg = colors.green, } }, insert = { a = { fg = colors.base03, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.base03, bg = colors.magenta, } }, visual = { a = { fg = colors.base03, bg = colors.magenta, gui = 'bold' } },
replace = { a = { fg = colors.base03, bg = colors.red, } }, replace = { a = { fg = colors.base03, bg = colors.red, gui = 'bold' } },
inactive = { inactive = {
a = { fg = colors.base00, bg = colors.base02, }, a = { fg = colors.base1, bg = colors.base00 },
b = { fg = colors.base00, bg = colors.base02 }, b = { fg = colors.base0, bg = colors.base01 },
c = { fg = colors.base00, bg = colors.base02 }, c = { fg = colors.base00, bg = colors.base02 },
}, },
}, },
@ -69,24 +65,69 @@ require('lualine').setup {
cond = function() return vim.opt.paste:get() end cond = function() return vim.opt.paste:get() end
}, },
}, },
lualine_b = { 'diagnostics' }, lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path }, lualine_c = { relative_path },
lualine_x = { 'branch', git_diff }, lualine_x = { 'filetype' },
lualine_y = { 'filetype', 'encoding', 'fileformat' }, lualine_y = { encoding, fileformat },
lualine_z = { 'location', percent_lines }, lualine_z = { progress },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
lualine_b = {}, lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path }, lualine_c = { relative_path },
lualine_x = { 'branch', git_diff }, lualine_x = { 'filetype' },
lualine_y = { 'filetype', 'encoding', 'fileformat' }, lualine_y = { encoding, fileformat },
lualine_z = { 'location', percent_lines }, lualine_z = { progress },
}, },
tabline = {},
extensions = { 'fugitive', 'quickfix' } extensions = { 'fugitive', 'quickfix' }
} }

View file

@ -7,7 +7,10 @@ local plugins = function(use)
use 'altercation/vim-colors-solarized' use 'altercation/vim-colors-solarized'
use 'nvim-lualine/lualine.nvim' use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' } use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' }
use 'junegunn/rainbow_parentheses.vim' use 'junegunn/rainbow_parentheses.vim'