@@ -3,23 +3,23 @@ vim9script
33import autoload " ./mde_links.vim" as links
44import autoload " ./mde_utils.vim" as utils
55
6- var indice s : any
7- var indices_id = -1
6+ var index : any
7+ var index_id = -1
88
99def IndexCallback (id: number , idx: number )
1010 if idx > 0
1111
1212 var selection = ' '
13- if typename (indices ) == " list<string>"
13+ if typename (index ) == " list<string>"
1414 selection = getbufline (winbufnr (id), idx)[0 ]
15- elseif typename (indices ) == " list<list<string>>"
15+ elseif typename (index ) == " list<list<string>>"
1616 selection = getbufline (winbufnr (id), idx)[0 ]
17- var indices_names = indices - >mapnew ((_, val) = > val[0 ])
18- var ii = index (indices_names , selection )
19- selection = indices [ii][1 ]
20- elseif typename (indices ) == " dict<string>"
17+ var index_names = index - >mapnew ((_, val) = > val[0 ])
18+ var ii = index (index_names , selection )
19+ selection = index [ii][1 ]
20+ elseif typename (index ) == " dict<string>"
2121 var selection_key = getbufline (winbufnr (id), idx)[0 ]
22- selection = indices [selection_key]
22+ selection = index [selection_key]
2323 endif
2424
2525 if ! empty (selection )
@@ -39,28 +39,28 @@ def IndexCallback(id: number, idx: number)
3939 endif
4040 endif
4141
42- indices_id = -1
42+ index_id = -1
4343 endif
4444enddef
4545
46- export def ShowIndices (passed_indice s : string = ' ' )
47- var indices_found = false
46+ export def ShowIndex (passed_index : string = ' ' )
47+ var index_found = false
4848
49- if ! empty (passed_indices )
49+ if ! empty (passed_index )
5050 # TODO : remove the eval () with something better
51- indices = eval (passed_indices )
52- indices_found = true
51+ index = eval (passed_index )
52+ index_found = true
5353 elseif exists (' g:markdown_extras_index' ) != 0
5454 && ! empty (' g:markdown_extras_index' )
55- indices = g: markdown_extras_index
56- indices_found = true
55+ index = g: markdown_extras_index
56+ index_found = true
5757 else
58- utils.Echoerr (" Cannot find indices " )
58+ utils.Echoerr (" Cannot find index " )
5959 endif
6060
61- if indices_found
61+ if index_found
6262 const popup_width = (&columns * 2 ) / 3
63- const popup_height = min ([len (indices ), &lines / 2 ])
63+ const popup_height = min ([len (index ), &lines / 2 ])
6464 var opts = {
6565 pos: ' center' ,
6666 border: [1 , 1 , 1 , 1 ],
@@ -76,19 +76,19 @@ export def ShowIndices(passed_indices: string='')
7676 wrap : 0 ,
7777 drag: 0 ,
7878 }
79- if typename (indices ) == " list<string>"
80- indices_id = popup_create (indices , opts)
81- links.ShowPromptPopup (indices_id, indices , " indices : " )
82- elseif typename (indices ) == " list<list<string>>"
83- var indices_names = indices - >mapnew ((_, val) = > val[0 ])
84- indices_id = popup_create (indices_names , opts)
85- links.ShowPromptPopup (indices_id, indices_names , " indices : " )
86- elseif typename (indices ) == " dict<string>"
87- indices_id = popup_create (keys (indices ), opts)
88- links.ShowPromptPopup (indices_id , keys (indices ), " indices : " )
79+ if typename (index ) == " list<string>"
80+ index_id = popup_create (index , opts)
81+ links.ShowPromptPopup (index_id, index , " index : " )
82+ elseif typename (index ) == " list<list<string>>"
83+ var index_names = index - >mapnew ((_, val) = > val[0 ])
84+ index_id = popup_create (index_names , opts)
85+ links.ShowPromptPopup (index_id, index_names , " index : " )
86+ elseif typename (index ) == " dict<string>"
87+ index_id = popup_create (keys (index ), opts)
88+ links.ShowPromptPopup (index_id , keys (index ), " index : " )
8989 else
9090 utils.Echoerr (" Wrong argument type passed to ':MDEIndex' "
91- \ .. $ " (you passed a {typename(indices )})" )
91+ \ .. $ " (you passed a {typename(index )})" )
9292 endif
9393 endif
9494enddef
0 commit comments