Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

vim - How to show tab close button in GVIM?

Please let me know how to show the close button on each tab page in GVIM.

Also, is it possible to set a warning if I am closing GVIM with multiple tab pages open?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Short Answer

Use buffers effectively!

Long answer

You might consider use :tabclose to close your tabs. This has the benefit of closing the tab (and keeping you away from your mouse) but also being just annoying enough to motivate a workflow change over to using buffers and splits. As for a warning about closing a tab with multiple windows, I see little benefit if you have 'hidden' set then the buffers are still there so no harm. If you do not have 'hidden' than any modified buffers will be prompted before they are closed.

Why not tabs

Tab pages are great. However it all comes down to vim treating tab pages as more of view-ports into a group of windows or workspaces. Tab pages just don't scale well. Just open some other GUI editor and open up 20 or so tabs. It becomes tricky to deal with. I have had over a 100 buffers open and switch between them without worrying. Buffers just scale in ways that tabs do not. Buffers and splits also work well with smaller windows which is often the case when using terminals.

Don't just take my word for it. Here are some more supporting information:

Quick Buffer Tips and Tricks

  • set hidden will hide buffers when abandoned.
  • Use :sb to switch to a buffer you already opened.
  • :sb and :b both can take partial names and globs. e.g. :sb foo*
  • Take a look at 'switchbuf' and change to your preferences.
  • Learn to love :sp, :new, and all type of split commands.
  • Learn some <c-w> commands to make your life with splits easier.
  • Use capital letter marks to jump back to buffers where you know you will jump back to.
  • Use tags to jump to definitions.
  • Possibly use cscope along with tags
  • Use <c-6> to switch to the previously edited file.
  • Use <c-o> and <c-i> to move older/newer positions in your jump list.
  • Possibly make use of one of the many buffer plugins out there. e.g CtrlP

For more information see:

:h :sb
:h windows
:h 'hidden'
:h 'swb'
:h ctrl-6
:h ctrl-o
:h tags
:h cscope
:h tab-page-commands

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...