Saturday, May 16, 2015

Re: vim how to edin same file in different window

On 2015-05-16, Christian Brabandt wrote:
> Hi Daniel!
>
> On Sa, 16 Mai 2015, Daniel Dimitrov wrote:
>
> > I have splited the window in 2 different views by Ctrl+W, V but what i
> > want to achieve is to edit them separately without affecting the other
> > and after that save them with different names. Thanx in advance
>
> After splitting do a
> :saveas name
> in each window to make sure, that each window has its own buffer with
> its own name for the original buffer.
>
> (Obviously it would be better to use a different name in each window ;))

When I try that, the buffer name changes in both windows. The
windows are just different views into the one buffer.

The way I usually do that is yank the buffer into a register, open a
new buffer in a new window, paste the register into that buffer, and
delete the empty first line, e.g.,

ggyG
:new
p
kdd

Or you could read the file into the new buffer, e.g.,

:new
:r#
:0d_

Regards,
Gary

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