Skip to content

Commit 22c4b46

Browse files
committed
Revert "Switch buffer if file is already opened instead of always call edit."
This reverts commit 8a8fa09. The problem that it is supposed to address ("the cursor always returns at the beginning of the file") is not specific to fswitch and can be fixed by an autocommand in a more generic way (autocmd BufWinEnter * exe "normal! g`\""). On the other hand, this commit introduces two problems: - when switching to an unlisted buffer, it remains unlisted. This leads, for example, to counterintuitive behavior in buftabline (and probably other similar plugins): currently opened buffer is not in buffer list. - problem with opening symlink buffers (derekwyatt#11) Reverting it solves both.
1 parent e716da1 commit 22c4b46

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

plugin/fswitch.vim

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

0 commit comments

Comments
 (0)