From d02658b34d730f49c72e8e56a1f246b6146fac34 Mon Sep 17 00:00:00 2001 From: Tobias Schmitz Date: Sat, 18 Dec 2021 13:49:41 +0100 Subject: [PATCH] feat(filename): add unnamed option (#496) * feat(filename): add unnamed option * docs(filename): add documentation for symbols --- README.md | 13 +++++++++---- doc/lualine.txt | 13 +++++++++---- lua/lualine/components/filename.lua | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 59694a4..33e271e 100644 --- a/README.md +++ b/README.md @@ -503,10 +503,15 @@ sections = { lualine_a = { { 'filename', - file_status = true, -- displays file status (readonly status, modified status) - path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path - shorting_target = 40 -- Shortens path to leave 40 space in the window - -- for other components. Terrible name any suggestions? + file_status = true, -- displays file status (readonly status, modified status) + path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path + shorting_target = 40, -- Shortens path to leave 40 space in the window + -- 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 + } } } } diff --git a/doc/lualine.txt b/doc/lualine.txt index 87d88e6..d668fdf 100644 --- a/doc/lualine.txt +++ b/doc/lualine.txt @@ -530,10 +530,15 @@ Component specific options These are options that are available on lualine_a = { { 'filename', - file_status = true, -- displays file status (readonly status, modified status) - path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path - shorting_target = 40 -- Shortens path to leave 40 space in the window - -- for other components. Terrible name any suggestions? + file_status = true, -- displays file status (readonly status, modified status) + path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path + shorting_target = 40, -- Shortens path to leave 40 space in the window + -- 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 + } } } } diff --git a/lua/lualine/components/filename.lua b/lua/lualine/components/filename.lua index a11324c..2020e43 100644 --- a/lua/lualine/components/filename.lua +++ b/lua/lualine/components/filename.lua @@ -3,7 +3,7 @@ local M = require('lualine.component'):extend() local default_options = { - symbols = { modified = '[+]', readonly = '[-]' }, + symbols = { modified = '[+]', readonly = '[-]', unnamed = '[No Name]' }, file_status = true, path = 0, shorting_target = 40, @@ -45,7 +45,7 @@ M.update_status = function(self) end if data == '' then - data = '[No Name]' + data = self.options.symbols.unnamed end if self.options.shorting_target ~= 0 then