diff --git a/README.md b/README.md
index 4c0399871..3916143f8 100644
--- a/README.md
+++ b/README.md
@@ -644,6 +644,7 @@ sections = {
                                -- 2: Absolute path
                                -- 3: Absolute path, with tilde as the home directory
                                -- 4: Filename and parent dir, with tilde as the home directory
+      filename_map = nil       -- Add custom transformation to displayed filename
 
       shorting_target = 40,    -- Shortens path to leave 40 spaces in the window
                                -- for other components. (terrible name, any suggestions?)
diff --git a/doc/lualine.txt b/doc/lualine.txt
index ccc6ebede..0efdaf939 100644
--- a/doc/lualine.txt
+++ b/doc/lualine.txt
@@ -671,6 +671,7 @@ Component specific options             These are options that are available on
                                    -- 2: Absolute path
                                    -- 3: Absolute path, with tilde as the home directory
                                    -- 4: Filename and parent dir, with tilde as the home directory
+          filename_map = nil       -- Add custom transformation to displayed filename
     
           shorting_target = 40,    -- Shortens path to leave 40 spaces in the window
                                    -- for other components. (terrible name, any suggestions?)
diff --git a/lua/lualine/components/filename.lua b/lua/lualine/components/filename.lua
index 22fd964a6..d7806c0ee 100644
--- a/lua/lualine/components/filename.lua
+++ b/lua/lualine/components/filename.lua
@@ -17,6 +17,7 @@ local default_options = {
   newfile_status = false,
   path = 0,
   shorting_target = 40,
+  filename_map = nil
 }
 
 local function is_new_file()
@@ -98,6 +99,9 @@ M.update_status = function(self)
   end
 
   data = modules.utils.stl_escape(data)
+  if self.options.filename_map then
+      data = self.options.filename_map(data)
+  end
 
   local symbols = {}
   if self.options.file_status then