Saturday, November 28, 2009

Re: [Vim-l] Need good tab-page tips on Vim Tips wiki

On Thu, Nov 26, 2009 at 12:16 AM, Benjamin Fritz
<fritzophrenic@gmail.com> wrote:
>
> I'm sure there are clever ideas out there that leverage the power of
> tab pages in Vim, that are difficult or impossible to accomplish
> otherwise.

I mostly use tab pages for things I want close at hand, but out of the
way. Some examples off the top of my head:

* Multiple full-page Vim help topics, each in their own
conveniently-labeled tab page.

* Reference material (API docs, framework source code, project notes,
etc.) that I need to refer to often, but don't necessarily want taking
up screen real estate adjacent to whatever I'm working on.

* At-a-glance summaries: I sometimes work in a buffer with most or all
folds open, and keep a second tab page buffer with all folds closed.
The folded version serves as an overview of the entire file, usually
visible on a single screen.

* Quick Vim environment modifications: I'm always tweaking my Vim
settings, but I don't want to disrupt whatever I'm (supposed to be)
working on just to update my .vimrc. I have a key map that opens
$MYVIMRC and $MYGVIMRC in new tabs, so I can jump in and make whatever
changes are necessary, then close them and immediately go back to what
I was doing.

* "X-ray" buffers: I'll sometimes keep an alternate representation of
a buffer in a separate tab page, with useful but visually-noisy
options like 'list', 'cursorcolumn', 'cursorline', and 'number' all
turned on, several :match patterns active, etc. This way, I can keep
my regular working view clean and uncluttered, but quickly flip over
to the information-overload version (the "x-ray") when I need it. (You
don't have to get this crazy with it, of course; the idea works for
pretty much any setting in `:help option-summary` labeled 'local to
window'.)

* Scratchpads: Tab pages are good for throwaway buffers, where I work
with random chunks of text before (possibly) incorporating them into a
file I plan to keep around.

* Redirected Ex command output: I often want to use the output from an
Ex command (vs. just viewing it in the status area), so I have a
routine that runs a command, captures the output, then opens a new tab
page containing the captured text. As with most of these techniques,
this could also be done with a new window, or even within the current
window, but I find using a new tab page less disruptive.

* Mini-sessions: If you remove 'tabpages' from 'sessionoptions',
:mksession will only pay attention to the current tab page. This makes
it easy to use tab pages as a lightweight project-organization tool --
just open a set of files in whatever window layout you like, then run
`:mksession some-random-project.vim` to save the current tab page as a
session. To work on that set of files again, open a new tab page and
:source the appropriate session file.


I don't know if any of these rise to the level of full-blown tips, but
perhaps they'll spur discussion.

Thanks,
Bill

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment