feat(filename): add unnamed option (#496)

* feat(filename): add unnamed option

* docs(filename): add documentation for symbols
This commit is contained in:
Tobias Schmitz 2021-12-18 13:49:41 +01:00 committed by GitHub
parent c4a09735a6
commit d02658b34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 10 deletions

View File

@ -503,10 +503,15 @@ sections = {
lualine_a = { lualine_a = {
{ {
'filename', 'filename',
file_status = true, -- displays file status (readonly status, modified status) file_status = true, -- displays file status (readonly status, modified status)
path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path
shorting_target = 40 -- Shortens path to leave 40 space in the window shorting_target = 40, -- Shortens path to leave 40 space in the window
-- for other components. Terrible name any suggestions? -- for other components. Terrible name any suggestions?
symbols = {
modified = '[+]', -- when the file was modified
readonly = '[-]', -- if the file is not modifiable or readonly
unnamed = '[No Name]', -- default display name for unnamed buffers
}
} }
} }
} }

View File

@ -530,10 +530,15 @@ Component specific options These are options that are available on
lualine_a = { lualine_a = {
{ {
'filename', 'filename',
file_status = true, -- displays file status (readonly status, modified status) file_status = true, -- displays file status (readonly status, modified status)
path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path
shorting_target = 40 -- Shortens path to leave 40 space in the window shorting_target = 40, -- Shortens path to leave 40 space in the window
-- for other components. Terrible name any suggestions? -- for other components. Terrible name any suggestions?
symbols = {
modified = '[+]', -- when the file was modified
readonly = '[-]', -- if the file is not modifiable or readonly
unnamed = '[No Name]', -- default display name for unnamed buffers
}
} }
} }
} }

View File

@ -3,7 +3,7 @@
local M = require('lualine.component'):extend() local M = require('lualine.component'):extend()
local default_options = { local default_options = {
symbols = { modified = '[+]', readonly = '[-]' }, symbols = { modified = '[+]', readonly = '[-]', unnamed = '[No Name]' },
file_status = true, file_status = true,
path = 0, path = 0,
shorting_target = 40, shorting_target = 40,
@ -45,7 +45,7 @@ M.update_status = function(self)
end end
if data == '' then if data == '' then
data = '[No Name]' data = self.options.symbols.unnamed
end end
if self.options.shorting_target ~= 0 then if self.options.shorting_target ~= 0 then