3

Create some test files,

touch a b c d

and open each in a tab,

vim -p a b c d

Modify file b. Go to tab c and issue :tabonly.

  • Expected behavior: a and d tabs are closed. b is not closed because it is in modified state.

  • Actual behavior: Only a tab is closed.

If the same is attempted by issuing :only command with windows, it works as expected.

Is the actual behavior documented or should it be considered a bug? Apparently :help :tabonly does not specify it.

Is there "the proper command" to get all unmodified tabs closed without raising dialogs, even if some other modified tab is in the way? Or some less verbose alternative to :tabd :sil :q?

  • use :set hidden – Christian Brabandt Aug 8 at 14:38
  • 2
    Between tab use and the implication that hidden is not enabled, it sounds like you are not availing yourself of the buffer-centric workflow that so many of us moved to at some point and now wouldn't move away from for all the tea in China. Am I telling you something you've already heard a hundred times? :) If so, don't take offense, it's just really that good and I try to convince everyone. If you need any guidance on that let us know. Cheers. – B Layer Aug 8 at 23:25
  • 1
    Two links relevant to BL's comment: stackoverflow.com/questions/26708822/… and joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs. As a new vim user, I too have taken the tab route. – DK Bose Aug 9 at 13:25
  • 2
    Thanks, DK, those are perfect. You saved me time I'd need to look them up. @Quasímodo I'd read the first two answers and accompanying comments of the first link and all of the second link. Why the comments? Because you might find handy shortcuts and the like (e.g. this super handy mapping: nnoremap <leader>b :ls<CR>:b). Another useful post though not about tabs vs buffers is the classic "your problem with vim is you don't grok vi" answer here: What is your most productive shortcut with Vim? :) – B Layer Aug 9 at 21:20
  • 2
    Thank you both DK Bose and B Layer for your guidance! This community is awesome. I am certainly going to read those. – Quasímodo Aug 9 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.