From 22c4b46a3b81ddebf95fa27028c12344e59b94b3 Mon Sep 17 00:00:00 2001 From: slycelote Date: Sat, 12 Mar 2016 15:00:36 -0800 Subject: [PATCH] Revert "Switch buffer if file is already opened instead of always call edit." This reverts commit 8a8fa0948c2732389358985fbbfc0d6b98de2ee9. 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/vim-fswitch#11) Reverting it solves both. --- plugin/fswitch.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) mode change 100755 => 100644 plugin/fswitch.vim diff --git a/plugin/fswitch.vim b/plugin/fswitch.vim old mode 100755 new mode 100644 index 68fd958..9db2387 --- a/plugin/fswitch.vim +++ b/plugin/fswitch.vim @@ -315,11 +315,7 @@ function! FSwitch(filename, precmd) if strlen(a:precmd) != 0 execute a:precmd endif - if bufexists(newpath) - execute 'buffer ' . fnameescape(newpath) - else - execute 'edit ' . fnameescape(newpath) - endif + execute 'edit ' . fnameescape(newpath) else echoerr "Alternate has evaluated to nothing. See :h fswitch-empty for more info." endif