From 7658794ad3602ba0946e8f96af902008badb61c3 Mon Sep 17 00:00:00 2001 From: Serhii Yaniuk Date: Wed, 26 Sep 2018 11:56:45 +0300 Subject: [PATCH] Added leading \ for expanded result and respective option --- plugin/phpns.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/phpns.vim b/plugin/phpns.vim index ddcc37d..5293a3e 100644 --- a/plugin/phpns.vim +++ b/plugin/phpns.vim @@ -12,6 +12,10 @@ let g:php_namespace_sort = get(g:, 'php_namespace_sort', "'{,'}-1sort i") let g:php_namespace_sort_after_insert = get(g:, 'php_namespace_sort_after_insert', 0) +if !exists("g:php_namespace_expand_to_absolute") + let g:php_namespace_expand_to_absolute=0 +endif + function! PhpFindMatchingUse(name) " matches use [function] Foo\Bar as @@ -163,7 +167,11 @@ function! PhpExpandClass() if fqn is 0 return endif - substitute /\%#[[:alnum:]\\_]\+/\=fqn[1]/ + if g:php_namespace_expand_to_absolute + substitute /\%#[[:alnum:]\\_]\+/\='\'.fqn[1]/ + else + substitute /\%#[[:alnum:]\\_]\+/\=fqn[1]/ + endif exe restorepos " move cursor after fqn call search('\([[:blank:]]*[[:alnum:]\\_]\)*', 'ceW')