repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim/lua/bugabinga/cmdline/format.lua

Raw
local icon = require 'std.icon'

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 }
    end
    if firstc == ':' then
      if content and (content:match '^lua%s+' or content:match '^=%s*' or content:match '^:%s*lua%s*=%s*') then
        return { type = 'lua', icon = icon.vim }
      end
      return { type = 'cmdline', icon = icon.command }
    end
    return { type = 'cmdline', icon = icon.command }
  end,
}