support t/T command and fix alter mode

jh-changes
Shin'ya Ueoka 7 years ago
parent 2b6aca17b0
commit 6c01283973
  1. 8
      src/actions/operation.js
  2. 2
      src/background/keys.js
  3. 1
      src/operations/index.js

@ -25,11 +25,17 @@ const exec = (operation, tab) => {
case operations.COMMAND_OPEN: case operations.COMMAND_OPEN:
return consoleActions.showCommand(''); return consoleActions.showCommand('');
case operations.COMMAND_TABS_OPEN: case operations.COMMAND_TABS_OPEN:
if (operations.alter) { if (operation.alter) {
// alter url // alter url
return consoleActions.showCommand('open ' + tab.url); return consoleActions.showCommand('open ' + tab.url);
} }
return consoleActions.showCommand('open '); return consoleActions.showCommand('open ');
case operations.COMMAND_TABS_NEW:
if (operation.alter) {
// alter url
return consoleActions.showCommand('tabopen ' + tab.url);
}
return consoleActions.showCommand('tabopen ');
case operations.COMMAND_BUFFER: case operations.COMMAND_BUFFER:
return consoleActions.showCommand('buffer '); return consoleActions.showCommand('buffer ');
default: default:

@ -4,6 +4,8 @@ const defaultKeymap = {
':': { type: operations.COMMAND_OPEN }, ':': { type: operations.COMMAND_OPEN },
'o': { type: operations.COMMAND_TABS_OPEN, alter: false }, 'o': { type: operations.COMMAND_TABS_OPEN, alter: false },
'O': { type: operations.COMMAND_TABS_OPEN, alter: true }, 'O': { type: operations.COMMAND_TABS_OPEN, alter: true },
't': { type: operations.COMMAND_TABS_NEW, alter: false },
'T': { type: operations.COMMAND_TABS_NEW, alter: true },
'b': { type: operations.COMMAND_BUFFER }, 'b': { type: operations.COMMAND_BUFFER },
'k': { type: operations.SCROLL_LINES, count: -1 }, 'k': { type: operations.SCROLL_LINES, count: -1 },
'j': { type: operations.SCROLL_LINES, count: 1 }, 'j': { type: operations.SCROLL_LINES, count: 1 },

@ -2,6 +2,7 @@ export default {
// Command // Command
COMMAND_OPEN: 'cmd.open', COMMAND_OPEN: 'cmd.open',
COMMAND_TABS_OPEN: 'cmd.tabs.open', COMMAND_TABS_OPEN: 'cmd.tabs.open',
COMMAND_TABS_NEW: 'cmd.tabs.new',
COMMAND_BUFFER: 'cmd.buffer', COMMAND_BUFFER: 'cmd.buffer',
SCROLL_LINES: 'scroll.lines', SCROLL_LINES: 'scroll.lines',