neovim: lazy load some plugins

This commit is contained in:
2022-09-23 21:04:14 +03:00
parent 9c7a090cc8
commit f359ffe0ce
4 changed files with 22 additions and 4 deletions

View File

@@ -1 +0,0 @@
require("nvim-autopairs").setup({})

View File

@@ -1,24 +0,0 @@
require("Comment").setup({
pre_hook = function(ctx)
-- Only calculate commentstring for tsx filetypes
if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then
local U = require("Comment.utils")
-- Detemine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.line and "__default" or "__multiline"
-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring({
key = type,
location = location,
})
end
end,
})

View File

@@ -1,53 +0,0 @@
local a = require("gitsigns.actions")
local reload_nvimtree = require("nvim-tree.actions.reloaders.reloaders").reload_explorer
require("gitsigns").setup({
signcolumn = true,
attach_to_untracked = false,
current_line_blame = true,
current_line_blame_opts = {
delay = 1000,
},
current_line_blame_formatter_opts = {
relative_time = true,
},
on_attach = function(bufnr)
vim.keymap.set("n", "<leader>gs", function()
a.stage_hunk()
reload_nvimtree()
end)
vim.keymap.set("n", "<leader>gu", function()
a.undo_stage_hunk()
reload_nvimtree()
end)
vim.keymap.set("n", "<leader>gr", function()
a.reset_hunk()
reload_nvimtree()
end)
vim.keymap.set("n", "<leader>gp", function()
a.preview_hunk()
reload_nvimtree()
end)
vim.keymap.set("n", "<leader>gn", function()
a.next_hunk()
reload_nvimtree()
end)
vim.keymap.set("n", "<leader>gN", function()
a.prev_hunk()
reload_nvimtree()
end)
vim.keymap.set("v", "gs", function()
a.stage_hunk()
reload_nvimtree()
end)
vim.keymap.set("v", "gu", function()
a.undo_stage_hunk()
reload_nvimtree()
end)
vim.keymap.set("v", "gr", function()
a.reset_hunk()
reload_nvimtree()
end)
end,
})