Skip to content

Commit e716da1

Browse files
committed
Merge pull request derekwyatt#8 from okcompute/master
Switch buffer if file is opened instead of calling edit all the time.
2 parents 8ac2f79 + 8a8fa09 commit e716da1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugin/fswitch.vim

100644100755
+5-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ function! FSwitch(filename, precmd)
315315
if strlen(a:precmd) != 0
316316
execute a:precmd
317317
endif
318-
execute 'edit ' . fnameescape(newpath)
318+
if bufexists(newpath)
319+
execute 'buffer ' . fnameescape(newpath)
320+
else
321+
execute 'edit ' . fnameescape(newpath)
322+
endif
319323
else
320324
echoerr "Alternate has evaluated to nothing. See :h fswitch-empty for more info."
321325
endif

0 commit comments

Comments
 (0)