wincent / command-t

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

Opening the same file causes a split #289

Closed trotzig closed 7 years ago

trotzig commented 7 years ago

When I open the same file that I have open in the active buffer, the window is :splitinto two. This is on v5.0. I believe the previous version didn't have this behavior.

This is my config:

let g:CommandTMatchWindowReverse   = 1
let g:CommandTMaxHeight            = 10
let g:CommandTMaxFiles             = 30000
let g:CommandTMaxCachedDirectories = 10
let g:CommandTScanDotDirectories   = 1
let g:CommandTFileScanner          = "watchman"
let g:CommandTEngine               = "isengard"
let g:CommandTClientLog            = "/tmp/commandt-client.log"
let g:CommandTServerLog            = "/tmp/commandt-server.log"
nnoremap <leader>f :CommandTFlush<CR>
nnoremap <silent> <leader>j :CommandTJump<CR>
nnoremap <leader>g :CommandTTag<CR>
if &term =~ "screen" || &term =~ "xterm"
  let g:CommandTCancelMap     = ['<ESC>', '<C-c>']
  let g:CommandTSelectNextMap = ['<C-j>', '<ESC>OB']
  let g:CommandTSelectPrevMap = ['<C-k>', '<ESC>OA']
endif

nnoremap <Space> :CommandT<CR>
nnoremap <Leader><Space> :CommandTFlush<CR>:CommandT<CR>
wincent commented 7 years ago

Thanks for reporting.

nnoremap <Space> :CommandT<CR>

Awesome.

Do you by any chance have any fanciness set-up like I used to have in my dotfiles? https://github.com/wincent/wincent/commit/35d430520d525e8ac4c829f4436e5b42c8df5dd8

I have a feeling that you need this:

set switchbuf=usetab
trotzig commented 7 years ago

I couldn't find anything fancy like what you used to have, but adding

set switchbuf=usetab

did the trick.

I'm going to close this assuming it's a user error. Thanks!

wincent commented 7 years ago

I can see other people running into this. I should at least document this, and also possibly consider (optionally) setting 'switchbuf' if it is still at the default value.