nvim: modify statusline

- move functions to functions.lua
- enable new file indicator
This commit is contained in:
tastytea 2022-10-09 14:41:01 +02:00
parent f49db4794a
commit 387765e135
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 22 additions and 11 deletions

View File

@ -142,4 +142,17 @@ function M.lsp_sig_status()
return require('lsp_signature').status_line(width).label
end
function M.not_firenvim()
return vim.g.started_by_firenvim == nil
end
-- returns the name of the current function in brackets or an empty string
function M.current_function()
local curfun = vim.b.lsp_current_function
if curfun and curfun ~= '' then
return '(' .. curfun .. ')'
end
return ''
end
return M

View File

@ -77,6 +77,7 @@ map('n', '<F9>', require("nvim-tree.api").tree.toggle, 'Open nvim-tree')
map('i', '<F9>', require("nvim-tree.api").tree.toggle, 'Open nvim-tree')
vim.o.showmode = false
local not_firenvim = require('my.functions').not_firenvim
require('lualine').setup({
options = {
icons_enabled = nerdfont_installed,
@ -90,19 +91,16 @@ require('lualine').setup({
lualine_b = {
{ 'branch', icons_enabled = true },
{ 'diff' },
{ 'require("my.functions").lsp_status()', padding = 0 },
{ require('my.functions').lsp_status, padding = 0 },
{ 'diagnostics' }
},
lualine_c = { { 'filename', path = 1,
cond = function() return vim.g.started_by_firenvim == nil end },
{ function()
local curfun = vim.b.lsp_current_function
if curfun and curfun ~= '' then
return '(' .. curfun .. ')'
end
return ''
end, padding = 0, color = 'StatusLineNC' } },
lualine_x = { { 'require("my.functions").lsp_sig_status()',
lualine_c = {
{ 'filename', path = 1, newfile_status = true,
cond = not_firenvim },
{ require('my.functions').current_function, padding = 0,
color = 'StatusLineNC' }
},
lualine_x = { { require('my.functions').lsp_sig_status,
color = 'StatusLineNC' }, { 'filetype' } },
lualine_y = { { 'progress' } },
lualine_z = { { 'location' }, { '"🍄"', padding = 0 }