mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/todo-comments: support conditional key mapping
This commit is contained in:
parent
4e5bd1d79b
commit
87e3c4a1b2
2 changed files with 26 additions and 1 deletions
|
@ -373,8 +373,11 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
defaults = {
|
defaults = {
|
||||||
inherit action;
|
inherit action;
|
||||||
mode = "n";
|
mode = "n";
|
||||||
|
key = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
key.type = with types; nullOr str;
|
||||||
|
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
cwd = mkOption {
|
cwd = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
@ -430,7 +433,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
extraPackages = [ cfg.ripgrepPackage ];
|
extraPackages = [ cfg.ripgrepPackage ];
|
||||||
|
|
||||||
keymaps = lib.pipe cfg.keymaps [
|
keymaps = lib.pipe cfg.keymaps [
|
||||||
(filterAttrs (n: keymap: keymap != null))
|
(filterAttrs (n: keymap: keymap != null && keymap.key != null))
|
||||||
(mapAttrsToList (
|
(mapAttrsToList (
|
||||||
name: keymap: {
|
name: keymap: {
|
||||||
inherit (keymap) key mode options;
|
inherit (keymap) key mode options;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
empty = {
|
empty = {
|
||||||
plugins.todo-comments.enable = true;
|
plugins.todo-comments.enable = true;
|
||||||
|
@ -166,6 +167,27 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
conditional-mappings =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
plugins.telescope.enable = true;
|
||||||
|
plugins.todo-comments = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
todoTrouble.key = lib.mkIf config.plugins.trouble.enable "<leader>xq";
|
||||||
|
todoTelescope = lib.mkIf config.plugins.telescope.enable {
|
||||||
|
key = "<leader>ft";
|
||||||
|
keywords = [
|
||||||
|
"TODO"
|
||||||
|
"FIX"
|
||||||
|
"FIX"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
without-ripgrep = {
|
without-ripgrep = {
|
||||||
plugins.todo-comments = {
|
plugins.todo-comments = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue