Skip to content

Commit

Permalink
Merge pull request #10 from VSCode-Extension/assorted-fixes
Browse files Browse the repository at this point in the history
assorted fixes
  • Loading branch information
guillermooo committed Nov 17, 2015
2 parents c49c99d + 0702af8 commit b9f4d61
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 61 deletions.
32 changes: 16 additions & 16 deletions extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Import the module and reference it with the alias vscode in your code below

import * as vscode from 'vscode';
import {showCmdLine} from './src/cmd_line/main';
import * as cc from './src/cmd_line/lexer';
import {showCmdLine} from './src/cmd_line/main';
import * as cc from './src/cmd_line/lexer';
import ModeHandler from "./src/mode/mode_handler";
import {ModeName} from "./src/mode/mode";

Expand All @@ -13,25 +13,25 @@ var modeHandler;
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
modeHandler = new ModeHandler();
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "vim" is now active!');

var cmdLineDisposable = vscode.commands.registerCommand('extension.showCmdLine', () => {
showCmdLine();
});

// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "vim" is now active!');

var cmdLineDisposable = vscode.commands.registerCommand('extension.showCmdLine', () => {
showCmdLine();
});

vscode.commands.registerCommand('extension.vimMode_esc', () => handleKeyEvent("esc"));
vscode.commands.registerCommand('extension.vimMode_semicolon', () => handleKeyEvent(":"));
vscode.commands.registerCommand('extension.vimMode_semicolon', () => handleKeyEvent(":"));
vscode.commands.registerCommand('extension.vimMode_h', () => handleKeyEvent("h"));
vscode.commands.registerCommand('extension.vimMode_j', () => handleKeyEvent("j"));
vscode.commands.registerCommand('extension.vimMode_k', () => handleKeyEvent("k"));
vscode.commands.registerCommand('extension.vimMode_k', () => handleKeyEvent("k"));
vscode.commands.registerCommand('extension.vimMode_l', () => handleKeyEvent("l"));
context.subscriptions.push(cmdLineDisposable);

context.subscriptions.push(cmdLineDisposable);
}

function handleKeyEvent(key:string) {
modeHandler.HandleKeyEvent(key);
}
}
74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{
"name": "vim",
"description": "Vim emulation for VS Code",
"version": "0.0.1",
"publisher": "VSCodeVim",
"name": "vim",
"description": "Vim emulation for VS Code",
"version": "0.0.1",
"publisher": "VSCodeVim",
"contributors": [
"guillermooo",
"jpoon"
],
"engines": {
"vscode": "0.10.x"
},
"categories": [
"Others"
],
"activationEvents": [
"*"
],
"main": "./out/extension",
"contributes": {
"commands": [
{ "command": "extension.showCmdLine", "title": "Vim: Show Command Line" }
],
"keybindings": [
{ "key": "Escape", "command": "extension.vimMode_esc", "when": "editorTextFocus" },
{ "key": "Shift+;", "command": "extension.vimMode_semicolon", "when": "editorTextFocus" },
{ "key": "H", "command": "extension.vimMode_h", "when": "editorTextFocus" },
{ "key": "J", "command": "extension.vimMode_j", "when": "editorTextFocus" },
{ "key": "K", "command": "extension.vimMode_k", "when": "editorTextFocus" },
{ "key": "L", "command": "extension.vimMode_l", "when": "editorTextFocus" },
"engines": {
"vscode": "0.10.x"
},
"categories": [
"Others"
],
"activationEvents": [
"*"
],
"main": "./out/extension",
"contributes": {
"commands": [
{ "command": "extension.showCmdLine", "title": "Vim: Show Command Line" }
],
"keybindings": [
{ "key": "Escape", "command": "extension.vimMode_esc", "when": "editorTextFocus" },
{ "key": "Shift+;", "command": "extension.vimMode_semicolon", "when": "editorTextFocus" },
{ "key": "H", "command": "extension.vimMode_h", "when": "editorTextFocus" },
{ "key": "J", "command": "extension.vimMode_j", "when": "editorTextFocus" },
{ "key": "K", "command": "extension.vimMode_k", "when": "editorTextFocus" },
{ "key": "L", "command": "extension.vimMode_l", "when": "editorTextFocus" },

{ "key": "Ctrl+H", "command": "cursorLeft", "when": "editorTextFocus" },
{ "key": "Ctrl+J", "command": "cursorDown", "when": "editorTextFocus" },
{ "key": "Ctrl+K", "command": "cursorUp", "when": "editorTextFocus" },
{ "key": "Ctrl+L", "command": "cursorRight", "when": "editorTextFocus" },
{ "key": "Ctrl+Shift+.", "command": "extension.showCmdLine", "when": "editorTextFocus" }
]
},
"scripts": {
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
},
{ "key": "Ctrl+H", "command": "cursorLeft", "when": "editorTextFocus" },
{ "key": "Ctrl+J", "command": "cursorDown", "when": "editorTextFocus" },
{ "key": "Ctrl+K", "command": "cursorUp", "when": "editorTextFocus" },
{ "key": "Ctrl+L", "command": "cursorRight", "when": "editorTextFocus" },
{ "key": "Ctrl+Shift+.", "command": "extension.showCmdLine", "when": "editorTextFocus" }
]
},
"scripts": {
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-tslint": "^3.6.0",
"gulp-typescript": "^2.9.2",
"vscode": "0.10.x"
}
}
}
18 changes: 11 additions & 7 deletions src/cmd_line/command_node.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import * as vscode from "vscode";
import * as node from "./node";
import * as util from "../util";
import * as vscode from 'vscode';
import * as node from './node';
import * as util from '../util';

//
// Implements :write
// http://vimdoc.sourceforge.net/htmldoc/editing.html#:write
//
export class WriteCommand implements node.CommandBase {
name : string;
shortName : string;
args : Object;

constructor(args : Object = null) {
// TODO: implement other arguments.
this.name = "write";
this.shortName = "w";
this.name = 'write';
this.shortName = 'w';
this.args = args;
}

runOn(textEditor : vscode.TextEditor) : void {
if (this.args || !textEditor.document.fileName) {
util.showInfo("Not implemented.");
if (this.args) {
util.showError("Not implemented.");
return;
}
textEditor.document.save();
Expand Down
6 changes: 5 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ import * as vscode from 'vscode';

export function showInfo(message : string) : void {
vscode.window.showInformationMessage("Vim: " + message);
}
}

export function showError(message : string) : void {
vscode.window.showErrorMessage("Vim: " + message);
}

0 comments on commit b9f4d61

Please sign in to comment.