I use Vim besides programming for blogging and commenting. The latter leads to a few hundred open textbuffers in tabs in gVim to be able to search for useful text over all comments and copy it into a new comment. I save the whole session when exiting gVim for auto-opening the buffers when restarting it.
Today, with 270 buffers open in 257 tabs, I ran into a weird problem when switching the tabs with the mouse (tabpagemax is set to 1000, but the fact that this error occured around the 256th tab is a bit suspicious - Is there some limiting setting in the GUI I don't know about?). If I'm on tab 255 and click on tab 256 gVim jumps to tab 254 instead of 256. With another click on tab 256 it instantly shows me tab 253, after another click on tab 256 it jumps back to tab 252 and so on.
When clicking on the last tab (257) gVim switches to the very first tab/buffer. If I open another tab Vim does it and navigating with gt and gT trough the additional tabs above tab 255 works fine but clicking on the new tab 258 opens tab 2. So I assume the tab counter of the GUI ends with 256. Is there a way to fix this?
(BTW: Sorry if my English is hard to understand. I'm not a native speaker of English.)
Congrats you found a bug. Read :h bugs and report it at vim_dev#vim.org. There is probably no way to fix it without recompiling vim.
Why do you have so many tabs? Do you really need tabs you probably could get by with just using the buffers. Read how to use buffers effectively.
Related
If you have multiple tabs, giving the :tabclose command "closes" the tab but does not delete it from the buffer list, so the tab still appears in the tab menu; however it is inaccessible. To fully remove the tab, one would have to provide the :bd command. I'm not sure what the purpose is of closing a tab without deleting it from the buffer-list. From what I can gather from the help document, tabpage.txt, is that you aren't even able to reopen the closed tab, although, I could very well be wrong on that. I am rather confused on the purpose of this command; It seems more efficient to just use :bd and not bother with :tabclose.
:tabclose tries to close all windows on a tab. If it succeeds then the tab is also closed.
Buffer is neither tab nor window. :bdelete is neither :bunload nor :bwipeout. 1 2 3 4
If you have multiple tabs, giving the :tabclose command "closes" the tab but does not delete it from the buffer list, so the tab still appears in the tab menu; however it is inaccessible.
You are confusing tab pages, windows, and buffers.
:tabclose closes the tab page. This also closes the windows contained in that tab page but the only effect it has on the buffers displayed in those windows is to hide them.
What is remaining after :tabclose is the buffers that were displayed in the windows contained by the tab page you closed. Since the buffer list is global and not tied in any way to either tab pages or windows, this is perfectly normal and expected.
To fully remove the tab, one would have to provide the :bd command.
No. The tab page was fully removed after :tabclose. :bd only "deletes" buffers.
I'm not sure what the purpose is of closing a tab without deleting it from the buffer-list.
Your tab page is not in the buffer list so what you describe only makes sense if you confuse tab pages, windows, and buffers.
See this answer of mine for more background tab pages, windows, and buffers.
I am using Sublime Text 3 and every time I press tab it will add an extra tab. My settings are to display tabs as an actual tab (not spaces) and is equivalent to 4 spaces. My issue causes a single tab to therefore create 2 tabs the length of 8 spaces.
For example, if I am trying to indent it will tab twice and I will have to delete one tab.
If I select a block of text it will indent it twice and result in the text being deleted and I have to undo it once to bring the text back.
Also, when using auto complete I normally hit tab to auto complete the first option. It will select the option and do a tab after it. I am not sure if this is an option or setting but its extremely annoying and I have not found a solution yet.
Sublime Text double tabs on tab key press
Sublime Text deletes/removes text on indentation / tab
Both problems are due to a popup (most often the SFTP free version popup for me) hiding in the background. If you make sure to close the popup windows every time they appear you will not get these issues. You could also pay for Sublime or the plugin to remove the popups.
In OSX you can't focus back on Sublime Text without clicking on the popup, so you will never have these problems.
I just had the same issue. I just restarted Sublime and it worked again, no need to reinstall or change any settings.
I just encountered this problem recently, and it appears to only happen on Windows. In my case, the pop-up "Hello! would you like to purchase sublime?" was open in the background, and that caused this issue for me. Once that pop-up is closed, everything works just fine.
Although the question is three months old at the time of writing, this might help people that are still looking for an answer. After having this issue for a while, it annoyed me so much that I traced back the issue.
The double tab issue only happened after a while, so I figured it was triggered by a certain key combination, being pressed wrongly. I've also noticed that the bug only occurred at Windows, not on Linux (Ubuntu).
After disabling all Sublime Text 3 plugins one by one, I've noticed that, for me, SFTP triggered the bug. This happened upon saving, SFTP started uploading, and displayed a evaluation notice. As I've purchased SFTP (and activated it), the double tab bug never occurred again. Even after enabling all other packages, the double tab never troubled again.
This is only one solution to the problem, your problem might originate from something else. Try to disable packages which might cause the problem and try to find the problem that way. It's a lot of work, but might get you the solution.
This solution worked for me on windows:
Just go to
View -> Layout -> Single
How can I get tabs in gVim to work like they do in most good IDEs? I say gVim specifically because that is the version of Vim that I use but I am open to alternatives.
I want the following things for my tabs:
Ctrl+Tab goes to the MRU (most recently used) tab.
Holding down Ctrl and then pressing Tab multiple times continues to change to the next most recently used tab every time you press Tab.
When ctags are built and working and you press Ctrl+], if this takes you to a different file it should open that file in a new tab or if a tab with that file is already open it should switch to that one.
Easy tab reordering with the mouse just by dragging them around.
I am posting all these as a single question because I am hoping there is a good single solution that will do all or most of these things instead of having to hack each customization in individually. I would think this would be the preferred behavior by most of us.
Vim has no built in MRU. There is at least one plugin for that, though, but I've never used it.
The tabs in Vim are not the same as the tabs in your IDE, they are more like perspectives. The equivalent of your IDE's tabs in Vim are buffers and "(split)windows". There are a number of ways to work with buffers including some native ones and a number of third party plugins. Some of these plugins have MRU-like features.
The Vim wiki has a bunch of pages about tabs.
Here's how global bookmarks work.
Let's say I have two tabs in my vim session. One showing foo.txt, one showing bar.txt. I go to line 10 in foo.txt and hit mA
Then I go to the other tab, showing bar.txt. I hit `A, and the workspace on that tab opens foo.txt, putting my cursor on line 10.
So now I have two tabs, both showing foo.txt. This is less than ideal.
How I want it to work is, if one of my active workspaces on any tab is showing the file I the bookmark system is trying to navigate too, move my focus to that tab. If the file isn't open, sure - open it in my active workspace.
Is there any way to make this possible?
Thanks!
This is not a problem with Vim's global bookmarks. It's a problem with Vim's tabs.
In most text editors, tabs serve as a list of currently open files, but in Vim, the buffer list serves this purpose. If you think of a tab in Vim as being like a saved layout for split windows, then you'll meet less friction. This answer sums it up nicely, and I made a screencast to try and explain how tabs can be used.
Here is a script that answers your initial question. But as far as I'm concerned, nelstrom is right: tabs are not meant to contains the others files, but other layouts.
How do I jump to markers within different tabs in vim?
I know that using a command like:
:%bdelete
Using this command I can close all buffers, in all tabs, what I'd like to do is to close all buffers open in the current tab, is that possible?
Usage:
What I'd like to do, is to open ViM and load :VSTreeExplorer and then open related files in the same window switching between them using :next and :previous and then open other files a new tab (with VSTreeExplorer as well), when I need to clean one of the tabs, I would like to use whatever command that closes buffers in the current tab.
For now, what I do is use :%bd and then open the VSTreeExplorer and start over...
Thanks
If you're done with a tab you can just use :tabclose.
:windo bd will delete all buffers in the current tab.
Buffers are global to the Vim instance, not confined to a specific tab page. A tab page is simply a way to organize windows and windows are simply a way to display a buffer. Zero or more windows (and therefore tab pages) can display the same buffer. Getting used to this concept should help your workflow in Vim.
The Vim wiki has a couple pages that give some more explanation and tips for using tab pages.