mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -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 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)
|
||||
|
||||
|
|
|
@ -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"],
|
||||
])
|
||||
|
|
Loading…
Add table
Reference in a new issue