mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 15:09:46 +01:00
d3f21617ac
Update notification popups are annoying when vscode/vscodium is managed by Home Manager. However, as these settings also require the configuration to be managed via `userSettings`, they are disabled by default.
82 lines
1.8 KiB
Nix
82 lines
1.8 KiB
Nix
# Test that keybindings.json is created correctly.
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
bindings = [
|
|
{
|
|
key = "ctrl+c";
|
|
command = "editor.action.clipboardCopyAction";
|
|
when = "textInputFocus && false";
|
|
}
|
|
{
|
|
key = "ctrl+c";
|
|
command = "deleteFile";
|
|
when = "";
|
|
}
|
|
{
|
|
key = "d";
|
|
command = "deleteFile";
|
|
when = "explorerViewletVisible";
|
|
}
|
|
{
|
|
key = "ctrl+r";
|
|
command = "run";
|
|
args = { command = "echo file"; };
|
|
}
|
|
];
|
|
|
|
keybindingsPath = if pkgs.stdenv.hostPlatform.isDarwin then
|
|
"Library/Application Support/Code/User/keybindings.json"
|
|
else
|
|
".config/Code/User/keybindings.json";
|
|
|
|
settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then
|
|
"Library/Application Support/Code/User/settings.json"
|
|
else
|
|
".config/Code/User/settings.json";
|
|
|
|
expectedKeybindings = pkgs.writeText "expected.json" ''
|
|
[
|
|
{
|
|
"command": "editor.action.clipboardCopyAction",
|
|
"key": "ctrl+c",
|
|
"when": "textInputFocus && false"
|
|
},
|
|
{
|
|
"command": "deleteFile",
|
|
"key": "ctrl+c",
|
|
"when": ""
|
|
},
|
|
{
|
|
"command": "deleteFile",
|
|
"key": "d",
|
|
"when": "explorerViewletVisible"
|
|
},
|
|
{
|
|
"args": {
|
|
"command": "echo file"
|
|
},
|
|
"command": "run",
|
|
"key": "ctrl+r"
|
|
}
|
|
]
|
|
'';
|
|
|
|
in {
|
|
config = {
|
|
programs.vscode = {
|
|
enable = true;
|
|
keybindings = bindings;
|
|
package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; };
|
|
};
|
|
|
|
nmt.script = ''
|
|
assertFileExists "home-files/${keybindingsPath}"
|
|
assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}"
|
|
|
|
assertPathNotExists "home-files/${settingsPath}"
|
|
'';
|
|
};
|
|
}
|