Skip to content

Commit

Permalink
- Fixed some small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
phongvcao committed Feb 28, 2015
1 parent d99c510 commit 17da903
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions autoload/stardict.vim
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ endfunction
function! stardict#StarDict(...)
let l:expl=stardict#GetDefinition(a:000)
let l:cur_file_name = expand('%')
if (&filetype ==# 'stardict')
let l:new_winnr = winnr()
endif
let l:cur_bufnr = bufnr('')
bufdo if (&filetype ==# 'stardict') | let l:cur_stardict_file_name = expand('%') | endif

Expand All @@ -60,12 +63,20 @@ function! stardict#StarDict(...)
silent! 1s/^/\=l:expl/
1

if (l:cur_file_name !=# '')
silent! execute 'aboveleft split '
if (l:cur_file_name !=# '') && (s:stardict_buf_count > 0)
if (g:stardict_split_horizontal)
silent! execute 'aboveleft split '
else
silent! execute 'aboveleft vsplit'
endif
silent! execute 'buffer ' . l:cur_file_name
else
if (s:stardict_buf_count > 0)
silent! execute 'aboveleft split '
if (g:stardict_split_horizontal)
silent! execute 'aboveleft split '
else
silent! execute 'aboveleft vsplit'
endif
silent! execute 'buffer ' . l:cur_bufnr
endif
endif
Expand All @@ -74,6 +85,10 @@ function! stardict#StarDict(...)
silent! execute 'bd ' . l:cur_stardict_file_name
endif

if exists('l:new_winnr')
silent! execute l:new_winnr . ' wincmd w'
endif

let s:stardict_buf_count = s:stardict_buf_count + 1

endfunction
Expand Down

0 comments on commit 17da903

Please sign in to comment.