keep some gitsigns mappings only | rm 0.7v related stuff

This commit is contained in:
siduck 2022-10-04 06:37:48 +05:30
parent 21e9e3cb09
commit 1f34e72aff
4 changed files with 14 additions and 99 deletions

View file

@ -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",
},
},
}

View file

@ -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

View file

@ -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 })

View file

@ -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