ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
782 stars 75 forks source link

Mouse support in Vim 8.0 or earlier #6

Open adelarsq opened 9 years ago

adelarsq commented 9 years ago

When doing a double click to change between buffers the tabline looks like: image Would be nice support mouse click.

ap commented 9 years ago

Yes, it would be nice. But it’s very difficult to make it work without glitches. And turning on this feature would make it impossible to use regular Vim tabs at all. If you’re interested, you can try picking up the krazy branch and finishing what I started, and I shall be happy to look at the results. But I do not intend to put further work into it myself, sorry.

adelarsq commented 9 years ago

It's more difficult than I thought https://github.com/bling/vim-airline/issues/369 Anyway, thanks for the quick response.

ap commented 9 years ago

I don’t know that it’s impossible; it could be that sufficiently clever hackery can make it work, as long as you are willing to give up Vim tabs completely forever.

Then the basic approach is to have as many extra Vim tabs as you have buffers. You can then intercept the tab change events caused by the user clicking on the tabline, and switch buffers accordingly.

The problem is making sure that the buffer and window management works exactly like it would if you only had a single Vim tab. E.g. keeping Vim from creating or not-closing empty buffers in various circumstances.

I got most of the way there with several different approaches, each with another combination of tricks to create the right illusion, but each approach had its own cases in which the illusion broke. I didn’t manage to make any of them work perfectly. In the end I gave up.

Someday in the future I may try again, and one of these attempts may even succeed.