File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Mapping, Mode } from "./types.ts";
44 * Parse record displayed by Vim's `map` command and return a `Mapping` instance.
55 */
66export function parse ( record : string ) : Mapping {
7- const m = record . match ( / ^ ( .) \s + ( \S + ) \s + ( .* ) $ / ) ;
7+ const m = record . match ( / ^ ( ... ) ( \S + ) \s + ( .* ) $ / ) ;
88 if ( ! m ) {
99 throw new Error ( `Failed to parse a mapping record '${ record } '` ) ;
1010 }
Original file line number Diff line number Diff line change @@ -74,6 +74,22 @@ const testcases: [string, Mapping][] = [
7474 buffer : false ,
7575 } ,
7676 ] ,
77+ [ "ov # <Plug>(asterisk-z#)zv" , {
78+ mode : "ov" ,
79+ lhs : "#" ,
80+ rhs : "<Plug>(asterisk-z#)zv" ,
81+ noremap : false ,
82+ script : false ,
83+ buffer : false ,
84+ } ] ,
85+ [ "nosa * b" , {
86+ mode : "nos" ,
87+ lhs : "a" ,
88+ rhs : "b" ,
89+ noremap : true ,
90+ script : false ,
91+ buffer : false ,
92+ } ] ,
7793] ;
7894for ( const [ record , expected ] of testcases ) {
7995 Deno . test ( `parse() parses '${ record } ' and return a Mapping instance` , ( ) => {
Original file line number Diff line number Diff line change @@ -8,7 +8,17 @@ export type Mode =
88 | "s" // Select
99 | "o" // Operator-pending
1010 | "t" // Terminal-Job
11- | "l" ; // ":lmap" mappings for Insert, Command-line and Lang-Arg
11+ | "l" // ":lmap" mappings for Insert, Command-line and Lang-Arg
12+ // See https://github.com/vim-denops/deno-denops-std/issues/152 for detail
13+ | "ov"
14+ | "nv"
15+ | "no"
16+ | "os"
17+ | "ns"
18+ | "ox"
19+ | "nx"
20+ | "nox"
21+ | "nos" ;
1222
1323export type Mapping = {
1424 // Modes for which the mapping is defined
You can’t perform that action at this time.
0 commit comments