daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 56 forks source link

Windows vs Buffers #66

Open Zardoz89 opened 6 years ago

Zardoz89 commented 6 years ago

I noticed that the GUI TabLine handles vim "windows", and not buffers. There is a way to allow handle directly the list of buffers like Airline does on TUI ? imagen

SirJson commented 5 years ago

Same "Issue". After I understood what the differences are I wish nvim-gtk would allow me use GTK tabs like in vim-airline. I know that for most people tabs == tabs so I think it would be better if it another ginit.vim setting.

... or what I thought would be interesting: Let's fix the broken UI naming done years ago. Meaning something like buffers = tabs and tabs = workspaces for example. If done right it could feel like nvim-gtk just got two new features just by renaming things correctly. Still a "dangerous" move but worth trying. https://xkcd.com/1172/

alerque commented 5 years ago

@SirJson Repackaging upstream "features" under different names is a recipe for chaos and confusion. You could propose this at the Neovim level, but I think it would be a bad idea to do here.

Zardoz89 commented 5 years ago

I would expect that neovim-gtk works like neovim instead of doing different things. Tabs should handle buffers by default, not windows.

alerque commented 5 years ago

@Zardoz89 That's not how vim or neovim work.

Note that multiple buffers can be arranged in windows that are split various ways (same file, different files, etc.) In the following example there are three buffers open, in two tabs (windows), one of which is split vertically.

image

Your description (making tabs == buffers) would block all access to vim/neovim's existing tools. Tabs need to be windows, not buffers.

SirJson commented 5 years ago

@alerque Yes you are right that's why I said it is dangerous to do that, and tbh I don't think it will ever change.

Still the ability to use buffers as intended by the guy that introduced them while preserving the reason why I use neovim-gtk in the first place would be cool.

Since you can have both, tabs and buffers, at the same time and it is probably confusing and / or hard to do in GTK like in airline, maybe an optional second tab bar for buffers is the solution?

I could imagine a GUI setting that let's you have Vim tabs like they are now and Vim buffers on the right or left hand side. ..or the Vim Tabs on the side and Buffers on top.. what ever work better with GTK and makes sense if people choose to enable that GUI feature.

EDIT: Mh I see where you coming from though. My proposal would be still an addon and not a missing neovim feature.

alerque commented 5 years ago

Don't forget that buffers get used in other ways in vim/neovim. They are used as temporary scratch pads, used to compose things like auto-completion interfaces, used by plugins (fugitive, gundo, etc., not to mention things like the arg list!) to host their interfaces, etc. The concept of a tab (viewport) in vim is inherently a UI concept, and as such wrapping it (whether as windows or tabs or whatever UI choices you make) is properly the realm of the UI wrapper to do. Tabs is a natural fit for what vim's internal concept of a window is.

If a UI wants to integrate deeper into the workings by replacing the entire windowing interface it would need to replace the splits and handle displaying buffers in various configurations on demand including popups, etc. There is nothing wrong with doing that, but the suggestion here that buffers should be displayed as tabs in a UI clearly misunderstands the internal concept of a buffer at all. Note some other "modern" editors have buffers too. Atom for example lets you open one buffer in multiple tabs, etc. They are handling it much the same way behind the scenes, the user just isn't granted any access to do things with the buffers more directly.

Trying to wrap an interface on them will inherently limit their actual usefulness. If you want one buffer per tab open then open tabs instead of buffers.

SirJson commented 5 years ago

I totally understand what you are saying. Just reading it feels natural to me tho what many people argue is I can have one window / viewport but multiple open files. This is something I would expect from an editor with tabs. But I don't even know those files are still open because neovim just hides them when I open a new file. (Does Atom do the same? Would explain where all the memory is going :smile:)

So that convinced me to treat them as "Tabs" because as you said they even allow my to arrange them in different ways inside my viewport. Vim Tabs do not allow me to do that.

But then again I also think now this more of an upstream issue, an discussion probably older than me anyways, and as you said buffers are used for more than just code.