Skip to content

Commit a2241c1

Browse files
authored
Merge pull request #39 from d3jn/feature/absolute-expand-option
Option to expand fully qualified (absolute) names
2 parents 96a1b24 + 7658794 commit a2241c1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugin/phpns.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ let g:php_namespace_sort = get(g:, 'php_namespace_sort', "'{,'}-1sort i")
1212

1313
let g:php_namespace_sort_after_insert = get(g:, 'php_namespace_sort_after_insert', 0)
1414

15+
if !exists("g:php_namespace_expand_to_absolute")
16+
let g:php_namespace_expand_to_absolute=0
17+
endif
18+
1519
function! PhpFindMatchingUse(name)
1620

1721
" matches use [function] Foo\Bar as <name>
@@ -163,7 +167,11 @@ function! PhpExpandClass()
163167
if fqn is 0
164168
return
165169
endif
166-
substitute /\%#[[:alnum:]\\_]\+/\=fqn[1]/
170+
if g:php_namespace_expand_to_absolute
171+
substitute /\%#[[:alnum:]\\_]\+/\='\'.fqn[1]/
172+
else
173+
substitute /\%#[[:alnum:]\\_]\+/\=fqn[1]/
174+
endif
167175
exe restorepos
168176
" move cursor after fqn
169177
call search('\([[:blank:]]*[[:alnum:]\\_]\)*', 'ceW')

0 commit comments

Comments
 (0)