Add obsidian hotkeys

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-17 16:58:20 +01:00
parent 443c6dc3a8
commit bccc8d343b
2 changed files with 82 additions and 0 deletions

View File

@@ -424,6 +424,50 @@ in
cssSnippets = [ ./snippets/file-explorer-separators.css ];
themes = [ (import ./themes/minimal { inherit pkgs; }) ];
hotkeys = {
"command-palette:open" = [ { key = "F1"; } ];
"app:open-help" = [ ];
"editor:swap-line-down" = [
{
modifiers = [ "Alt" ];
key = "ArrowDown";
}
];
"editor:swap-line-up" = [
{
modifiers = [ "Alt" ];
key = "ArrowUp";
}
];
"editor:fold-all" = [
{
modifiers = [
"Alt"
"Mod"
];
key = "T";
}
];
"advanced-cursors:add-cursor-above" = [
{
modifiers = [
"Mod"
"Shift"
];
key = "ArrowUp";
}
];
"advanced-cursors:add-cursor-below" = [
{
modifiers = [
"Mod"
"Shift"
];
key = "ArrowDown";
}
];
};
};
};

View File

@@ -144,6 +144,24 @@ in
};
};
};
hotkeysOptions =
{ config, ... }:
{
options = {
modifiers = mkOption {
type = listOf str;
description = "The hotkey modifiers.";
default = [ ];
};
key = mkOption {
type = str;
description = "The hotkey.";
};
};
};
in
{
enable = mkEnableOption "obsidian";
@@ -204,6 +222,12 @@ in
type = raw;
default = [ ];
};
hotkeys = mkOption {
description = "Hotkeys to configure.";
type = raw;
default = { };
};
};
vaults = mkOption {
@@ -261,6 +285,12 @@ in
type = listOf (either package (submodule themesOptions));
default = cfg.sharedSettings.themes;
};
hotkeys = mkOption {
description = "Hotkeys to configure.";
type = attrsOf (listOf (submodule hotkeysOptions));
default = cfg.sharedSettings.hotkeys;
};
};
};
@@ -406,6 +436,13 @@ in
source = toPkg theme;
};
}) vault.settings.themes;
mkHotkeys = vault: {
name = "${vault.target}/.obsidian/hotkeys.json";
value = {
source = (pkgs.formats.json { }).generate "hotkeys.json" vault.settings.hotkeys;
};
};
in
builtins.listToAttrs (
lib.lists.flatten (
@@ -416,6 +453,7 @@ in
(mkCommunityPlugins vault)
(mkCssSnippets vault)
(mkThemes vault)
(mkHotkeys vault)
]) vaults
)
);