diff --git a/doc/hardtime.nvim.txt b/doc/hardtime.nvim.txt index 007bc61..dc05b61 100644 --- a/doc/hardtime.nvim.txt +++ b/doc/hardtime.nvim.txt @@ -97,7 +97,7 @@ Example: >lua -- Add "oil" to the disabled_filetypes - disabled_filetypes = { "qf", "netrw", "NvimTree", "lazy", "mason", "oil" }, + disabled_filetypes = { "qf", "netrw", "NvimTree", "lazy", "mason", "oil", "Neogit*" }, < If the option is a table with a `key = value` pair, your value will overwrite diff --git a/lua/hardtime/config.lua b/lua/hardtime/config.lua index 9857915..79dc376 100644 --- a/lua/hardtime/config.lua +++ b/lua/hardtime/config.lua @@ -70,23 +70,15 @@ M.config = { "aerial", "alpha", "checkhealth", - "dapui-repl", - "dapui_breakpoints", - "dapui_console", - "dapui_scopes", - "dapui_stacks", - "dapui_watches", - "DressingInput", - "DressingSelect", + "dapui*", + "Dressing*", "help", "lazy", - "NeogitStatus", - "NeogitLogView", + "Neogit*", "mason", "neotest-summary", "minifiles", - "neo-tree", - "neo-tree-popup", + "neo-tree*", "netrw", "noice", "notify", diff --git a/lua/hardtime/init.lua b/lua/hardtime/init.lua index b5f0cbd..9711666 100644 --- a/lua/hardtime/init.lua +++ b/lua/hardtime/init.lua @@ -25,8 +25,20 @@ local function get_return_key(key) return key end +local function match_filetype(ft) + for _, value in pairs(config.disabled_filetypes) do + local matcher = "^" .. value .. (value:sub(-1) == "*" and "" or "$") + if ft:match(matcher) then + return true + end + end + + return false +end + local function should_disable() return vim.tbl_contains(config.disabled_filetypes, vim.bo.ft) + or match_filetype(vim.bo.ft) or vim.api.nvim_buf_get_option(0, "buftype") == "terminal" or vim.fn.reg_executing() ~= "" or vim.fn.reg_recording() ~= ""