wincent / command-t

⌨️ Fast file navigation for Neovim and Vim
BSD 2-Clause "Simplified" License
2.74k stars 317 forks source link

Command-t opens the file in the wrong window when BufExplorer is open #344

Closed mgedmin closed 5 years ago

mgedmin commented 5 years ago

I have one split with two files displayed: filea.txt on top, fileb.txt on bottom. I want to open filec.txt. I think I may already have it loaded, so I trigger BufExplorer on the top pane. I see that I was wrong and filec wasn't loaded. Now I want to replace the topmost pane (which is still focused) with filec.txt, so I trigger Command-T, type filec, hit Enter.

What happens: the bottom pane gets filec.txt, the top pane continues showing bufexplorer.

What I wish to happen: the top pane should get filect.txt, the bottom pane should continue showing fileb.txt.

When bufexplorer is not in the picture, everything works like I expect. I think bufexplorer might be setting some options (&buftype?) that make command-t treat it specially.

mgedmin commented 5 years ago

The solution is to put

let g:CommandTWindowFilter = '!&buflisted && &buftype == "nofile" && &filetype != "bufexplorer"'

in my .vimrc.

wincent commented 5 years ago

Thanks for documenting that. I forgot that g:CommandTWindowFilter even existed.