local icon = require 'std.icon' local HELP_PATTERNS = { '^h$', '^he$', '^hel$', '^help$', '^h%s', '^help%s' } return { detect = function(firstc, content, prompt) if prompt and prompt ~= '' then return { type = 'input', icon = icon.prompt_prefix } end if firstc == '/' then return { type = 'search_down', icon = icon.search } end if firstc == '?' then return { type = 'search_up', icon = icon.search_up } end if firstc == '!' or (firstc == ':' and content and content:match '^!') then return { type = 'shell', icon = icon.shell } end if firstc == ':' and content then for _, pat in ipairs(HELP_PATTERNS) do if content:match(pat) then return { type = 'help', icon = icon.help } end end if content:match '^lua%s*' or content:match '^=' then return { type = 'lua', icon = icon.vim } end return { type = 'cmdline', icon = icon.command } end return { type = 'cmdline', icon = icon.command } end, }