fix: filename component
This commit is contained in:
parent
20d7f33ef9
commit
395d7cbb69
|
@ -257,11 +257,12 @@ lualine.sections.lualine_b = {
|
||||||
{
|
{
|
||||||
'filename',
|
'filename',
|
||||||
full_name = true,
|
full_name = true,
|
||||||
relative = true,
|
shorten = true,
|
||||||
format = function(name)
|
format = function(name)
|
||||||
-- Capitalize first charecter of filename to capital.
|
-- Capitalize first charecter of filename to capital.
|
||||||
local path, fname = name:match('(.*/)(.*)')
|
local path, fname = name:match('(.*/)(.*)')
|
||||||
rerurn path .. fname[1, 1]:upper() .. fname[2, #fname]
|
if not path then path = ''; fname = name end
|
||||||
|
return path .. fname:sub(1, 1):upper() .. fname:sub(2, #fname)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,11 +293,12 @@ Example:~
|
||||||
{
|
{
|
||||||
'filename',
|
'filename',
|
||||||
full_name = true,
|
full_name = true,
|
||||||
relative = true,
|
shorten = true,
|
||||||
format = function(name)
|
format = function(name)
|
||||||
-- Capitalize first charecter of filename to capital.
|
-- Capitalize first charecter of filename to capital.
|
||||||
local path, fname = name:match('(.*/)(.*)')
|
local path, fname = name:match('(.*/)(.*)')
|
||||||
rerurn path .. fname[1, 1]:upper() .. fname[2, #fname]
|
if not path then path = ''; fname = name end
|
||||||
|
return path .. fname:sub(1, 1):upper() .. fname:sub(2, #fname)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@ local function filename(options)
|
||||||
|
|
||||||
return function()
|
return function()
|
||||||
local data
|
local data
|
||||||
if shorten then
|
if not full_path then
|
||||||
data = vim.fn.expand('%:t')
|
data = vim.fn.expand('%:t')
|
||||||
elseif full_path then
|
elseif shorten then
|
||||||
data = vim.fn.expand('%:p')
|
|
||||||
else
|
|
||||||
data = vim.fn.expand('%')
|
data = vim.fn.expand('%')
|
||||||
|
else
|
||||||
|
data = vim.fn.expand('%:p')
|
||||||
end
|
end
|
||||||
if data == '' then
|
if data == '' then
|
||||||
data = '[No Name]'
|
data = '[No Name]'
|
||||||
|
|
Loading…
Reference in New Issue