Comments (4)
Related, you cannot even close any non-named buffer without raising this error (try :enew
). One helpful datapoint: If before deleting the non-named buffer, you set :setlocal bufhidden=hide
then the error doesn't happen. I think it's because with bufhidden=delete
(or even the default value of empty string) the buffer is deleted twice - once by default and once by wintabs. But bufhidden=hide
it doesn't fully delete the buffer when wintabs tries to remove it after modifying the unnamed buffer.
from vim-wintabs.
Thanks for flagging this! Will fix it soonish.
from vim-wintabs.
And with the following config:
let g:wintabs_display='statusline'
set hidden
let g:wintabs_autoclose=2
let g:wintabs_autoclose_vim=1
let g:wintabs_autoclose_vimtab=1
let g:wintabs_switchbuf='useopen,usetab'
let g:wintabs_ui_active_higroup = 'TabLineSel'
As mentioned in the initial description closing the first/only non-named modified buffer works.
But then with that new config, closing the first/only named buffer does not work if you have modifications.
In this case, I think the problem is this function which is called before bdelete
on the unnamed buffer.
function! s:switch_tab(n, confirm)
" do nothing if n >= size
if a:n >= len(w:wintabs_buflist)
return
endif
" set nohidden to trigger confirm behavior
let hidden = &hidden
let &hidden = 0
if a:n < 0
execute a:confirm ? 'silent! confirm enew' : 'enew!'
else
let buffer = w:wintabs_buflist[a:n]
execute a:confirm ? 'silent! confirm buffer '.buffer : 'buffer! '.buffer
endif
" restore hidden
let &hidden = hidden
endfunction
which is called before "purge"ing the unnamed buffer via bdelete
.
The silent! confirm buffer
switches to another tab, and since nohidden
is set on the unnamed buffer it is deleted. Then when you later try to bdelete
it it's already gone.
This is actually hard to get right because you rely on the tab switching function to trigger the confirmation if the buffer does happen to implicitly hidden when switching away from it and if it's not displayed in any other window. I think you might just be able to get away with not ever purging. This seems to restore proper functionality from what I can tell by testing. I think what you can do after any interaction, is to examine what the end result was - which buffers ended up being completely unloaded wintabs, yet remained listed by vim - and then only purge those, instead of trying to predict which buffer number must be purged
based on the interaction at hand. You can instead inspect what Vim sees at the end of each interaction and purge according to that.
Simply commenting out the bdelete
line works well - the UI is always up to date, and there's no errors. The only downside is that there's some useless buffers listed in buffers
. Seems better than having errors though.
from vim-wintabs.
This should be fixed now. Thank you for the analysis @jordwalke, it helped me resolve another issue. Some of the edge cases we see here are indeed caused by wintab's reliance on the interaction between "confirm" and "hidden".
Due to the recent vim changes on "silent!"+"confirm", I'm not very sure if I'm fixing the right thing (I removed some "silent!" to bubble up exceptions). Please test out the new version and let me know if things still behave correctly and consistently.
from vim-wintabs.
Related Issues (20)
- When restoring from Vim session, buffers from other tabs are copied into the active tab HOT 3
- [Feature request] Close tabs (buffers) to the left/right like chrome HOT 2
- Support displaying vimtabs when statusline display is enabled HOT 2
- Setting g:wintabs_display = 'none' followed by :WintabsRefresh does nothing HOT 2
- Allow overriding buf_label specifically HOT 1
- Request: Ability to click on statusline buffers HOT 1
- If two files are opened only first is displayed in wintabs HOT 3
- Option to disable tabline if only one buffer is open HOT 1
- After closing a tab, the tabbing order doesn't flow correctly
- How to exit vim after closing the last Wintabs?
- Vim error with switchbuf="useopen" in vimdiff
- Colors and styles support HOT 2
- :mkview followed by :loadview makes a buffer tab disappear
- split windows and buffers (when using g:wintabs_display = 'tabline')
- [question] change buffer status line colours HOT 1
- Buffer number HOT 1
- Strange marks in tabline HOT 1
- buffers for each tab rather than window
- persistence of folds between tabs (or buffers in a window)
- Does this project support bufferline.nvim?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-wintabs.