return{"\108\101\119\105\115\054\057\057\049\047\103\105\116\115\105\103\110\115\046\110\118\105\109",version="\042",event="\086\101\114\121\076\097\122\121",opts={on_attach=function(W)local d=require("\103\105\116\115\105\103\110\115")vim.keymap.set("\110","\093\099",function()if vim.wo.diff then return"\093\099"end vim.schedule(d.next_hunk)return"\060\073\103\110\111\114\101\062"end,{buffer=W;expr=true;noremap=false})vim.keymap.set("\110","\091\099",function()if vim.wo.diff then return"\091\099"end vim.schedule(d.prev_hunk)return"\060\073\103\110\111\114\101\062"end,{buffer=W;expr=true,noremap=false})vim.keymap.set("\110","\060\108\101\097\100\101\114\062\104\114",function()vim.schedule(d.reset_hunk)end,{desc="\082\101\115\101\116 \103\105\116 \104\117\110\107";buffer=W})vim.keymap.set("\118","\060\108\101\097\100\101\114\062\104\114",function()vim.schedule(function()d.reset_hunk({vim.fn.line("\046"),vim.fn.line("\118")})end)end,{desc="\082\101\115\101\116 \103\105\116 \104\117\110\107",buffer=W})vim.keymap.set("\110","\060\108\101\097\100\101\114\062\104\112",function()vim.schedule(d.preview_hunk)end,{desc="\080\114\101\118\105\101\119 \103\105\116 \104\117\110\107";buffer=W})vim.keymap.set("\110","\060\108\101\097\100\101\114\062\104\116",function()vim.schedule(d.toggle_current_line_blame)end,{desc="\084\111\103\103\108\101 \103\105\116 \098\108\097\109\101 \108\105\110\101";buffer=W})vim.keymap.set("\110","\060\108\101\097\100\101\114\062\104\098",function()vim.schedule(function()d.blame_line({full=true,ignore_whitespace=true})end)end,{desc="\071\105\116 \098\108\097\109\101 \116\104\105\115 \108\105\110\101",buffer=W})vim.keymap.set("\110","\060\108\101\097\100\101\114\062\104\100",d.toggle_deleted,{desc="\084\111\103\103\108\101 \100\101\108\101\116\101\100 \108\105\110\101\115";buffer=W})end}}
-- git integration
-- https://github.com/lewis6991/gitsigns.nvim

return {
  "lewis6991/gitsigns.nvim",
  version = "*",
  event = "VeryLazy",

  opts = {
    on_attach = function(bufnr)
      local gitsigns = require("gitsigns")

      vim.keymap.set("n", "]c", function()
        if vim.wo.diff then
          return "]c"
        end

        vim.schedule(gitsigns.next_hunk)

        return "<Ignore>"
      end, {
        buffer = bufnr,
        expr = true,
        noremap = false,
      })
      vim.keymap.set("n", "[c", function()
        if vim.wo.diff then
          return "[c"
        end

        vim.schedule(gitsigns.prev_hunk)

        return "<Ignore>"
      end, {
        buffer = bufnr,
        expr = true,
        noremap = false,
      })

      vim.keymap.set("n", "<leader>hr", function()
        vim.schedule(gitsigns.reset_hunk)
      end, { desc = "Reset git hunk", buffer = bufnr })

      vim.keymap.set("v", "<leader>hr", function()
        vim.schedule(function()
          gitsigns.reset_hunk({
            vim.fn.line("."),
            vim.fn.line("v"),
          })
        end)
      end, { desc = "Reset git hunk", buffer = bufnr })

      vim.keymap.set("n", "<leader>hp", function()
        vim.schedule(gitsigns.preview_hunk)
      end, { desc = "Preview git hunk", buffer = bufnr })

      vim.keymap.set("n", "<leader>ht", function()
        vim.schedule(gitsigns.toggle_current_line_blame)
      end, { desc = "Toggle git blame line", buffer = bufnr })

      vim.keymap.set("n", "<leader>hb", function()
        vim.schedule(function()
          gitsigns.blame_line({
            full = true,
            ignore_whitespace = true,
          })
        end)
      end, { desc = "Git blame this line", buffer = bufnr })

      vim.keymap.set(
        "n",
        "<leader>hd",
        gitsigns.toggle_deleted,
        { desc = "Toggle deleted lines", buffer = bufnr }
      )
    end,
  },
}
