Skip to content

Commit

Permalink
Merge pull request #19 from brainss/master
Browse files Browse the repository at this point in the history
[lib] Add vi key bindings - hjkl
  • Loading branch information
Paolo Fragomeni committed Jun 12, 2012
2 parents 6e4f7d6 + 8052ede commit 6375609
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cdir.js
Expand Up @@ -597,8 +597,8 @@ module.exports = function dir (obj, options) {
//
if (key && searchmode === false) {

var downAction = (key.name === 'tab' && !key.shift) || key.name === 'down';
var upAction = (key.shift && key.name === 'tab') || key.name === 'up';
var downAction = (key.name === 'tab' && !key.shift) || key.name === 'down' || key.name === 'j';
var upAction = (key.shift && key.name === 'tab') || key.name === 'up' || key.name === 'k';

if (downAction && selection < displayed) {

Expand Down Expand Up @@ -628,7 +628,8 @@ module.exports = function dir (obj, options) {
// if this is a toggle.
//
if ((key.name === 'space' || key.name === 'enter' ||
key.name === 'right' || key.name === 'left') &&
key.name === 'right' || key.name === 'left' ||
key.name === 'h' || key.name === 'l') &&
(meta[index].type === 'array' || meta[index].type === 'object' ||
meta[index].type === 'function' || meta[index].type === 'string')
&& selection <= displayed) {
Expand Down

0 comments on commit 6375609

Please sign in to comment.