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

Buffer swithching commands with ordinal numbers #17

Closed cenkalti closed 8 years ago

cenkalti commented 8 years ago

I am used to switch buffers by specifying their numbers instead of pressing :bn or :bp shortcut key repeatedly. There is an implementation of this feature in airline which I am currently using:

https://github.com/vim-airline/vim-airline/blob/30f078daf569e7d5e4f7829e39316387af349b41/doc/airline.txt#L555

Is it possible to add this feature in vim-buftabline?

Would you merge it if I make a PR?

ap commented 8 years ago

There’s code in the thread of #11 for that, but I didn’t think of <Plug> mappings for it. That would be a useful feature to ship. But I won’t ship default keybindings with the plugin (because I don’t think it can do a good enough job of picking defaults, and it would require another on/off preference, which I don’t like adding).

So, I’ll take patches for that – though you may have to tolerate me amending the patches. :smile: But I’ll ship the feature regardless of whether you provide a patch for it.

MiguelLatorre commented 8 years ago

+1 I was about to ask for this too.

cenkalti commented 8 years ago

Fixed in a3e32bd322b909f20f87a2c7ddabf6416dc21cec

ap commented 8 years ago

Ah yeah, sorry, forgot to close this.

And sorry it took me so long to get around to pushing it out. The plug names derailed me.

The reason I ended up changing them is because I wanted to have a plug for the 10th buffer. But adding <Plug>BufTabLineSelectBuffer10 mysteriously broke <Plug>BufTabLineSelectBuffer1. Actually of course, it didn’t, it just made it ambiguous, so Vim would wait to see if the next character was a 0 before executing the mapping. It took me a day or so to figure that out… embarrassingly long anyway.

The solution is obvious: putting a non-numeral after the buffer number removes the ambiguity and then Vim can execute the mapping immediately. But that meant I had to pick some other name, and then I got sidetracked thinking about which choice I liked best…

And then I got busy with other stuff and forgot about this patch for a while.

Anyway, hope the wait was worth it. Share and enjoy. :smile:

cenkalti commented 8 years ago

No problem. The solution is perfect, thank you :)