Sunday, May 14, 2017

Re: open two files in two separate gvim windows

On Sun, May 14, 2017 at 4:41 PM, kamaraju kusumanchi
<raju.mailinglists@gmail.com> wrote:
> Is there an easy way to open two files in two separate gvim windows?
> Currently, I am doing
>
> % for i in foo.txt bar.txt
> do
> gvim $i
> done
>
> I looked in gvim --help which lists -o, -O that splits screen
> horizontally/vertically to account for multiple files, -p to open
> files in their own tabs. But nothing to open in their own windows.
>
> thanks
> raju
> --
> Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog

Opening two separate gvim "windows" ("windows" in the OS sense of the
word, i.e. "screens" in the Vim sense) is possible only in one way: by
running two instances of gvim in parallel. In that case it is best not
to open a single file read-write in both instances.

In Vim terminology,
• a "screen" is an instance of Vim, using either a full terminal
console, the full size of a console emulator, or, for gvim, one OS
window with its titlebar, "Minimize", "Maximize" and "Close" buttons,
etc. One "screen" may contain one or more "tabpages". Anything said in
the help to be "global" has a single value for one whole Vim "screen".
Different "screens" coexisting at any time on a single computer may or
may not have been started with the same vimrc, the same 'compatible'
or 'nocompatible' setting, etc., or even the same executable binary.
They are always different processes from the OS point of view.
• a "tabpage" occupies when displayed the full size of a "screen"
minus its titlebar, command-line, and, if present, menubar, toolbar
and tab bar. There may be several "tabpages" in a "screen" but only
one of them is displayed at a time. Each "tabpage" contains one or
more "windows".
• a "window" is a viewport onto something that you are viewing or
editing, such as an edit file, a directory, a helpfile, etc. A
"window" displays all or part of a "buffer". If the current "tabpage"
contains several "windows", they are tiled side-by-side and/or
top-to-bottom so that each part of the displayed "tabpage" contains
exactly one and only one "window". All "windows" in the current
"tabpage" have exactly one status line; the current windows also has
one or more visible lines of its "buffer" while the non-current
windows each have zero or more visible lines of their respective
"buffer". At any time, a "window" displays all or part of exactly one
"buffer"; if the "buffer" is too large for the "window", a different
part of it can be accessed by scrolling.
• a "buffer" is one of the following:
• the whole data of a file being edited, which may or may not be
empty and may or may not have been written to disk since it was last
changed in the current "screen"; if not yet written it may or may not
have a name;
• the whole data of a file being viewed, the only difference with
the above being that it may have 'readonly' and/or 'nomodifiable' set;
• the whole data of a helpfile being displayed, the only difference
with the above being that it not only has both 'readonly' and
'nomodifiable' set but that its 'buftype' is "help". There is normally
at most one help buffer displayed in one "window" of a "screen", but
in some circumstances there might be more help "windows" in the same
"screen";
• the directory of a zipfile or similar archive: to open one of its
files or directories, move the cursor to the corresponding line and
hit <Enter>; for more details see the help for |pi_zip.txt| and
|pi_tar.txt|;
• the contents of a directory on your own hard disk (or one of them
if you have several) or on a remote system to which you are connected;
this directory is displayed by the netrw plugin.
There may be several "windows" displaying parts (overlapping or not)
of a single "buffer" in a single Vim "screen", in which case each of
them has its own cursor, any change made in one of them is reflected
in all others, and saving one of them to disk (by :w, :wa, :up, etc.)
clears the 'modified' flag on all of them. OTOH, as long as there
remains at least one open "window" to a given "buffer", closing
another "window" on the same "buffer" won't necessarily save the data
to disk: this is not an error.
A "buffer" can also be "hidden" (see the help for 'hidden',
'bufhidden' and ":hide"), in which case its data is present in Vim
memory without being displayed in a "window". Caution: a hidden
"buffer" may or may not be 'modified' by respect to its disk version.


Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment