2021-02-15 18:09:12 +00:00
|
|
|
-- Copyright (c) 2020-2021 shadmansaleh
|
2021-02-13 00:03:57 +00:00
|
|
|
-- MIT license, see LICENSE for more details.
|
2021-09-25 17:15:42 +00:00
|
|
|
local M = require('lualine.component'):extend()
|
2021-04-11 08:20:41 +00:00
|
|
|
|
2021-09-03 18:20:34 +00:00
|
|
|
-- stylua: ignore
|
2021-10-26 21:04:53 +00:00
|
|
|
local symbols = {
|
2021-04-11 08:20:41 +00:00
|
|
|
unix = '', -- e712
|
2021-10-26 21:04:53 +00:00
|
|
|
dos = '', -- e70f
|
|
|
|
mac = '', -- e711
|
2021-04-11 08:20:41 +00:00
|
|
|
}
|
|
|
|
|
2021-10-26 21:04:53 +00:00
|
|
|
-- Initializer
|
|
|
|
function M:init(options)
|
|
|
|
-- Run super()
|
|
|
|
M.super.init(self, options)
|
|
|
|
-- Apply default symbols
|
|
|
|
self.symbols = vim.tbl_extend('keep', self.options.symbols or {}, symbols)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Function that runs everytime statusline is updated
|
|
|
|
function M:update_status()
|
|
|
|
local format = vim.bo.fileformat
|
|
|
|
if self.options.icons_enabled then
|
|
|
|
return self.symbols[format] or format
|
|
|
|
else
|
|
|
|
return format
|
2021-02-15 18:09:12 +00:00
|
|
|
end
|
2020-12-30 14:48:51 +00:00
|
|
|
end
|
|
|
|
|
2021-09-25 17:15:42 +00:00
|
|
|
return M
|