neovim: lazy load some plugins
This commit is contained in:
24
neovim/.config/nvim/lua/daniil/plugins/comment.lua
Normal file
24
neovim/.config/nvim/lua/daniil/plugins/comment.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
})
|
||||
53
neovim/.config/nvim/lua/daniil/plugins/gitsigns.lua
Normal file
53
neovim/.config/nvim/lua/daniil/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
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,
|
||||
})
|
||||
Reference in New Issue
Block a user