File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1664,7 +1664,15 @@ function! s:IncludeFile ( templatefile, ... )
16641664 if read_abs
16651665 let templatefile = s: ConcatNormalizedFilename ( templatefile )
16661666 else
1667- let templatefile = s: ConcatNormalizedFilename ( s: t_runtime .state_stack[-1 ].current_path, templatefile )
1667+ " check whether the first item in runtimepath, e.g. $HOME/.vim/templates has the template file
1668+ let templatepath_tmp = s: ConcatNormalizedFilename ( split (&runtimepath , ' ,' )[0 ], " templates" )
1669+ let templatepath_tmp = s: ConcatNormalizedFilename ( templatepath_tmp, templatefile)
1670+ if filereadable (templatepath_tmp)
1671+ let templatefile = templatepath_tmp
1672+ else
1673+ let templatefile = s: ConcatNormalizedFilename ( s: t_runtime .state_stack[-1 ].current_path, templatefile )
1674+ endif
1675+ unlet templatepath_tmp
16681676 endif
16691677 "
16701678 " file does not exists or was already visited?
You can’t perform that action at this time.
0 commit comments