Hack keyseq into working with ignore

This commit is contained in:
Oliver Blanthorn 2018-07-25 11:44:34 +01:00
parent c799c9a39d
commit 99f6dc4e8e
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
3 changed files with 22 additions and 12 deletions

View file

@ -34,6 +34,11 @@ let USERCONFIG = o({})
const DEFAULTS = o({
configversion: "0.0",
// When creating new <modifier-letter> maps, make sure to make the modifier uppercase (e.g. <C-a> instead of <c-a>) otherwise some commands might not be able to find them (e.g. `bind <c-a>`)
imaps: o({
"<S-Insert>": "mode normal",
"<CA-Esc>": "mode normal",
"<CA-`>": "mode normal",
}),
nmaps: o({
"<F1>": "help",
o: "fillcmdline open",

View file

@ -103,6 +103,7 @@ type KeyMap = Map<MinimalKey[], MapTarget>
export type ParserResponse = {
keys?: KeyEventLike[]
value?: any
exstr?: any
isMatch: boolean
}
@ -129,7 +130,7 @@ export function parse(keyseq: KeyEventLike[], map: KeyMap): ParserResponse {
possibleMappings,
([k, v]) => k.length === keyseq.length,
)
return { value: perfect[1], isMatch: true }
return { value: perfect[1], exstr: perfect[1], isMatch: true }
} catch (e) {
if (!(e instanceof RangeError)) throw e
}

View file

@ -1,14 +1,18 @@
import { hasModifiers } from "../keyseq"
import * as generic from "./genericmode"
// Placeholder - should be moved into generic parser
export function parser(keys) {
const response = { keys: [], exstr: undefined }
if (
(keys[0].shiftKey && keys[0].key === "Insert") ||
(keys[0].altKey && keys[0].ctrlKey && keys[0].key === "Escape") ||
(keys[0].altKey && keys[0].ctrlKey && keys[0].key === "`")
) {
return { keys: [], exstr: "mode normal" }
}
return { keys: [], exstr: undefined }
}
// export function parser(keys) {
// const response = { keys: [], exstr: undefined }
// if (
// (keys[0].shiftKey && keys[0].key === "Insert") ||
// (keys[0].altKey && keys[0].ctrlKey && keys[0].key === "Escape") ||
// (keys[0].altKey && keys[0].ctrlKey && keys[0].key === "`")
// ) {
// return { keys: [], exstr: "mode normal" }
// }
// return { keys: [], exstr: undefined }
// }
export let parser = keys => generic.parser("imaps",keys)