mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 07:25:30 +00:00
Merge branch 'NotAShelf:main' into feature-language-tex
This commit is contained in:
commit
a1c0e2459b
20 changed files with 244 additions and 15 deletions
|
|
@ -4,6 +4,7 @@ in {
|
|||
imports = [
|
||||
./gitsigns
|
||||
./vim-fugitive
|
||||
./git-conflict
|
||||
];
|
||||
|
||||
options.vim.git = {
|
||||
|
|
@ -13,6 +14,7 @@ in {
|
|||
Enabling this option will enable the following plugins:
|
||||
* gitsigns
|
||||
* vim-fugitive
|
||||
* git-conflict
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
40
modules/plugins/git/git-conflict/config.nix
Normal file
40
modules/plugins/git/git-conflict/config.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.git.git-conflict;
|
||||
|
||||
self = import ./git-conflict.nix {inherit lib config;};
|
||||
gcMappingDefinitions = self.options.vim.git.git-conflict.mappings;
|
||||
|
||||
gcMappings = addDescriptionsToMappings cfg.mappings gcMappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
startPlugins = ["git-conflict-nvim"];
|
||||
|
||||
maps = {
|
||||
normal = mkMerge [
|
||||
(mkSetBinding gcMappings.ours "<Plug>(git-conflict-ours)")
|
||||
(mkSetBinding gcMappings.theirs "<Plug>(git-conflict-theirs)")
|
||||
(mkSetBinding gcMappings.both "<Plug>(git-conflict-both)")
|
||||
(mkSetBinding gcMappings.none "<Plug>(git-conflict-none)")
|
||||
(mkSetBinding gcMappings.prevConflict "<Plug>(git-conflict-prev-conflict)")
|
||||
(mkSetBinding gcMappings.nextConflict "<Plug>(git-conflict-next-conflict)")
|
||||
];
|
||||
};
|
||||
|
||||
pluginRC.git-conflict = entryAnywhere ''
|
||||
require('git-conflict').setup(${toLuaObject ({default_mappings = false;} // cfg.setupOpts)})
|
||||
'';
|
||||
};
|
||||
}
|
||||
]);
|
||||
}
|
||||
6
modules/plugins/git/git-conflict/default.nix
Normal file
6
modules/plugins/git/git-conflict/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./git-conflict.nix
|
||||
];
|
||||
}
|
||||
23
modules/plugins/git/git-conflict/git-conflict.nix
Normal file
23
modules/plugins/git/git-conflict/git-conflict.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.git.git-conflict = {
|
||||
enable = mkEnableOption "git-conflict" // {default = config.vim.git.enable;};
|
||||
setupOpts = mkPluginSetupOption "git-conflict" {};
|
||||
|
||||
mappings = {
|
||||
ours = mkMappingOption "Choose Ours [Git-Conflict]" "co";
|
||||
theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "ct";
|
||||
both = mkMappingOption "Choose Both [Git-Conflict]" "cb";
|
||||
none = mkMappingOption "Choose None [Git-Conflict]" "c0";
|
||||
prevConflict = mkMappingOption "Go to the previous Conflict [Git-Conflict]" "]x";
|
||||
nextConflict = mkMappingOption "Go to the next Conflict [Git-Conflict]" "[x";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
in {
|
||||
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
||||
vim = {
|
||||
startPlugins = ["lspsaga"];
|
||||
startPlugins = ["lspsaga-nvim"];
|
||||
|
||||
maps = {
|
||||
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@
|
|||
./telescope
|
||||
./wakatime
|
||||
./yanky-nvim
|
||||
./leetcode-nvim
|
||||
];
|
||||
}
|
||||
|
|
|
|||
26
modules/plugins/utility/leetcode-nvim/config.nix
Normal file
26
modules/plugins/utility/leetcode-nvim/config.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.leetcode-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"leetcode-nvim"
|
||||
"plenary-nvim"
|
||||
"fzf-lua"
|
||||
"nui-nvim"
|
||||
];
|
||||
|
||||
lazy.plugins.leetcode-nvim = {
|
||||
package = "leetcode-nvim";
|
||||
setupModule = "leetcode";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/leetcode-nvim/default.nix
Normal file
6
modules/plugins/utility/leetcode-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./leetcode-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
74
modules/plugins/utility/leetcode-nvim/leetcode-nvim.nix
Normal file
74
modules/plugins/utility/leetcode-nvim/leetcode-nvim.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum str bool;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
in {
|
||||
options.vim.utility = {
|
||||
leetcode-nvim = {
|
||||
enable = mkEnableOption "complementary neovim plugin for leetcode.nvim";
|
||||
|
||||
setupOpts = mkPluginSetupOption "leetcode-nvim" {
|
||||
logging = mkEnableOption "logging for leetcode.nvim status notifications." // {default = true;};
|
||||
image_support = mkEnableOption "question description images using image.nvim (image-nvim must be enabled).";
|
||||
|
||||
lang = mkOption {
|
||||
type = enum [
|
||||
"cpp"
|
||||
"java"
|
||||
"python"
|
||||
"python3"
|
||||
"c"
|
||||
"csharp"
|
||||
"javascript"
|
||||
"typescript"
|
||||
"php"
|
||||
"swift"
|
||||
"kotlin"
|
||||
"dart"
|
||||
"golang"
|
||||
"ruby"
|
||||
"scala"
|
||||
"rust"
|
||||
"racket"
|
||||
"erlang"
|
||||
"elixir"
|
||||
"bash"
|
||||
];
|
||||
default = "python3";
|
||||
description = "Language to start your session with";
|
||||
};
|
||||
|
||||
arg = mkOption {
|
||||
type = str;
|
||||
default = "leetcode.nvim";
|
||||
description = "Argument for Neovim";
|
||||
};
|
||||
|
||||
cn = {
|
||||
enabled = mkEnableOption "leetcode.cn instead of leetcode.com";
|
||||
translator = mkEnableOption "translator" // {default = true;};
|
||||
translate_problems = mkEnableOption "translation for problem questions" // {default = true;};
|
||||
};
|
||||
|
||||
storage = {
|
||||
home = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline "vim.fn.stdpath(\"data\") .. \"/leetcode\"";
|
||||
description = "Home storage directory";
|
||||
};
|
||||
|
||||
cache = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline "vim.fn.stdpath(\"cache\") .. \"/leetcode\"";
|
||||
description = "Cache storage directory";
|
||||
};
|
||||
};
|
||||
|
||||
plugins = {
|
||||
non_standalone = mkEnableOption "leetcode.nvim in a non-standalone mode";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue