@@ -118,6 +118,16 @@ if (!exists('g:alternateNoDefaultAlternate'))
118
118
let g: alternateNoDefaultAlternate = 0
119
119
endif
120
120
121
+ " If this variable is true then a.vim will convert the alternate filename to a
122
+ " filename relative to the current working directory.
123
+ " Feature by Nathan Huizinga
124
+ if (! exists (' g:alternateRelativeFiles' ))
125
+ " by default a.vim will not convert the filename to one relative to the
126
+ " current working directory
127
+ let g: alternateRelativeFiles = 0
128
+ endif
129
+
130
+
121
131
" Function : GetNthItemFromList (PRIVATE)
122
132
" Purpose : Support reading items from a comma seperated list
123
133
" Used to iterate all the extensions in an extension spec
@@ -296,14 +306,14 @@ endfunction
296
306
function ! EnumerateFilesByExtension (path , baseName, extension)
297
307
let enumeration = " "
298
308
let extSpec = " "
299
- if (has_key (g: alternateExtensionsDict , a: extension ))
300
- let extSpec = g: alternateExtensionsDict [a: extension ]
309
+ let v: errmsg = " "
310
+ silent ! echo g: alternateExtensions_ {a: extension }
311
+ if (v: errmsg == " " )
312
+ let extSpec = g: alternateExtensions_ {a: extension }
301
313
endif
302
314
if (extSpec == " " )
303
- let v: errmsg = " "
304
- silent ! echo g: alternateExtensions_ {a: extension }
305
- if (v: errmsg == " " )
306
- let extSpec = g: alternateExtensions_ {a: extension }
315
+ if (has_key (g: alternateExtensionsDict , a: extension ))
316
+ let extSpec = g: alternateExtensionsDict [a: extension ]
307
317
endif
308
318
endif
309
319
if (extSpec != " " )
@@ -722,6 +732,10 @@ function! <SID>FindOrCreateBuffer(fileName, doSplit, findSimilar)
722
732
endif
723
733
endif
724
734
735
+ if (g: alternateRelativeFiles == 1 )
736
+ let FILENAME = fnamemodify (FILENAME, " :p:." )
737
+ endif
738
+
725
739
let splitType = a: doSplit [0 ]
726
740
let bang = a: doSplit [1 ]
727
741
if (bufNr == -1 )
0 commit comments