From 541823428bdbe93afd3eb4ddce84d5f1cb8ef271 Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 27 Mar 2010 14:25:46 +0000 Subject: マッピングの設定を可能に git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37103 d0d07461-0603-4401-acd4-de1884942a52 --- spatial-navigation.js | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'spatial-navigation.js') diff --git a/spatial-navigation.js b/spatial-navigation.js index 01f2954..955f403 100755 --- a/spatial-navigation.js +++ b/spatial-navigation.js @@ -438,21 +438,36 @@ let INFO = } - [['', DIR_U], ['', DIR_D], ['', DIR_L], ['', DIR_R]].forEach( - function ([name, dir]) { - liberator.log(name); - mappings.addUserMap( - [modes.NORMAL], - [name], - 'Spatial Navigation', - function () { - let (target = getFocusedElement()) - target ? move(dir, target) : defaultMove(dir); - }, - {} - ) - } - ); + // Define mappings + { + let ms = + ( + liberator.globalVariables.spatial_navigation_mappings + || + ' ' + ).split(/\s+/); + + [ + DIR_L, + DIR_D, + DIR_U, + DIR_R + ].forEach( + function (dir, index) { + mappings.addUserMap( + [modes.NORMAL], + [ms[index]], + 'Spatial Navigation', + function () { + let (target = getFocusedElement()) + target ? move(dir, target) : defaultMove(dir); + }, + {} + ) + } + ); + + } })(); -- cgit v1.2.3