Add vim motions to box.key (j/k/h/l)

This commit is contained in:
Alex 2018-12-04 11:34:54 -08:00 committed by Anton Medvedev
parent b63088e94c
commit f892e8869d
2 changed files with 6 additions and 6 deletions

View File

@ -163,8 +163,8 @@ Next commands available in interactive mode:
| `q` or `Esc` or `Ctrl`+`c` | Exit |
| `e`/`E` | Expand/Collapse all |
| `g`/`G` | Goto top/bottom |
| `up`/`down` | Move cursor up/down |
| `left`/`right` | Expand/Collapse |
| `up`/`down` or `k/j` | Move cursor up/down |
| `left`/`right` or `h/l` | Expand/Collapse |
| `.` | Edit filter |
These commands are available when editing the filter:

8
fx.js
View File

@ -164,7 +164,7 @@ module.exports = function start(filename, source) {
render()
})
box.key('up', function () {
box.key(['up', 'k'], function () {
program.showCursor()
const [n] = getLine(program.y)
@ -184,7 +184,7 @@ module.exports = function start(filename, source) {
}
})
box.key('down', function () {
box.key(['down', 'j'], function () {
program.showCursor()
const [n] = getLine(program.y)
@ -204,7 +204,7 @@ module.exports = function start(filename, source) {
}
})
box.key('right', function () {
box.key(['right', 'l'], function () {
const [n, line] = getLine(program.y)
program.showCursor()
program.cursorPos(program.y, line.search(/\S/))
@ -215,7 +215,7 @@ module.exports = function start(filename, source) {
}
})
box.key('left', function () {
box.key(['left', 'h'], function () {
const [n, line] = getLine(program.y)
program.showCursor()
program.cursorPos(program.y, line.search(/\S/))