keep some gitsigns mappings only | rm 0.7v related stuff

This commit is contained in:
siduck 2022-10-04 06:37:48 +05:30 committed by Sidhanth Rathod
parent b142f4c99d
commit 00be26275e
4 changed files with 14 additions and 99 deletions

View File

@ -229,7 +229,7 @@ M.lspconfig = {
["<leader>fm"] = { ["<leader>fm"] = {
function() function()
vim.lsp.buf.formatting {} vim.lsp.buf.format { async = true }
end, end,
"lsp formatting", "lsp formatting",
}, },
@ -408,7 +408,7 @@ M.gitsigns = {
plugin = true, plugin = true,
n = { n = {
-- Navigation -- Navigation through hunks
["]c"] = { ["]c"] = {
function() function()
if vim.wo.diff then if vim.wo.diff then
@ -422,6 +422,7 @@ M.gitsigns = {
"Jump to next hunk", "Jump to next hunk",
opts = { expr = true }, opts = { expr = true },
}, },
["[c"] = { ["[c"] = {
function() function()
if vim.wo.diff then if vim.wo.diff then
@ -437,103 +438,33 @@ M.gitsigns = {
}, },
-- Actions -- Actions
["<leader>hs"] = { ["<leader>rh"] = {
function()
require("gitsigns").stage_hunk()
end,
"Stage hunk",
},
["<leader>hr"] = {
function() function()
require("gitsigns").reset_hunk() require("gitsigns").reset_hunk()
end, end,
"Reset hunk", "Reset hunk",
}, },
["<leader>hS"] = {
function() ["<leader>ph"] = {
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"] = {
function() function()
require("gitsigns").preview_hunk() require("gitsigns").preview_hunk()
end, end,
"Preview hunk", "Preview hunk",
}, },
["<leader>hb"] = {
["<leader>gb"] = {
function() function()
package.loaded.gitsigns.blame_line { full = true } package.loaded.gitsigns.blame_line()
end, end,
"Blame line", "Blame line",
}, },
["<leader>tb"] = {
function()
require("gitsigns").toggle_current_line_blame()
end,
"Toggle current line blame",
},
["<leader>td"] = { ["<leader>td"] = {
function() function()
require("gitsigns").toggle_deleted() require("gitsigns").toggle_deleted()
end, end,
"Toggle deleted", "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 g = vim.g
local config = require("core.utils").load_config() local config = require("core.utils").load_config()
g.vim_version = vim.version().minor
g.nvchad_theme = config.ui.theme g.nvchad_theme = config.ui.theme
g.toggle_theme_icon = "" g.toggle_theme_icon = ""
g.transparency = config.ui.transparency g.transparency = config.ui.transparency
g.theme_switcher_loaded = false 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.laststatus = 3 -- global statusline
opt.showmode = false opt.showmode = false

View File

@ -13,15 +13,8 @@ local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs -- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
if vim.g.vim_version > 7 then client.server_capabilities.documentFormattingProvider = false
-- nightly client.server_capabilities.documentRangeFormattingProvider = false
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
utils.load_mappings("lspconfig", { buffer = bufnr }) utils.load_mappings("lspconfig", { buffer = bufnr })

View File

@ -217,9 +217,7 @@ if present then
-- load packer init options -- load packer init options
local init_options = require("plugins.configs.others").packer_init() local init_options = require("plugins.configs.others").packer_init()
init_options = require("core.utils").load_override(init_options, "wbthomason/packer.nvim") init_options = require("core.utils").load_override(init_options, "wbthomason/packer.nvim")
packer.init(init_options)
for _, v in pairs(plugins) do packer.init(init_options)
packer.use(v) packer.startup { plugins }
end
end end