-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
28 lines (26 loc) · 945 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var iterm = {
extMan: null,
init: function(extManager) {
//
// This function adds all the commands for working with iterm and
// setting up references to variables that are used.
//
iterm.extMan = extManager;
iterm.extMan.getCommands().addCommand('Open Directory in iTerm', 'iterm.open', 'Open the directory in iTerm.', iterm.open);
},
installKeyMaps: function() {
iterm.extMan.getExtCommand('addKeyboardShort').command('normal', false, false, false, 'o', iterm.open);
},
open: async function() {
//
// First, get the current cursor:
//
var cursor = iterm.extMan.getExtCommand('getCursor').command();
var extScript = `${iterm.extMan.getExtensionDir()}/iTerm-mfm-V2/iterm.scpt`;
//
// Use AppleScript command line to open the cursor in iterm.
//
await iterm.extMan.getLocalFS().runCommandLine(`osascript "${extScript}" "${cursor.entry.dir}"`);
}
};
return (iterm);