diff --git a/chrome.manifest b/chrome.manifest
deleted file mode 100644
index 5700cf2..0000000
--- a/chrome.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-content vimkeys content/
-overlay chrome://browser/content/browser.xul chrome://vimkeys/content/overlay.xul
diff --git a/content/functions.js b/content/functions.js
deleted file mode 100644
index 878538a..0000000
--- a/content/functions.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function vimkeysScrollByLines(n) {
- if (n < 0) {
- n = 0-n
- for (var i = 0; i < n; i++) {
- goDoCommand('cmd_scrollLineUp')
- }
- }
- else {
- for (var i = 0; i < n; i++) {
- goDoCommand('cmd_scrollLineDown')
- }
- }
-
-}
-
diff --git a/content/overlay.xul b/content/overlay.xul
deleted file mode 100644
index ca72815..0000000
--- a/content/overlay.xul
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..a2d3099
--- /dev/null
+++ b/index.js
@@ -0,0 +1,41 @@
+var utils = require('sdk/window/utils');
+
+var actions = [
+ {key: 'h', command: 'cmd_scrollLeft'},
+ {key: 'j', command: 'cmd_scrollLineDown'},
+ {key: 'k', command: 'cmd_scrollLineUp'},
+ {key: 'l', command: 'cmd_scrollRight'},
+ {key: 'g', command: 'cmd_scrollTop'},
+ {key: 'G', command: 'cmd_scrollBottom'}
+];
+
+function currentAndFutureWindows(func) {
+ var windows = require('sdk/windows').browserWindows,
+ { viewFor } = require("sdk/view/core");
+ for (let window of windows) {
+ func(viewFor(window));
+ }
+ windows.on('open', function(window) {
+ func(viewFor(window));
+ });
+}
+
+function onWindow(window) {
+ window.gBrowser.addEventListener("keypress", function(event) {
+ var action = actions.find(function(value) {
+ return value.key == event.key;
+ });
+
+ if (action) {
+ runCommand(action.command);
+ }
+ }, false);
+}
+
+function runCommand(cmd) {
+ var window = utils.getMostRecentBrowserWindow();
+ var controller = window.document.commandDispatcher.getControllerForCommand(cmd);
+ controller.doCommand(cmd);
+}
+
+currentAndFutureWindows(onWindow);
diff --git a/install.rdf b/install.rdf
index aea04cf..73f1bc2 100644
--- a/install.rdf
+++ b/install.rdf
@@ -1,23 +1,24 @@
-
-
-
- vimkeys@engeld.cc
- Vimkeys
- 0.2.2
- engeld
- Adds vim keybindings.
- http://engeld.github.io/vimkeys/
- 2
-
-
-
-
- {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- 3.0
- 34.*
-
-
+
+
+
+ vimkeys@engeld.cc
+ vimkeys
+ 0.2.5
+ Dana Engel (engeld)
+ Adds vim keybindings.
+ http://engeld.github.io/vimkeys/
+ 2
+ true
+ false
+
+
+
+
+
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+ 3.0
+ 42.*
+
+
-
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..c4adad7
--- /dev/null
+++ b/package.json
@@ -0,0 +1,16 @@
+{
+ "title": "vimkeys",
+ "name": "vimkeys",
+ "version": "0.2.3",
+ "description": "Adds vim keybindings.",
+ "main": "index.js",
+ "author": "Dana Engel",
+ "engines": {
+ "firefox": ">=38.0a1",
+ "fennec": ">=38.0a1"
+ },
+ "license": "MIT",
+ "keywords": [
+ "jetpack"
+ ]
+}
diff --git a/test/test-index.js b/test/test-index.js
new file mode 100644
index 0000000..b3ad6e8
--- /dev/null
+++ b/test/test-index.js
@@ -0,0 +1,19 @@
+var main = require("../");
+
+exports["test main"] = function(assert) {
+ assert.pass("Unit test running!");
+};
+
+exports["test main async"] = function(assert, done) {
+ assert.pass("async Unit test running!");
+ done();
+};
+
+exports["test dummy"] = function(assert, done) {
+ main.dummy("foo", function(text) {
+ assert.ok((text === "foo"), "Is the text actually 'foo'");
+ done();
+ });
+};
+
+require("sdk/test").run(exports);