From 66a6cb3c9d806230650e45508c845b0075e6ed84 Mon Sep 17 00:00:00 2001 From: hoob3rt Date: Sat, 20 Feb 2021 16:59:28 +0100 Subject: [PATCH] refactor: fix #100 --- lua/lualine/components/filename.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/lualine/components/filename.lua b/lua/lualine/components/filename.lua index a0ca979..d4e8ac2 100644 --- a/lua/lualine/components/filename.lua +++ b/lua/lualine/components/filename.lua @@ -3,16 +3,15 @@ local function filename(options) -- setting defaults - local file_status, shorten, full_path = true, true, false - if options.file_status ~= nil then file_status = options.file_status end - if options.shorten ~= nil then shorten = options.shorten end - if options.full_path ~= nil then full_path = options.full_path end + if options.file_status == nil then options.file_status = true end + if options.shorten == nil then options.shorten = true end + if options.full_path == nil then options.full_path = false end return function() local data - if not full_path then + if not options.full_path then data = vim.fn.expand('%:t') - elseif shorten then + elseif options.shorten then data = vim.fn.expand('%') else data = vim.fn.expand('%:p') @@ -23,7 +22,7 @@ local function filename(options) data = vim.fn.pathshorten(data) end - if file_status then + if options.file_status then if vim.bo.modified then data = data .. "[+]" elseif vim.bo.modifiable == false then data = data .. "[-]" end end