mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-27 19:49:48 +01:00
f9789432f9
* modules: switch to gerg's neovim-wrapper * modules: use initViml instead of writing the file * treewide: make the entire generated config lua based * docs: remove mentions of configRC * plugins/treesitter: remove vim.cmd hack * treewide: move resolveDag to lib * modules/wrapper(rc): fix typo * treewide: migrate to pluginRC for correct DAG order The "new" DAG order is as follows: - (luaConfigPre) - globalsScript - basic - theme - pluginConfigs - extraPluginConfigs - mappings - (luaConfigPost) * plugins/theme: fix theme DAG place * plugins/theme: fix fixed theme DAG place * modules/wrapper(rc): add removed option module for configRC * docs: add dag-entries chapter, add release note entry * fix: formatting CI * languages/nix: add missing `local` * docs: fix page link * docs: add mention of breaking changes at the start of the release notes * plugins/neo-tree: convert to pluginRC * modules/wrapper(rc): add back entryAnywhere * modules/wrapper(rc): expose pluginRC * apply raf patch --------- Co-authored-by: NotAShelf <raf@notashelf.dev>
88 lines
3.1 KiB
Nix
88 lines
3.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (builtins) toJSON;
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
cfg = config.vim.git.gitsigns;
|
|
|
|
self = import ./gitsigns.nix {inherit lib config;};
|
|
gsMappingDefinitions = self.options.vim.git.gitsigns.mappings;
|
|
|
|
gsMappings = addDescriptionsToMappings cfg.mappings gsMappingDefinitions;
|
|
in {
|
|
config = mkIf cfg.enable (mkMerge [
|
|
{
|
|
vim = {
|
|
startPlugins = ["gitsigns-nvim"];
|
|
|
|
maps = {
|
|
normal = mkMerge [
|
|
(mkSetExprBinding gsMappings.nextHunk ''
|
|
function()
|
|
if vim.wo.diff then return ${toJSON gsMappings.nextHunk.value} end
|
|
|
|
vim.schedule(function() package.loaded.gitsigns.next_hunk() end)
|
|
|
|
return '<Ignore>'
|
|
end
|
|
'')
|
|
(mkSetExprBinding gsMappings.previousHunk ''
|
|
function()
|
|
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
|
|
|
vim.schedule(function() package.loaded.gitsigns.prev_hunk() end)
|
|
|
|
return '<Ignore>'
|
|
end
|
|
'')
|
|
|
|
(mkSetLuaBinding gsMappings.stageHunk "package.loaded.gitsigns.stage_hunk")
|
|
(mkSetLuaBinding gsMappings.resetHunk "package.loaded.gitsigns.reset_hunk")
|
|
(mkSetLuaBinding gsMappings.undoStageHunk "package.loaded.gitsigns.undo_stage_hunk")
|
|
|
|
(mkSetLuaBinding gsMappings.stageBuffer "package.loaded.gitsigns.stage_buffer")
|
|
(mkSetLuaBinding gsMappings.resetBuffer "package.loaded.gitsigns.reset_buffer")
|
|
|
|
(mkSetLuaBinding gsMappings.previewHunk "package.loaded.gitsigns.preview_hunk")
|
|
|
|
(mkSetLuaBinding gsMappings.blameLine "function() package.loaded.gitsigns.blame_line{full=true} end")
|
|
(mkSetLuaBinding gsMappings.toggleBlame "package.loaded.gitsigns.toggle_current_line_blame")
|
|
|
|
(mkSetLuaBinding gsMappings.diffThis "package.loaded.gitsigns.diffthis")
|
|
(mkSetLuaBinding gsMappings.diffProject "function() package.loaded.gitsigns.diffthis('~') end")
|
|
|
|
(mkSetLuaBinding gsMappings.toggleDeleted "package.loaded.gitsigns.toggle_deleted")
|
|
];
|
|
|
|
visual = mkMerge [
|
|
(mkSetLuaBinding gsMappings.stageHunk "function() package.loaded.gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end")
|
|
(mkSetLuaBinding gsMappings.resetHunk "function() package.loaded.gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end")
|
|
];
|
|
};
|
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
"<leader>g" = "+Gitsigns";
|
|
};
|
|
|
|
pluginRC.gitsigns = entryAnywhere ''
|
|
require('gitsigns').setup{}
|
|
'';
|
|
};
|
|
}
|
|
|
|
(mkIf cfg.codeActions.enable {
|
|
vim.lsp.null-ls.enable = true;
|
|
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
|
table.insert(
|
|
ls_sources,
|
|
null_ls.builtins.code_actions.gitsigns
|
|
)
|
|
'';
|
|
})
|
|
]);
|
|
}
|