From 00be26275ecd017427840a7c01617d2fe686582c Mon Sep 17 00:00:00 2001
From: siduck <siduck@tutanota.com>
Date: Tue, 4 Oct 2022 06:37:48 +0530
Subject: [PATCH] keep some gitsigns mappings only | rm 0.7v related stuff

---
 lua/core/mappings.lua             | 89 ++++---------------------------
 lua/core/options.lua              |  7 ---
 lua/plugins/configs/lspconfig.lua | 11 +---
 lua/plugins/init.lua              |  6 +--
 4 files changed, 14 insertions(+), 99 deletions(-)

diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua
index 2c83041..184a8c1 100644
--- a/lua/core/mappings.lua
+++ b/lua/core/mappings.lua
@@ -229,7 +229,7 @@ M.lspconfig = {
 
     ["<leader>fm"] = {
       function()
-        vim.lsp.buf.formatting {}
+        vim.lsp.buf.format { async = true }
       end,
       "lsp formatting",
     },
@@ -408,7 +408,7 @@ M.gitsigns = {
   plugin = true,
 
   n = {
-    -- Navigation
+    -- Navigation through hunks
     ["]c"] = {
       function()
         if vim.wo.diff then
@@ -422,6 +422,7 @@ M.gitsigns = {
       "Jump to next hunk",
       opts = { expr = true },
     },
+
     ["[c"] = {
       function()
         if vim.wo.diff then
@@ -437,103 +438,33 @@ M.gitsigns = {
     },
 
     -- Actions
-    ["<leader>hs"] = {
-      function()
-        require("gitsigns").stage_hunk()
-      end,
-    "Stage hunk",
-    },
-    ["<leader>hr"] = {
+    ["<leader>rh"] = {
       function()
         require("gitsigns").reset_hunk()
       end,
       "Reset hunk",
     },
-    ["<leader>hS"] = {
-      function()
-        require("gitsigns").stage_buffer()
-      end,
-      "Stage buffer",
-    },
-    ["<leader>hu"] = {
-      function()
-        require("gitsigns").undo_stage_hunk()
-      end,
-      "Undo stage hunk",
-    },
-    ["<leader>hR"] = {
-      function()
-        require("gitsigns").reset_buffer()
-      end,
-      "Reset buffer",
-    },
-    ["<leader>hp"] = {
+
+    ["<leader>ph"] = {
       function()
         require("gitsigns").preview_hunk()
       end,
       "Preview hunk",
     },
-    ["<leader>hb"] = {
+
+    ["<leader>gb"] = {
       function()
-        package.loaded.gitsigns.blame_line { full = true }
+        package.loaded.gitsigns.blame_line()
       end,
       "Blame line",
     },
-    ["<leader>tb"] = {
-      function()
-        require("gitsigns").toggle_current_line_blame()
-      end,
-      "Toggle current line blame",
-    },
+
     ["<leader>td"] = {
       function()
         require("gitsigns").toggle_deleted()
       end,
       "Toggle deleted",
     },
-    ["<leader>hd"] = {
-      function()
-        require("gitsigns").diffthis()
-      end,
-      "Diff against the index",
-    },
-    ["<leader>hD"] = {
-      function()
-        require("gitsigns").diffthis "~"
-      end,
-      "Diff against the last commit",
-    },
-  },
-  v = {
-    -- Actions
-    ["<leader>hs"] = {
-      function()
-        require("gitsigns").stage_hunk()
-      end,
-      "Stage hunk",
-    },
-    ["<leader>hr"] = {
-      function ()
-        require("gitsigns").reset_hunk()
-      end,
-      "Reset hunk",
-    },
-  },
-  x = {
-    ["ih"] = {
-      function ()
-        require("gitsigns").select_hunk()
-      end,
-      "Reset hunk",
-    },
-  },
-  o = {
-    ["ih"] = {
-      function ()
-        require("gitsigns").select_hunk()
-      end,
-      "Reset hunk",
-    },
   },
 }
 
diff --git a/lua/core/options.lua b/lua/core/options.lua
index c2a8832..a097cd7 100644
--- a/lua/core/options.lua
+++ b/lua/core/options.lua
@@ -2,18 +2,11 @@ local opt = vim.opt
 local g = vim.g
 local config = require("core.utils").load_config()
 
-g.vim_version = vim.version().minor
 g.nvchad_theme = config.ui.theme
 g.toggle_theme_icon = "   "
 g.transparency = config.ui.transparency
 g.theme_switcher_loaded = false
 
--- use filetype.lua instead of filetype.vim. it's enabled by default in neovim 0.8 (nightly)
-if g.vim_version < 8 then
-  g.did_load_filetypes = 0
-  g.do_filetype_lua = 1
-end
-
 opt.laststatus = 3 -- global statusline
 opt.showmode = false
 
diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua
index 0c16830..2f87926 100644
--- a/lua/plugins/configs/lspconfig.lua
+++ b/lua/plugins/configs/lspconfig.lua
@@ -13,15 +13,8 @@ local utils = require "core.utils"
 -- export on_attach & capabilities for custom lspconfigs
 
 M.on_attach = function(client, bufnr)
-  if vim.g.vim_version > 7 then
-    -- nightly
-    client.server_capabilities.documentFormattingProvider = false
-    client.server_capabilities.documentRangeFormattingProvider = false
-  else
-    -- stable
-    client.resolved_capabilities.document_formatting = false
-    client.resolved_capabilities.document_range_formatting = false
-  end
+  client.server_capabilities.documentFormattingProvider = false
+  client.server_capabilities.documentRangeFormattingProvider = false
 
   utils.load_mappings("lspconfig", { buffer = bufnr })
 
diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua
index 1cc7f82..778efd5 100644
--- a/lua/plugins/init.lua
+++ b/lua/plugins/init.lua
@@ -217,9 +217,7 @@ if present then
   -- load packer init options
   local init_options = require("plugins.configs.others").packer_init()
   init_options = require("core.utils").load_override(init_options, "wbthomason/packer.nvim")
-  packer.init(init_options)
 
-  for _, v in pairs(plugins) do
-    packer.use(v)
-  end
+  packer.init(init_options)
+  packer.startup { plugins }
 end