Add sketch of insert mode

This commit is contained in:
Oliver Blanthorn 2017-10-02 21:09:10 +01:00
parent 8cade7860a
commit 38923d8876
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 27 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import * as Parsing from "./parsing"
import * as state from "./state"
/** Accepts keyevents, resolves them to maps, maps to exstrs, executes exstrs */
function *ParserController () {
@ -20,6 +21,15 @@ function *ParserController () {
keys.push(keypress)
let response = Parsing.normalmode.parser(keys)
switch(state.MODE){
case "NORMAL":
response = Parsing.normalmode.parser(keys)
break
case "INSERT":
response = Parsing.insertmode.parser(keys)
break
}
console.debug(keys, response)

View file

@ -1,6 +1,22 @@
import * as ExCmds from "./excmds_background"
// Simple implementations of a normal and ex mode parsers
export namespace insertmode {
// WIP
const pmaps = new Map<string,string>([
// Special keys must be prepended with 🄰
["🄰Escape", "normalmode"],
])
// Placeholder - should be moved into generic parser
export function parser(keys){
return keys
}
}
// Tridactyl normal mode:
//
@ -31,6 +47,7 @@ export namespace normalmode {
[":", "focuscmdline"],
["s", "open google"],
["xx", "something"],
["i", "insertmode"],
// Special keys must be prepended with 🄰
// ["🄰Backspace", "something"],
])