Skip to content

Commit 07c9575

Browse files
Merge pull request #1 from phux/master
Fixed importing in wrong window if multiple splits open
2 parents bae510a + 3d19d42 commit 07c9575

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

plugin/vim-php.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ let s:action = 'use'
1313
" Tag kinds, to use on s:GetTagKind(...)
1414
let s:kinds = {'c': 'Class', 't': 'Trait', 'i': 'Interface'}
1515

16+
let s:previous_win_nr = 0
17+
1618
" Define commands for PHP user
1719
command! PHPImportClass call s:PHPImportClass('use')
1820
command! PHPExpandFQCN call s:PHPImportClass('expand_fqcn')
@@ -22,6 +24,7 @@ command! PHPExpandFQCNAbsolute call s:PHPImportClass('expand_fqcn_absolute')
2224
" Start the import process
2325
"
2426
function! s:PHPImportClass(action)
27+
let s:previous_win_nr = winnr()
2528
let s:action = a:action
2629
let l:class = expand('<cword>')
2730
let s:tags = s:SearchTags(l:class)
@@ -88,6 +91,8 @@ function! s:SelectOption(index)
8891
let s:windowIsOpen = 0
8992
endif
9093

94+
execute ":".s:previous_win_nr."wincmd w"
95+
9196
if s:action == 'use'
9297
if s:FqcnExists(l:fqcn)
9398
call s:Message(l:kind.' "'.l:fqcn.'" already in use.')

0 commit comments

Comments
 (0)