@@ -75,26 +75,31 @@ endfunc
75
75
76
76
function ! s: skeletons .chooseSkeleton (fileExt)
77
77
if ! has_key (self .candidates, a: fileExt )
78
- " No skeleton for this filetype
79
78
return 0
80
79
endif
80
+
81
81
let skeletonsList = self .candidates[a: fileExt ]
82
82
if len (skeletonsList) == 0
83
83
return 0
84
- elseif len (skeletonsList) == 1
84
+ endif
85
+
86
+ if len (skeletonsList) == 1
85
87
return skeletonsList[0 ]
86
- else
87
- " gather types
88
- let types = []
89
- for type in skeletonsList
90
- call add (types, self .getType (type ))
91
- endfor
88
+ endif
89
+
90
+ " gather types
91
+ let types = []
92
+ for type in skeletonsList
93
+ call add (types, self .getType (type ))
94
+ endfor
92
95
93
- " ask user for which type to use
94
- let mappedTypes = map (copy (types), ' "&" . v:val' )
95
- let choice = confirm (" Select the skeleton type for " . a: fileExt , join (mappedTypes, " \n " ), 1 , " Question" )
96
- return skeletonsList[choice - 1 ]
96
+ " ask user for which type to use
97
+ let mappedTypes = map (copy (types), ' "&" . v:val' )
98
+ let choice = confirm (" Select the skeleton type for " . a: fileExt , join (mappedTypes, " \n " ), 1 , " Question" )
99
+ if choice == 0
100
+ return 0
97
101
endif
102
+ return skeletonsList[choice - 1 ]
98
103
endfunc
99
104
100
105
function ! s: skeletons .insertSkeleton ()
0 commit comments