-- fzf-lua configuration with bearded-arc colors

require("fzf-lua").setup({
  "default-title",
  winopts = {
    height = 0.85,
    width = 0.80,
    row = 0.35,
    col = 0.50,
    border = "rounded",
    preview = {
      border = "rounded",
      wrap = "nowrap",
      hidden = "nohidden",
      vertical = "down:45%",
      horizontal = "right:60%",
      layout = "flex",
      flip_columns = 120,
      scrollbar = "float",
    },
  },
  fzf_opts = {
    ["--no-scrollbar"] = true,
    ["--info"] = "inline-right",
  },
  keymap = {
    builtin = {
      ["<C-d>"] = "preview-page-down",
      ["<C-u>"] = "preview-page-up",
    },
    fzf = {
      ["ctrl-q"] = "select-all+accept",
      ["tab"] = "down",
      ["shift-tab"] = "up",
    },
  },
  files = {
    prompt = "Files❯ ",
    file_icons = true,
    git_icons = false,
    fd_opts = [[--color=never --type f --hidden --follow --exclude .git --exclude node_modules]],
    file_ignore_patterns = {"%.git$", "%.xml$" },
  },
  grep = {
    prompt = "Grep❯ ",
    input_prompt = "Grep For❯ ",
    file_icons = true,
    git_icons = false,
    rg_opts = "--column --line-number --no-heading --color=always --smart-case --max-columns=4096 -e",
  },
  oldfiles = {
    prompt = "History❯ ",
    cwd_only = false,
    stat_file = true,
    include_current_session = true,
  },
  buffers = {
    prompt = "Buffers❯ ",
    file_icons = true,
    color_icons = true,
    sort_lastused = true,
  },
  lsp = {
    prompt_postfix = "❯ ",
    file_icons = true,
    git_icons = false,
    lsp_icons = true,
    symbols = {
      prompt = "Symbols❯ ",
      async = true,
      symbol_icons = {
        File = " ",
        Module = " ",
        Namespace = " ",
        Package = " ",
        Class = " ",
        Method = " ",
        Property = " ",
        Field = " ",
        Constructor = " ",
        Enum = " ",
        Interface = " ",
        Function = " ",
        Variable = " ",
        Constant = " ",
        String = " ",
        Number = " ",
        Boolean = " ",
        Array = " ",
        Object = " ",
        Key = " ",
        Null = " ",
        EnumMember = " ",
        Struct = " ",
        Event = " ",
        Operator = " ",
        TypeParameter = " ",
      },
    },
  },
  diagnostics = {
    prompt = "Diagnostics❯ ",
    file_icons = true,
    git_icons = false,
    diag_icons = true,
    icon_padding = " ",
    severity_sort = true,
    severity_limit = nil,
    severity_bound = nil,
    fzf_opts = {
      ["--tiebreak"] = "index",
    },
    signs = {
      ["Error"] = { text = " ", texthl = "DiagnosticError" },
      ["Warn"]  = { text = " ", texthl = "DiagnosticWarn" },
      ["Info"]  = { text = " ", texthl = "DiagnosticInfo" },
      ["Hint"]  = { text = " ", texthl = "DiagnosticHint" },
    },
  },
})
