require("mime-ext"):setup({
  -- with_files = {
  -- 	tex = "text/makefile",
  -- },

  with_exts = {
    tex = "text/makefile",
  },
})

require("full-border"):setup({
  -- Available values: ui.Border.PLAIN, ui.Border.ROUNDED
  type = ui.Border.ROUNDED,
})
-- git-yazi plugin
-- th.git = th.git or {}
-- th.git.modified = ui.Style():fg("blue")
-- th.git.deleted = ui.Style():fg("red"):bold()
require("git"):setup()
-- whoosh plugin
-- You can configure your bookmarks using simplified syntax
-- local bookmarks = {
-- { tag = "Documents", path = "~/Documents", key = "D" },
-- }

-- You can also configure bookmarks with key arrays
-- local bookmarks = {
-- { tag = "Desktop", path = "~/Desktop", key = { "d", "D" } },
-- { tag = "Documents", path = "~/Documents", key = { "d", "d" } },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- }
require("whoosh"):setup({
  -- Configuration bookmarks (cannot be deleted through plugin)
  bookmarks = bookmarks,

  -- Notification settings
  jump_notify = false,

  -- Key generation for auto-assigning bookmark keys
  keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",

  -- Configure the built-in menu action hotkeys
  -- false - hide menu item
  special_keys = {
    create_temp = "<Enter>", -- Create a temporary bookmark from the menu
    fuzzy_search = "<Space>", -- Launch fuzzy search (fzf)
    history = "<Tab>", -- Open directory history
    previous_dir = "<Backspace>", -- Jump back to the previous directory
  },

  -- File path for storing user bookmarks
  bookmarks_path = (
    ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\plugins\\whoosh.yazi\\bookmarks"
  ) or (os.getenv("HOME") .. "/.config/yazi/plugins/whoosh.yazi/bookmarks"),

  -- Replace home directory with "~"
  home_alias_enabled = true, -- Toggle home aliasing in displays

  -- Path truncation in navigation menu
  path_truncate_enabled = false, -- Enable/disable path truncation
  path_max_depth = 3, -- Maximum path depth before truncation

  -- Path truncation in fuzzy search (fzf)
  fzf_path_truncate_enabled = false, -- Enable/disable path truncation in fzf
  fzf_path_max_depth = 5, -- Maximum path depth before truncation in fzf

  -- Long folder name truncation
  path_truncate_long_names_enabled = false, -- Enable in navigation menu
  fzf_path_truncate_long_names_enabled = false, -- Enable in fzf
  path_max_folder_name_length = 20, -- Max length in navigation menu
  fzf_path_max_folder_name_length = 20, -- Max length in fzf

  -- History directory settings
  history_size = 10, -- Number of directories in history (default 10)
  history_fzf_path_truncate_enabled = false, -- Enable/disable path truncation by depth for history
  history_fzf_path_max_depth = 5, -- Maximum path depth before truncation for history (default 5)
  history_fzf_path_truncate_long_names_enabled = false, -- Enable/disable long folder name truncation for history
  history_fzf_path_max_folder_name_length = 30, -- Maximum length for folder names in history (default 30)
})

-- projetc plugin
require("projects"):setup({
  event = {
    save = {
      enable = true,
      name = "project-saved",
    },
    load = {
      enable = true,
      name = "project-loaded",
    },
    delete = {
      enable = true,
      name = "project-deleted",
    },
    delete_all = {
      enable = true,
      name = "project-deleted-all",
    },
    merge = {
      enable = true,
      name = "project-merged",
    },
  },
  save = {
    method = "yazi", -- yazi | lua
    yazi_load_event = "@projects-load", -- event name when loading projects in `yazi` method
    lua_save_path = "", -- path of saved file in `lua` method, comment out or assign explicitly
    -- default value:
    -- windows: "%APPDATA%/yazi/state/projects.json"
    -- unix: "~/.local/state/yazi/projects.json"
  },
  last = {
    update_after_save = true,
    update_after_load = true,
    update_before_quit = false,
    load_after_start = false,
  },
  merge = {
    event = "projects-merge",
    quit_after_merge = false,
  },
  notify = {
    enable = true,
    title = "Projects",
    timeout = 3,
    level = "info",
  },
})

-- yafg plugin
require("yafg"):setup({
  editor = "nvim", -- Editor command (default: "hx")
  args = { "--noplugin" }, -- Additional editor arguments (default: {})
  file_arg_format = "+{row} {file}", -- File argument format (default: "{file}:{row}:{col}")
})

require("simple-tag"):setup({
  -- UI display mode (icon, text, hidden)
  ui_mode = "icon", -- (Optional)

  -- Disable tag key hints (popup in bottom right corner)
  hints_disabled = false, -- (Optional)

  -- linemode order: adjusts icon/text position. For example, if you want icon to be on the most left of linemode then set linemode_order larger than 1000.
  -- More info: https://github.com/sxyazi/yazi/blob/077faacc9a84bb5a06c5a8185a71405b0cb3dc8a/yazi-plugin/preset/components/linemode.lua#L4-L5
  linemode_order = 500, -- (Optional)

  -- You can backup/restore this folder within the same OS (Linux, windows, or MacOS).
  -- But you can't restore backed up folder in the different OS because they use difference absolute path.
  -- save_path =  -- full path to save tags folder (Optional)
  --       - Linux/MacOS: os.getenv("HOME") .. "/.config/yazi/tags"
  --       - Windows: os.getenv("APPDATA") .. "\\yazi\\config\\tags"

  -- Set tag colors
  colors = { -- (Optional)
    -- Set this same value with `theme.toml` > [mgr] > hovered > reversed
    -- Default theme use "reversed = true".
    -- More info: https://github.com/sxyazi/yazi/blob/077faacc9a84bb5a06c5a8185a71405b0cb3dc8a/yazi-config/preset/theme-dark.toml#L25
    reversed = true, -- (Optional)

    -- More colors: https://yazi-rs.github.io/docs/configuration/theme#types.color
    -- format: [tag key] = "color"
    ["*"] = "#bf68d9", -- (Optional)
    ["$"] = "green",
    ["!"] = "#cc9057",
    ["1"] = "cyan",
    ["p"] = "red",
  },

  -- Set tag icons. Only show when ui_mode = "icon".
  -- Any text or nerdfont icons should work as long as you use nerdfont to render yazi.
  -- Default icon from mactag.yazi: ●; Some generic icons: , , 󱈤
  -- More icon from nerd fonts: https://www.nerdfonts.com/cheat-sheet
  icons = { -- (Optional)
    -- default icon
    default = "󰚋",

    -- format: [tag key] = "tag icon"
    ["*"] = "*",
    ["$"] = "",
    ["!"] = "",
    ["p"] = "",
  },
})
require("yaziline"):setup({
  color = "#f9e2af",
  secondary_color = "#5A6078",
  default_files_color = "darkgray", -- color of the file counter when it's inactive
  selected_files_color = "white",
  yanked_files_color = "blue",
  cut_files_color = "red",

  separator_style = "angly", -- "angly" | "curvy" | "liney" | "empty"
  separator_open = "",
  separator_close = "",
  separator_open_thin = "",
  separator_close_thin = "",
  separator_head = "",
  separator_tail = "",

  select_symbol = "",
  yank_symbol = "󰆐",

  filename_max_length = 24, -- truncate when filename > 24
  filename_truncate_length = 6, -- leave 6 chars on both sides
  filename_truncate_separator = "...",
})
-- require("omp"):setup({
--   config = "/home/liph/.config/ohmyposh/yazi-zen.json",
-- })
