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,16 @@ 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+
1671+ if filereadable (templatepath_tmp)
1672+ let templatefile = templatepath_tmp
1673+ else
1674+ let templatefile = s: ConcatNormalizedFilename ( s: t_runtime .state_stack[-1 ].current_path, templatefile )
1675+ endif
1676+ unlet templatepath_tmp
16681677 endif
16691678 "
16701679 " file does not exists or was already visited?
You can’t perform that action at this time.
0 commit comments