Tuesday, October 9, 2012

Re: buffers in splits

On 09/10/12 23:23, shawn wilson wrote:
> is there a way to change the buffer position based on what file you're editing?
>
> what i generally do is have a split (window?) that i want to toggle
> between two files in, but if i have two other files i want to toggle
> between in another window, this becomes an issue as i need to remember
> my current place in the buffers and i can't just bn/bp . is there a
> way to do this?
>
> if not (i've seen this question posted but can't find it) - how do i
> figure out which window i'm in so that i buffer list use to reorder
> buffers with?
>

As ben said, :e # or :b # (where # is an explicit number sign) will
switch to the alternate file (usually, the latest file edited in the
current window before the current one).

Ctrl-^ (Control-circumflex; on QWERTY keyboards, Control-6 or
Control-Shift-6; on some AZERTY keyboards including mine,
AltGr-Control-6; …) will also do the job; depending on your keyboard
layout and on your agility it might be faster.

Also, to figure out where you are, the default status line includes the
name of the file currently loaded in its window; the status line for the
current window has a distinctive highlight (by default, it uses bold
type; but that may vary depending on your colorscheme if you use one).

In a script, winnr() returns the current window number (from 1 at top
left, to the last number, equal to number of windows in the current
tabpage, at bottom right), and expand('%') or (for a full path)
expand('%:p') returns the name of the current file; similarly,
expand('#') or expand('#:p') for the alternate file.

Moving windows around (and in general moving around windows, changing
their relative widths and heights, etc.) is done with Normal-mode
commands prefixed by Ctrl-W, or (especially in a script) by means of the
":wincmd" ex-command.


..."so that i buffer list use to reorder buffers with" I I sure this not
understand am rightly if. Would explanation better like a I.


Best regards,
Tony.
--
Help me, I'm a prisoner in a Fortune cookie file!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment