Something went wrong. Try again.
forked from nix-community/nixvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155{ lib }:{ example = { keymaps = [ { key = ","; action = "<cmd>echo \"test\"<cr>"; } { mode = [ "n" "s" ]; key = "<C-p>"; action = "<cmd>echo \"test\"<cr>"; } ]; };
mkKeymaps = { keymaps = lib.nixvim.keymaps.mkKeymaps { mode = "x"; options.silent = true; } [ { mode = "n"; key = ","; action = "<cmd>echo \"test\"<cr>"; } { # raw action using rawType key = "<C-p>"; action.__raw = "function() print('hello') end"; } { key = "<C-a>"; action.__raw = "function() print('toto') end"; options.silent = false; } { mode = [ "n" "v" ]; key = "<C-z>"; action = "bar"; } { mode = "n"; key = "<C-h>"; action.__raw = "function() end"; options.replace_keycodes = false; } ]; };
mkKeymapsOnEvents = { keymapsOnEvents = { "InsertEnter" = lib.nixvim.keymaps.mkKeymaps { mode = "x"; options.silent = true; } [ { mode = "n"; key = ","; action = "<cmd>echo \"test\"<cr>"; } { # raw action using rawType key = "<C-p>"; action.__raw = "function() print('hello') end"; } { key = "<C-a>"; action.__raw = "function() print('toto') end"; options.silent = false; } { mode = [ "n" "v" ]; key = "<C-z>"; action = "bar"; } ]; }; };
luaError = { imports = [ (lib.modules.setDefaultModuleLocation "test-module" { keymaps = [ { lua = true; key = "a"; action = "function() print('keymaps') end"; } ]; keymapsOnEvents.InsertEnter = [ { lua = true; key = "a"; action = "function() print('keymap on InsertEnter') end"; } ]; plugins.lsp.keymaps.extra = [ { lua = true; key = "a"; action = "function() print('plugins.lsp.keymaps.extra') end"; } ]; plugins.tmux-navigator.keymaps = [ { lua = true; key = "a"; action = "function() print('plugins.tmux-navigator.keymaps') end"; } ]; plugins.barbar.keymaps.first = { lua = true; key = "a"; action = "function() print('plugins.barbar.keymaps') end"; }; }) ];
test.assertions = expect: [ # Failed assertions: # - The option definition `lua' in `<unknown-file>' no longer has any effect; please remove it. # Use a "raw lua" `action` instead; # e.g. `action.__raw = "<lua code>"` or `action = lib.nixvim.mkRaw "<lua code>"`. (expect "count" 5) (expect "all" "The option definition `lua' in `test-module' no longer has any effect; please remove it.") (expect "any" "Full option: `keymaps.\"[definition 1-entry 1]\".lua`") (expect "any" "Full option: `keymapsOnEvents.InsertEnter.\"[definition 1-entry 1]\".lua`") (expect "any" "Full option: `plugins.lsp.keymaps.extra.\"[definition 1-entry 1]\".lua`") (expect "any" "Full option: `plugins.tmux-navigator.keymaps.\"[definition 1-entry 1]\".lua`") (expect "any" "Full option: `plugins.barbar.keymaps.first.lua`") (expect "all" "Use a \"raw lua\" `action` instead;") (expect "all" "e.g. `action.__raw = \"<lua code>\"` or `action = lib.nixvim.mkRaw \"<lua code>\"`.") ];
test.runNvim = false; test.buildNixvim = false; };}