-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After being opened then closed once, files are always opened in a horizontal split regardless of the command used #298
Comments
Thanks for the awesome bug report @gmalkas. I haven't seen this myself, but I'll see whether I can repro using your recipe. |
I haven't been able to repro this. What version of Command-T are you using? What is the output of |
As for Command-T version:
Let me know if there's anything else I can try. Thanks! |
@wincent So I went debugging with the good old The Ruby code is doing the correct thing as far as I can tell, it's passing the proper command to the vimscript (e.g. The vimscript is where the issue is. I've changed if bufwinnr('^' . l:file . '$') != -1 ||
\ (bufexists(l:file) && !s:BufHidden(l:file))
call writefile(["I am in the if"], "/tmp/gotooropen.log")
execute 'sbuffer ' . l:file
else
call writefile(["I am in the else"], "/tmp/gotooropen.log")
execute l:command . l:file
endif When I open with a vertical split the first time and it works, I see "I am in the else". When I try a vertical split again, I see "I am in the if".
The issue is that Changing Let me know if all that makes sense to you. Thanks again for taking a look. |
No wonder my simple attempt at reproing didn't work.
Thanks for digging in to that! |
Let's see if that fixes it without breaking any other use cases. If it does, we'll squish them as they come up. |
vim-plugins/command-t tip: commit 85949ce7a70a26abf6f9d355e38d1473facba022 Author: Greg Hurrell <[email protected]> Date: Tue Jul 11 18:35:24 2017 -0700 Fix unwanted split opening behavior Similar to the fix we applied in 595976eb70ba3a2f7a2932eeb4 to fix wincent/command-t#295 looks like we have to deal with this edge case too. Closes wincent/command-t#298
This is a regression introduced in 85949ce. That one attempted to fix #298 by applying a similar fix to the one used in #295. However, it only worked by luck: `bufexists()` doesn't support patterns or use of "$"/"^" to anchor the match like `bufwinnr()` does. This meant that adding those anchors made it always false. That fixed the unwanted splits in #298, but it meant that you couldn't go back to an existing file in another tab. The fix is pretty straightforward: switch from `bufexists()` to `bufname()`, because the latter does support anchoring. As far as I can tell, this fixes #306 without breaking the scenario detailed in #298. The one gotcha here is that we can't rely on the truthiness of the non-empty string returned by `bufname()` here, because crazy old Vimscript coerces also strings to `0`; we therefore have to use an explicit check against `''`. Closes: #306
Hi,
I'm having some weird issue with opening files from
command-t
.It works as expected at first (
<C-v>
opens in a vertical split,<CR>
opens in the current buffer, etc) but then when opening the same file every mapping opens in a horizontal split. Opening a file that was not opened yet in the current vim process works as expected.Here's an example:
Expected Behavior
When opening
user.ex
for the second time using<C-v>
, it should be opened in a vertical split.Observed Behavior
It is opened in a horizontal split.
All subsequent opening of a file that was already opened (then closed) leads to a horizontal split, regardless of the command used.
Setup
I'm running on Mac OS X with iterm2, vagrant and a Ubuntu VM. I've tried outside of tmux and the same behavior is observed. I have
stty -ixon
in my.profile
.I've removed all plugins apart from
command-t
before testing (I'm using pathogen, I simply directed pathogen to a different folder thanbundle
containing onlycommand-t
).Of course I'm not 100% sure it's due to a
command-t
bug, but the fact that it initially works properly seems to rule out any kind of weird keybinding interaction between iterm/tmux/bash/vim.Note: I'm pretty sure I pulled from
master
a week or two ago so it may have appeared recently. Not 100% sure though so to take with a grain of salt..vimrc
I've tried with the following "minimal"
.vimrc
and it still behaved as described:vim --version
I've compiled vim myself as I wanted some additional support for
clipboard
server-side:Thank you for your time and thanks a ton for the amazing work on
command-t
, it's an essential part of my workflow.The text was updated successfully, but these errors were encountered: