{
  "@cast (LuaDoc)": {
    "body": "---@cast ${1:var} ${2:type}",
    "prefix": "@cast (LuaDoc)"
  },
  "autocmd": {
    "body": [
      "vim.api.nvim_create_autocmd(\"${1:event}\", {",
      "\tcallback = function()",
      "\t\t$0",
      "\tend,",
      "})"
    ],
    "prefix": "autocmd"
  },
  "autocmd (Filetype)": {
    "body": [
      "vim.api.nvim_create_autocmd(\"FileType\", {",
      "\tpattern = \"${1:ft}\",",
      "\tcallback = function()",
      "\t\t$0",
      "\tend,",
      "})"
    ],
    "filetype": "lua",
    "prefix": "autocmd (Filetype)"
  },
  "check if file exists": {
    "body": "local fileExists = vim.loop.fs_stat(\"${1:filepath}\") ~= nil",
    "prefix": "check if file exists"
  },
  "dedent": {
    "body": [
      "---@param lines string[]",
      "---@return string[] dedentedLines",
      "function M.dedent(lines)",
      "\tlocal indentAmounts = vim.tbl_map(function(line) return #(line:match(\"^%s*\")) end, lines)",
      "\tlocal smallestIndent = math.min(unpack(indentAmounts))",
      "\tlocal dedentedLines = vim.tbl_map(function(line) return line:sub(smallestIndent + 1) end, lines)",
      "\treturn dedentedLines",
      "end"
    ],
    "prefix": "dedent"
  },
  "defer": {
    "body": [
      "vim.defer_fn(function ()",
      "\t$1",
      "end, ${2:1})"
    ],
    "filetype": "lua",
    "prefix": "defer"
  },
  "keymap": {
    "body": "keymap(\"n\", \"${1:lhs}\", \"${2:rhs}\", { desc = \"${3:description}\" })",
    "filetype": "lua",
    "prefix": "keymap"
  },
  "keymap (multi-mode)": {
    "body": "keymap({ \"n\", \"x\" }, \"${1:lhs}\", \"${2:rhs}\", { desc = \"${3:desc}\" })",
    "prefix": "keymap (multi-mode)"
  },
  "leave visual mode": {
    "body": [
      "local function leaveVisualMode()",
      "\tlocal escKey = vim.api.nvim_replace_termcodes(\"<Esc>\", false, true, true)",
      "\tvim.api.nvim_feedkeys(escKey, \"nx\", false)",
      "end"
    ],
    "prefix": "leave visual mode"
  },
  "plugin spec (lazy.nvim)": {
    "body": [
      "{",
      "\t\"$1\",",
      "\t${2|event = \"VeryLazy\",event = \"LspAttach\",lazy = true,cmd = \"\"|},",
      "\topts = {",
      "\t\t$0",
      "\t},",
      "},"
    ],
    "prefix": "plugin spec (lazy.nvim)"
  }
}
