refactor: fix #100

This commit is contained in:
hoob3rt 2021-02-20 16:59:28 +01:00
parent 3fecc953aa
commit 66a6cb3c9d
1 changed files with 6 additions and 7 deletions

View File

@ -3,16 +3,15 @@
local function filename(options) local function filename(options)
-- setting defaults -- setting defaults
local file_status, shorten, full_path = true, true, false if options.file_status == nil then options.file_status = true end
if options.file_status ~= nil then file_status = options.file_status end if options.shorten == nil then options.shorten = true end
if options.shorten ~= nil then shorten = options.shorten end if options.full_path == nil then options.full_path = false end
if options.full_path ~= nil then full_path = options.full_path end
return function() return function()
local data local data
if not full_path then if not options.full_path then
data = vim.fn.expand('%:t') data = vim.fn.expand('%:t')
elseif shorten then elseif options.shorten then
data = vim.fn.expand('%') data = vim.fn.expand('%')
else else
data = vim.fn.expand('%:p') data = vim.fn.expand('%:p')
@ -23,7 +22,7 @@ local function filename(options)
data = vim.fn.pathshorten(data) data = vim.fn.pathshorten(data)
end end
if file_status then if options.file_status then
if vim.bo.modified then data = data .. "[+]" if vim.bo.modified then data = data .. "[+]"
elseif vim.bo.modifiable == false then data = data .. "[-]" end elseif vim.bo.modifiable == false then data = data .. "[-]" end
end end