Skip to content
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

clickable buffers in tabline #369

Closed
patflick opened this issue Dec 4, 2013 · 23 comments
Closed

clickable buffers in tabline #369

patflick opened this issue Dec 4, 2013 · 23 comments
Assignees
Labels

Comments

@patflick
Copy link

patflick commented Dec 4, 2013

First of all, thanks for vim-airline - it's awesome! 👍

A small remark:
So far only tabs are clickable in the tabline, not the buffers in case there is only one tab. Double click on a buffer opens a new empty tab (is this intended?).

It would be cool if you could fix this.

Thanks!

@bling
Copy link
Member

bling commented Dec 5, 2013

unfortunately this cannot be done. the tabline is supposed to be used for tabs, not buffers....and airline is more or less using a clever hack to display the list of buffers instead. all the exposed mouse events assume you are clicking on tabs....so unless support is exposed by vim itself, there's nothing i can do here....

@robinro
Copy link

robinro commented Apr 28, 2015

I just had the same feature wish as @r4d2 above.

Tabline is used by quite a lot of people only for buffers; maybe there's another way to do this.
A seperate "bufferline" extension that assumes a single tab only should be able to do this, right?
@bling Can you point me to the file, where the mouse actions for the tabline are handled? I don't know much about vimscript yet.
Thanks for all your work on vim-airline 👍

@bling
Copy link
Member

bling commented May 1, 2015

@robinro i don't know of an easy way to do this...vim only exposes that "tab 3" was clicked. there's no autocmd that exposes that the mouse was clicked. getchar() can do it, but you would need to call it before you click the mouse....

@ZyX-I
Copy link

ZyX-I commented Nov 17, 2015

@taohex You write %{N}T…%T (also %{N}X…%X) in the tabline and this when mouse clicking makes Vim run something like tabnext N (tabclose N for %X) when clicking on . There are no events run for these actions, except for the events which are consequences of switching/closing tabs which are run after the switch/close was initiated.

@harrysummer
Copy link

Hi, @ZyX-I could you please give us a simple example of how to make buffer tabline clickable after applying your patch to neovim? Thank you!

@ZyX-I
Copy link

ZyX-I commented Dec 30, 2015

@harrysummer Buffer segment for buffer 42 should look like

%42@SwitchBuffer@{segment contents}%X

where SwitchBuf is

function SwitchBuffer(minwid, clicks, button, modifiers) abort
    " Run the following code only on a single left mouse button click without modifiers pressed
    if a:clicks == 1 && a:button is# 'l' && a:modifiers !~# '[^ ]'
        execute 'buffer' a:minwid
    endif
endfunction

@ZyX-I
Copy link

ZyX-I commented Feb 2, 2016

@bling Note that my PR was merged into Neovim, so this issue can be reopened. PR added has('tablineat') support, so it is easy to check for the presense of the feature.

@chrisbra chrisbra reopened this Feb 2, 2016
@chrisbra
Copy link
Member

chrisbra commented Feb 2, 2016

I'll look into it.

chrisbra added a commit to chrisbra/vim-airline that referenced this issue Feb 9, 2016
This should theoretically fix vim-airline#369

Testing would be appreciated, as I do not use NeoVim
chrisbra added a commit to chrisbra/vim-airline that referenced this issue Feb 9, 2016
This should theoretically fix vim-airline#369

Testing would be appreciated, as I do not use NeoVim
chrisbra added a commit to chrisbra/vim-airline that referenced this issue Mar 1, 2016
This should theoretically fix vim-airline#369

Testing would be appreciated, as I do not use NeoVim
@pierz
Copy link

pierz commented Jul 25, 2017

I realise this issue is closed but I had a related question about using airline with tabs and buffers. It seems if they are both enabled in airline's tabline and if one clicks on the current tab filename in the top right corner it toggles to show the 'buffers' but how does one switch back to tab view?

@chrisbra
Copy link
Member

I think this is an unintended side-effect, this is not supposed to happen at all, I believe. This is a neovim thing, right?

@pierz
Copy link

pierz commented Jul 30, 2017

No this is happening in vim v7 and v8 on OSX and Linux.

@tuxflo
Copy link

tuxflo commented Dec 20, 2017

Hey guys! I'm just too confused with all those referenced issues/merges and cloded tags.
Just the simple question: is it possible to get a clickable bufferline in vim 8.x or neovim and if so: how?
If I try to click in nvim in the terminal (konsole in my case) nothing happens, if I click in vim new tabs with [No Name] are created. I don't use tabs at all so I just want to know how to use the buffers.
Thanks,
Flo

@chrisbra
Copy link
Member

clickable buffer line is supported only in neovim. In Vim closing the current tabpage should occur if you click on the X or a new tab will be created. Check your 'mouse' setting.

@tuxflo
Copy link

tuxflo commented Dec 20, 2017

OK thanks for the hint! If anybody else has this issue: try set mouse=a helped for me.
Just one more thing: is it possible to disable the "Tab behavior" completely? As I said II just use buffers.

@wsdjeg
Copy link
Contributor

wsdjeg commented Jul 3, 2018

@chrisbra hello I can not understand your last comment, when double click on tabline, it will create a new tab, any option for this? as I know, I can use %{N}T for jump to tab N, %{N}X for close tab N, but how to config double click?

@ZyX-I
Copy link

ZyX-I commented Jul 3, 2018

@wsdjeg If has('tablineat') returns 0 there is nothing you can do. If it returns 1 then you should have documentation on relevant option somewhere around documentation for %{N}T. My comment above provides an example. Currently feature is supported only in Neovim.

@wsdjeg
Copy link
Contributor

wsdjeg commented Jul 4, 2018

@ZyX-I Thanks, I have added the feature to my neovim's config, it works well for me now.

@sanigo
Copy link

sanigo commented Apr 30, 2020

Could macvim be supported?

@chrisbra
Copy link
Member

chrisbra commented Apr 30, 2020 via email

@uninhm
Copy link

uninhm commented Aug 27, 2020

Reopen this for Vim

@chrisbra
Copy link
Member

chrisbra commented Aug 27, 2020 via email

@uninhm
Copy link

uninhm commented Aug 27, 2020

What do you mean? It currently is not possible for vim

If tabs are clickable, buffers why not?

@chrisbra
Copy link
Member

chrisbra commented Aug 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

13 participants