diff --git a/README.md b/README.md index 524657db..99dc62a9 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,8 @@ require("oil").setup({ -- Sort file names in a more intuitive order for humans. Is less performant, -- so you may want to set to false if you work with large directories. natural_order = true, + -- Sort file and directory names case insensitive + case_insensitive = false, sort = { -- sort order can be "asc" or "desc" -- see :help oil-columns to see which columns are sortable diff --git a/doc/oil.txt b/doc/oil.txt index a10cd9fc..7f4bb22b 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -106,6 +106,8 @@ CONFIG *oil-confi -- Sort file names in a more intuitive order for humans. Is less performant, -- so you may want to set to false if you work with large directories. natural_order = true, + -- Sort file and directory names case insensitive + case_insensitive = false, sort = { -- sort order can be "asc" or "desc" -- see :help oil-columns to see which columns are sortable diff --git a/lua/oil/columns.lua b/lua/oil/columns.lua index 3bdd2869..453b4e76 100644 --- a/lua/oil/columns.lua +++ b/lua/oil/columns.lua @@ -300,11 +300,17 @@ M.register("name", { end, get_sort_value = function(entry) + local sort_value = entry[FIELD_NAME] + if config.view_options.natural_order then - return entry[FIELD_NAME]:gsub("%d+", pad_number) - else - return entry[FIELD_NAME] + sort_value = sort_value:gsub("%d+", pad_number) end + + if config.view_options.case_insensitive then + sort_value = sort_value:lower() + end + + return sort_value end, }) diff --git a/lua/oil/config.lua b/lua/oil/config.lua index e1dd9509..70357baf 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -91,6 +91,8 @@ local default_config = { -- Sort file names in a more intuitive order for humans. Is less performant, -- so you may want to set to false if you work with large directories. natural_order = true, + -- Sort file and directory names case insensitive + case_insensitive = false, sort = { -- sort order can be "asc" or "desc" -- see :help oil-columns to see which columns are sortable