Skip to content

Commit

Permalink
Merge pull request #1 from phux/master
Browse files Browse the repository at this point in the history
Fixed importing in wrong window if multiple splits open
  • Loading branch information
sahibalejandro committed Apr 29, 2017
2 parents bae510a + 3d19d42 commit 07c9575
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugin/vim-php.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ let s:action = 'use'
" Tag kinds, to use on s:GetTagKind(...)
let s:kinds = {'c': 'Class', 't': 'Trait', 'i': 'Interface'}

let s:previous_win_nr = 0

" Define commands for PHP user
command! PHPImportClass call s:PHPImportClass('use')
command! PHPExpandFQCN call s:PHPImportClass('expand_fqcn')
Expand All @@ -22,6 +24,7 @@ command! PHPExpandFQCNAbsolute call s:PHPImportClass('expand_fqcn_absolute')
" Start the import process
"
function! s:PHPImportClass(action)
let s:previous_win_nr = winnr()
let s:action = a:action
let l:class = expand('<cword>')
let s:tags = s:SearchTags(l:class)
Expand Down Expand Up @@ -88,6 +91,8 @@ function! s:SelectOption(index)
let s:windowIsOpen = 0
endif

execute ":".s:previous_win_nr."wincmd w"

if s:action == 'use'
if s:FqcnExists(l:fqcn)
call s:Message(l:kind.' "'.l:fqcn.'" already in use.')
Expand Down

0 comments on commit 07c9575

Please sign in to comment.