From b0d6e153f7f97ca9936565ff313e443c0cb3882d Mon Sep 17 00:00:00 2001 From: kyazdani42 Date: Wed, 19 Feb 2020 18:11:09 +0100 Subject: [PATCH] easier regex matching --- lua/lib/format.lua | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/lua/lib/format.lua b/lua/lib/format.lua index 83f6d779..7fe1a7e4 100644 --- a/lua/lib/format.lua +++ b/lua/lib/format.lua @@ -83,31 +83,27 @@ local function format_tree(tree) end local HIGHLIGHT_GROUPS = { - ['^.*%.md$'] = 'MarkdownFile'; ['^LICENSE$'] = 'LicenseFile'; ['^%.?vimrc$'] = 'VimFile'; - ['^.*%.vim$'] = 'VimFile'; - ['^.*%.c$'] = 'CFile'; - ['^.*%.cpp$'] = 'CFile'; - ['^.*%.cxx$'] = 'CFile'; - ['^.*%.h$'] = 'CFile'; - ['^.*%.hpp$'] = 'CFile'; - ['^.*%.py$'] = 'PythonFile'; - ['^.*%.lua$'] = 'LuaFile'; - ['^.*%.rs$'] = 'RustFile'; - ['^.*%.sh$'] = 'ShellFile'; - ['^.*%.zsh$'] = 'ShellFile'; - ['^.*%.csh$'] = 'ShellFile'; - ['^.*%.rs$'] = 'RustFile'; - ['^.*%.js$'] = 'JavascriptFile'; - ['^.*%.json$'] = 'JsonFile'; - ['^.*%.toml$'] = 'TomlFile'; - ['^.*%.yml$'] = 'YamlFile'; - ['^.*%.gitignore$'] = 'GitignoreFile'; - ['^.*%.ts$'] = 'TypescriptFile'; - ['^.*%.jsx$'] = 'ReactFile'; - ['^.*%.tsx$'] = 'ReactFile'; - ['^.*%.html?$'] = 'HtmlFile'; + ['%.vim$'] = 'VimFile'; + ['%.c$'] = 'CFile'; + ['%.cpp$'] = 'CFile'; + ['%.cxx$'] = 'CFile'; + ['%.h$'] = 'CFile'; + ['%.hpp$'] = 'CFile'; + ['%.py$'] = 'PythonFile'; + ['%.lua$'] = 'LuaFile'; + ['%.rs$'] = 'RustFile'; + ['%.[cz]?sh$'] = 'ShellFile'; + ['%.md$'] = 'MarkdownFile'; + ['%.json$'] = 'JsonFile'; + ['%.toml$'] = 'TomlFile'; + ['%.yml$'] = 'YamlFile'; + ['%.gitignore$'] = 'GitignoreFile'; + ['%.js$'] = 'JavascriptFile'; + ['%.ts$'] = 'TypescriptFile'; + ['%.[tj]sx$'] = 'ReactFile'; + ['%.html?$'] = 'HtmlFile'; } local function highlight_line(buffer)