| 1 |
-- Copyright (c) 2020-2021 shadmansaleh |
| 2 |
-- MIT license, see LICENSE for more details. |
| 3 |
local M = require('lualine.component'):extend() |
| 4 |
|
| 5 |
-- stylua: ignore |
| 6 |
local symbols = { |
| 7 |
unix = '', -- e712 |
| 8 |
dos = '', -- e70f |
| 9 |
mac = '', -- e711 |
| 10 |
} |
| 11 |
|
| 12 |
-- Initializer |
| 13 |
function M:init(options) |
| 14 |
-- Run super() |
| 15 |
M.super.init(self, options) |
| 16 |
-- Apply default symbols |
| 17 |
self.symbols = vim.tbl_extend('keep', self.options.symbols or {}, symbols) |
| 18 |
end |
| 19 |
|
| 20 |
-- Function that runs every time statusline is updated |
| 21 |
function M:update_status() |
| 22 |
local format = vim.bo.fileformat |
| 23 |
if self.options.icons_enabled then |
| 24 |
return self.symbols[format] or format |
| 25 |
else |
| 26 |
return format |
| 27 |
end |
| 28 |
end |
| 29 |
|
| 30 |
return M |