mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Add sketch of insert mode
This commit is contained in:
parent
8cade7860a
commit
38923d8876
2 changed files with 27 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import * as Parsing from "./parsing"
|
import * as Parsing from "./parsing"
|
||||||
|
import * as state from "./state"
|
||||||
|
|
||||||
/** Accepts keyevents, resolves them to maps, maps to exstrs, executes exstrs */
|
/** Accepts keyevents, resolves them to maps, maps to exstrs, executes exstrs */
|
||||||
function *ParserController () {
|
function *ParserController () {
|
||||||
|
@ -20,6 +21,15 @@ function *ParserController () {
|
||||||
|
|
||||||
keys.push(keypress)
|
keys.push(keypress)
|
||||||
let response = Parsing.normalmode.parser(keys)
|
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)
|
console.debug(keys, response)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
import * as ExCmds from "./excmds_background"
|
import * as ExCmds from "./excmds_background"
|
||||||
|
|
||||||
|
|
||||||
// Simple implementations of a normal and ex mode parsers
|
// 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:
|
// Tridactyl normal mode:
|
||||||
//
|
//
|
||||||
|
@ -31,6 +47,7 @@ export namespace normalmode {
|
||||||
[":", "focuscmdline"],
|
[":", "focuscmdline"],
|
||||||
["s", "open google"],
|
["s", "open google"],
|
||||||
["xx", "something"],
|
["xx", "something"],
|
||||||
|
["i", "insertmode"],
|
||||||
// Special keys must be prepended with 🄰
|
// Special keys must be prepended with 🄰
|
||||||
// ["🄰Backspace", "something"],
|
// ["🄰Backspace", "something"],
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Reference in a new issue