Careful when using ctrl+w

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Careful when using ctrl+w

Ven Tadipatri
I was trying to create a new window in vi, so I held ctrl+w then hit
the underscore. But I was surprised when instead of giving me a new
window, the font changed.
   Here's something to bear in mind:
1)Hold ctrl+w, release w, then hit the -/_ key -- the font size
changes. You can undo this by doing ctrl+w, then shift and the +/=
key. I think this is some terminal hotkey, not something in vi (I'm
using CentOS).
2)Hold ctrl+w, release both keys, then hold shift, and press the -/_
key...ok, wait that was not a new window, rather it maximizes the
current window/buffer (could someone refresh me on the
register/buffer/window distinction?)

So anyway, just be careful when you're using ctrl, w, the -/_ and +/= key.

Thanks,
Ven

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Careful when using ctrl+w

Tim Chase
On 12/09/11 18:29, Ven Tadipatri wrote:
> 1)Hold ctrl+w, release w, then hit the -/_ key -- the font
> size changes. You can undo this by doing ctrl+w, then shift
> and the +/= key. I think this is some terminal hotkey, not
> something in vi (I'm using CentOS).

yes, this is a terminal-specific thing.  I tried in an xterm and
my default rxvt and neither changed the font (similar
non-occurrence when remoted into vim/gvim running on a Win32 box
at work).  I don't know if you're using Gnome Terminal or some
other terminal emulator, but control-+ and control+- are common
keychords for increasing/decreasing the font in other
applications such as Firefox, Chrome, etc.

> 2)Hold ctrl+w, release both keys, then hold shift, and press
> the -/_ key...ok, wait that was not a new window, rather it
> maximizes the current window/buffer (could someone refresh me
> on the register/buffer/window distinction?)

Register
--------
something akin to the copy/paste hold space. Can contain other
things like the current file name, the alternate file name,
expression-evaluation, etc.  Populated with things like

   "aY     puts the current line in register "a"

and the lettered (a-z) registers can be appended-to by using the
upper-case version when populating them such as

   "AY

Managed primarily through yanks/deletes into a register name
(though certain ones such as the filename ones are managed by Vim)


Buffer
------
An internal representation of a file. Also contains things like
undo history, etc.

Window
------
A view into a buffer.  Can split the current display/tab into
multiple windows, with zero or more views into your various
buffers.  Split windows can be resized, closed, or maximized to
the extent of the containing session/instance (the gvim window or
the terminal), modulo various settings controlling the min window
height/width, console height, visibility of GUI chrome (menu,
toolbar, scrollbars, etc).  Managed primarily through the
control+W family of commands.

Tab
---
Contains multiple windows in an individual Vim session.  Managed
primarily through the :tab* family of commands.

Session/Instance
----------------
One copy of Vim running in memory.  Gvim can be
maximized/minimized/resized/pinned/shaded per your OS/GUI
controls; terminal vim only gets min/max/resize/pin/shade
happening via the containing terminal window.  Managed by your
OS/shell.


So your control-W concerns with -/+ only seem to be an issue if
your containing environment (e.g. Gnome Terminal) intercepts them
and does unexpected things with them :)  Allow me to recommend
xterm or rxvt :)

-tim



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Careful when using ctrl+w

Ven Tadipatri
Hi Tim,
   The neat thing about VI is that the more you work with it the more
neat things
you learn about it, mostly through experimenting rather than reading
lengthy documentation.
   Well I wasn't sure what kind of terminal I had - but you're right,
it's Gnome 2.16.0.
I'm pretty used to using this terminal so I don't know if I want to
install/configure rxvt or xterm. I'm using CentOS so I don't know if
these are available for it.
   Registers I'm fairly comfortable with - it's just that these terms
are often overloaded - something like "buffer", to me at least, means
a temporary storage location, which I kind of think of as registers.
   I think what I was getting confused with is the concept of Windows
versus tabs.
Like if I do a ":new", is that a new "window" or a new "tab". Ok, I
guess if I'm using "ctrl+___W___", then that probably means it's a new
"__W__indow"

Thanks,
Ven

On Fri, Dec 9, 2011 at 7:56 PM, Tim Chase <[hidden email]> wrote:

