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 = { ["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 - ["hs"] = { - function() - require("gitsigns").stage_hunk() - end, - "Stage hunk", - }, - ["hr"] = { + ["rh"] = { function() require("gitsigns").reset_hunk() end, "Reset hunk", }, - ["hS"] = { - function() - require("gitsigns").stage_buffer() - end, - "Stage buffer", - }, - ["hu"] = { - function() - require("gitsigns").undo_stage_hunk() - end, - "Undo stage hunk", - }, - ["hR"] = { - function() - require("gitsigns").reset_buffer() - end, - "Reset buffer", - }, - ["hp"] = { + + ["ph"] = { function() require("gitsigns").preview_hunk() end, "Preview hunk", }, - ["hb"] = { + + ["gb"] = { function() - package.loaded.gitsigns.blame_line { full = true } + package.loaded.gitsigns.blame_line() end, "Blame line", }, - ["tb"] = { - function() - require("gitsigns").toggle_current_line_blame() - end, - "Toggle current line blame", - }, + ["td"] = { function() require("gitsigns").toggle_deleted() end, "Toggle deleted", }, - ["hd"] = { - function() - require("gitsigns").diffthis() - end, - "Diff against the index", - }, - ["hD"] = { - function() - require("gitsigns").diffthis "~" - end, - "Diff against the last commit", - }, - }, - v = { - -- Actions - ["hs"] = { - function() - require("gitsigns").stage_hunk() - end, - "Stage hunk", - }, - ["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