5
5
import * as path from "https://deno.land/[email protected] /path/mod.ts" ;
6
6
import { parse } from "./parse.ts" ;
7
7
import { format } from "./format.ts" ;
8
+ import { DOCS_OVERRIDES } from "./override.ts" ;
8
9
import { transform } from "./transform.ts" ;
9
10
import { downloadString } from "../utils.ts" ;
10
11
@@ -62,12 +63,20 @@ const nvimFnSet = difference(
62
63
manualFnSet ,
63
64
) ;
64
65
66
+ const nvimDefMap = new Map ( nvimDefs . map ( ( def ) => [ def . fn , def ] ) ) ;
67
+ const commonDefs = vimDefs
68
+ . map ( ( vimDef ) =>
69
+ DOCS_OVERRIDES [ vimDef . fn ] === "nvim"
70
+ ? { ...vimDef , docs : nvimDefMap . get ( vimDef . fn ) ! . docs }
71
+ : vimDef
72
+ ) ;
73
+
65
74
const commonFnSet = intersection ( vimFnSet , nvimFnSet ) ;
66
75
const vimOnlyFnSet = difference ( vimFnSet , nvimFnSet ) ;
67
76
const nvimOnlyFnSet = difference ( nvimFnSet , vimFnSet ) ;
68
77
69
78
const commonCode = format (
70
- vimDefs . filter ( ( def ) => commonFnSet . has ( def . fn ) ) ,
79
+ commonDefs . filter ( ( def ) => commonFnSet . has ( def . fn ) ) ,
71
80
) ;
72
81
const vimOnlyCode = format (
73
82
vimDefs . filter ( ( def ) => vimOnlyFnSet . has ( def . fn ) ) ,
@@ -89,7 +98,7 @@ await Deno.writeTextFile(
89
98
nvimOnlyCode . join ( "\n" ) ,
90
99
) ;
91
100
92
- await transform ( resolvePath ( commonManualModule ) , vimDefs ) ;
101
+ await transform ( resolvePath ( commonManualModule ) , commonDefs ) ;
93
102
await transform ( resolvePath ( vimManualModule ) , vimDefs ) ;
94
103
await transform ( resolvePath ( nvimManualModule ) , nvimDefs ) ;
95
104
0 commit comments