> On 12/09/11 18:29, Ven Tadipatri wrote:
>>
>> 1)Hold ctrl+w, release w, then hit the -/_ key -- the font
>> size changes. You can undo this by doing ctrl+w, then shift
>> and the +/= key. I think this is some terminal hotkey, not
>> something in vi (I'm using CentOS).
>
>
> yes, this is a terminal-specific thing.  I tried in an xterm and my default
> rxvt and neither changed the font (similar non-occurrence when remoted into
> vim/gvim running on a Win32 box at work).  I don't know if you're using
> Gnome Terminal or some other terminal emulator, but control-+ and control+-
> are common keychords for increasing/decreasing the font in other
> applications such as Firefox, Chrome, etc.
>
>
>> 2)Hold ctrl+w, release both keys, then hold shift, and press
>> the -/_ key...ok, wait that was not a new window, rather it
>> maximizes the current window/buffer (could someone refresh me
>> on the register/buffer/window distinction?)
>
>
> Register
> --------
> something akin to the copy/paste hold space. Can contain other things like
> the current file name, the alternate file name, expression-evaluation, etc.
>  Populated with things like
>
>  "aY     puts the current line in register "a"
>
> and the lettered (a-z) registers can be appended-to by using the upper-case
> version when populating them such as
>
>  "AY
>
> Managed primarily through yanks/deletes into a register name (though certain
> ones such as the filename ones are managed by Vim)
>
>
> Buffer
> ------
> An internal representation of a file. Also contains things like undo
> history, etc.
>
> Window
> ------
> A view into a buffer.  Can split the current display/tab into multiple
> windows, with zero or more views into your various buffers.  Split windows
> can be resized, closed, or maximized to the extent of the containing
> session/instance (the gvim window or the terminal), modulo various settings
> controlling the min window height/width, console height, visibility of GUI
> chrome (menu, toolbar, scrollbars, etc).  Managed primarily through the
> control+W family of commands.
>
> Tab
> ---
> Contains multiple windows in an individual Vim session.  Managed primarily
> through the :tab* family of commands.
>
> Session/Instance
> ----------------
> One copy of Vim running in memory.  Gvim can be
> maximized/minimized/resized/pinned/shaded per your OS/GUI controls; terminal
> vim only gets min/max/resize/pin/shade happening via the containing terminal
> window.  Managed by your OS/shell.
>
>
> So your control-W concerns with -/+ only seem to be an issue if your
> containing environment (e.g. Gnome Terminal) intercepts them and does
> unexpected things with them :)  Allow me to recommend xterm or rxvt :)
>
> -tim
>
>
>

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Careful when using ctrl+w

Tim Chase
On 12/09/11 20:40, Ven Tadipatri wrote:
>     Well I wasn't sure what kind of terminal I had - but you're right,
> it's Gnome 2.16.0.
> I'm pretty used to using this terminal so I don't know if I want to
> install/configure rxvt or xterm. I'm using CentOS so I don't know if
> these are available for it.

Well, you're welcome to continue using it, just be aware that if
you use control-plus/minus, you get Gnome Terminal's behavior for
this.  If you dig sufficiently, you might find a way to turn this
particular key-combo off in GnomeTerm.  Fortunately, it's just as
easy to undo if you do it (just use the other one to restore the
font size).

>     I think what I was getting confused with is the concept of Windows
> versus tabs.
> Like if I do a ":new", is that a new "window" or a new "tab". Ok, I
> guess if I'm using "ctrl+___W___", then that probably means it's a new
> "__W__indow"

Yes.  If you do :new it gives you a new/empty buffer and one
window into that buffer.  If you do a ":split", it gives you a
second window into that buffer, each of which can be navigated
(useful for coding in one window while referencing another part
of the file in the other window).  Tabs were added in 7.0, IIRC,
and I've never really gotten in the habit of using them.  Other
folks love them.  The general hierarchy:

   Instances of vim contain tabs (visible) and buffers (not visible)

   tabs contain windows

   windows are views into buffers

When you start a "naked" instance of vim, you have one tab with
one window as a view into an empty buffer.

When the last window in a tab is closed, that tab is closed.
When the last tab in an instance is closed, vim quits.

Hopefully that helps clarify for you a bit.

-tim


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Careful when using ctrl+w

Tony Mechelynck
In reply to this post by Ven Tadipatri
On 10/12/11 03:40, Ven Tadipatri wrote:

> Hi Tim,
>     The neat thing about VI is that the more you work with it the more
> neat things
> you learn about it, mostly through experimenting rather than reading
> lengthy documentation.
>     Well I wasn't sure what kind of terminal I had - but you're right,
> it's Gnome 2.16.0.
> I'm pretty used to using this terminal so I don't know if I want to
> install/configure rxvt or xterm. I'm using CentOS so I don't know if
> these are available for it.
>     Registers I'm fairly comfortable with - it's just that these terms
> are often overloaded - something like "buffer", to me at least, means
> a temporary storage location, which I kind of think of as registers.

I started programming in the late sixties, and in those times a buffer
was a memory area used to hold the data being read from a file but not
yet handled, or the data already handled and about to be written to a
file (for instance, in both cases, the next tape block, or the next disk
physical record, or the next Hollerith card, or...). Vim just extended
this concept by making its buffers big enough to hold the whole file and
its metadata.

>     I think what I was getting confused with is the concept of Windows
> versus tabs.
> Like if I do a ":new", is that a new "window" or a new "tab". Ok, I
> guess if I'm using "ctrl+___W___", then that probably means it's a new
> "__W__indow"
>
> Thanks,
> Ven

A tab or tab page is the set of windows visible at the same time in a
single instance of Vim. A window (or split-window) is a viewport into a
buffer (i.e., usually, into a file). A tab can be split in one or more
windows, a buffer can be displayed in zero or more windows. Using :new
you create an additional window in the current tab, a window displaying
either an empty buffer or the file (or, with netrw, the directory) named
as argument to :new. Similarly with :split you split the current window
in two, both on the same buffer. Then you can (if you want to) scroll
them separately to display different parts of that buffer, but (until
you issue :e or :view etc. in one of them) it is still the same buffer
(the same editfile) and any change made in one of these windows is
reflected in the other.


Best regards,
Tony.
--
"She is descended from a long line that her mother listened to."
                -- Gypsy Rose Lee

--
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