Closed blukat29 closed 10 years ago
vim.js
internal structure
var defaultKeyMap[] = {
{ keys: ['<Left>'], type: 'keyToKey', toKeys: ['h'] },
{ keys: ['H'], type: 'motion', motion: 'moveToTopLine', ... },
{ keys: ['g', 'g'], type: 'motion', motion: 'moveToLineOrEdgeOfDocument', ... },
{ keys: ['d'], type: 'operator', operator: 'delete' },
{ keys: ['x'], type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', ... },
{ keys: ['i'], type: 'action', action: 'enterInsertMode', ... },
{ keys: ['u'], type: 'action', action: 'changeCase', context: 'visual', ... },
{ keys: ['i', 'character'], type: 'motion', motion: 'textObjectManipulation', ... },
{ keys: ['/'], type: 'search', ... },
{ keys: [':'], type: 'ex' },
];
Try not to touch vim.js
. Modifying it can lead to unexpected result since vim.js
is really large. So we just implement Vim.buildKeyMap()
as returning defaultKeymap[]
. This works because modifying vim keymaps via map
and unmap
command modifies defaultKeymap
. That is, defaultKeymap
holds the up-to-date set of key maps.
Requirements: