local M = {}

M.set_keymaps_ft = function()
    vim.api.nvim_create_autocmd("FileType", {
        pattern = { "netrw" },
        callback = function()
            vim.opt_local.statuscolumn = ""
        end,
        group = "LvimIDE",
    })
    vim.api.nvim_create_autocmd("FileType", {
        pattern = {
            "dart",
        },
        callback = function()
            vim.keymap.set("n", "<C-c><C-c>f", function()
                vim.cmd("FlutterRun")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterRun" })
            vim.keymap.set("n", "<C-c><C-c>r", function()
                vim.cmd("FlutterReload")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterReload" })
            vim.keymap.set("n", "<C-c><C-c>R", function()
                vim.cmd("FlutterRestart")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterRestart" })
            vim.keymap.set("n", "<C-c><C-c>q", function()
                vim.cmd("FlutterQuit")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterQuit" })
            vim.keymap.set("n", "<C-c><C-c>d", function()
                vim.cmd("FlutterDevices")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterDevices" })
            vim.keymap.set("n", "<C-c><C-c>m", function()
                vim.cmd("FlutterEmulators")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterEmulators" })
            vim.keymap.set("n", "<C-c><C-c>o", function()
                vim.cmd("FlutterOutlineToggle")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterOutlineToggle" })
            vim.keymap.set("n", "<C-c><C-c>t", function()
                vim.cmd("FlutterDevTools")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterDevTools" })
            vim.keymap.set("n", "<C-c><C-c>T", function()
                vim.cmd("FlutterDevToolsActivate")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterDevToolsActivate" })
            vim.keymap.set("n", "<C-c><C-c>l", function()
                vim.cmd("FlutterLspRestart")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterLspRestart" })
            vim.keymap.set("n", "<C-c><C-c>a", function()
                vim.cmd("FlutterReanalyze")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterReanalyze" })
            vim.keymap.set("n", "<C-c><C-c>e", function()
                vim.cmd("FlutterRename")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterRename" })
            vim.keymap.set("n", "<C-c><C-c>s", function()
                vim.cmd("FlutterSuper")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterSuper" })
            vim.keymap.set("n", "<C-c><C-c>D", function()
                vim.cmd("FlutterDetach")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterDetach" })
            vim.keymap.set("n", "<C-c><C-c>u", function()
                vim.cmd("FlutterCopyProfilerUrl")
            end, { buffer = true, noremap = true, silent = true, desc = "FlutterCopyProfilerUrl" })
        end,
        group = "LvimIDE",
    })
    vim.api.nvim_create_autocmd("FileType", {
        pattern = {
            "tex",
        },
        callback = function()
            vim.keymap.set("n", "<C-c><C-c>c", function()
                vim.cmd("VimtexCompile")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCompile" })
            vim.keymap.set("n", "<C-c><C-c>g", function()
                vim.cmd("VimtexCompileSS")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCompileSS" })
            vim.keymap.set("n", "<C-c><C-c>C", function()
                vim.cmd("VimtexCompileSelected")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCompileSelected" })
            vim.keymap.set("n", "<C-c><C-c>o", function()
                vim.cmd("VimtexCompileOutput")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCompileOutput" })
            vim.keymap.set("n", "<C-c><C-c>s", function()
                vim.cmd("VimtexStop")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexStop" })
            vim.keymap.set("n", "<C-c><C-c>S", function()
                vim.cmd("VimtexStopAll")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexStopAll" })
            vim.keymap.set("n", "<C-c><C-c>r", function()
                vim.cmd("VimtexReload")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexReload" })
            vim.keymap.set("n", "<C-c><C-c>R", function()
                vim.cmd("VimtexReloadState")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexReloadState" })
            vim.keymap.set("n", "<C-c><C-c>w", function()
                vim.cmd("VimtexCountWords")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCountWords" })
            vim.keymap.set("n", "<C-c><C-c>W", function()
                vim.cmd("VimtexCountWords!")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCountWords!" })
            vim.keymap.set("n", "<C-c><C-c>t", function()
                vim.cmd("VimtexCountLetters")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCountLetters" })
            vim.keymap.set("n", "<C-c><C-c>T", function()
                vim.cmd("VimtexCountLetters!")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexCountLetters!" })
            vim.keymap.set("n", "<C-c><C-c>f", function()
                vim.cmd("VimtexInfo")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexInfo" })
            vim.keymap.set("n", "<C-c><C-c>F", function()
                vim.cmd("VimtexInfo!")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexInfo!" })
            vim.keymap.set("n", "<C-c><C-c>u", function()
                vim.cmd("VimtexStatus")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexStatus" })
            vim.keymap.set("n", "<C-c><C-c>U", function()
                vim.cmd("VimtexStatus!")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexStatus!" })
            vim.keymap.set("n", "<C-c><C-c>x", function()
                vim.cmd("VimtexClean")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexClean" })
            vim.keymap.set("n", "<C-c><C-c>X", function()
                vim.cmd("VimtexClean!")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexClean!" })
            vim.keymap.set("n", "<C-c><C-c>m", function()
                vim.cmd("VimtexLog")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexLog" })
            vim.keymap.set("n", "<C-c><C-c>e", function()
                vim.cmd("VimtexErrors")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexErrors" })
            vim.keymap.set("n", "<C-c><C-c>K", function()
                vim.cmd("VimtexTocToggle")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexTocToggle" })
            vim.keymap.set("n", "<C-c><C-c>d", function()
                vim.cmd("VimtexDocPackage")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexDocPackage" })
            vim.keymap.set("n", "<C-c><C-c>n", function()
                vim.cmd("VimtexToggleMain")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexToggleMain" })
            vim.keymap.set("n", "<C-c><C-c>p", function()
                vim.cmd("VimtexImapsList")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexImapsList" })
            vim.keymap.set("n", "<C-c><C-c>v", function()
                vim.cmd("VimtexView")
            end, { buffer = true, noremap = true, silent = true, desc = "VimtexView" })
        end,
        group = "LvimIDE",
    })
end

return M
