Vimdiff editing text

Visto 8 veces
Saltar al primer mensaje no leído

K otgc

no leída,
3 mar 2023, 7:44:523/3/23
a vim_use
I'm having trouble moving text from file2 line1 to file1 line8.
How do I do that please?

c.willis111

no leída,
3 mar 2023, 7:56:153/3/23
a vim...@googlegroups.com
How about


vim file2

yy

:e file1

7G

p


ie open file 2, grab the first line, edit file1, move to line 7 and append what you yanked.


No doubt there are ways involving two windows.


regards - Chris


--
--
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+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8fe3aa5b-29fb-40fb-b170-de4f16531552n%40googlegroups.com.

Tim Chase

no leída,
3 mar 2023, 7:58:143/3/23
a vim...@googlegroups.com
On 2023-02-24 22:50, K otgc wrote:
> I'm having trouble moving text from file2 line1 to file1 line8.

If it's just one line as part of a larger change, you can yank it
and either paste it normally or visually-highlight the line with
"V" and paste to replace it (or paste it and then delete then line).

If it's a whole block, you can use "dp" or "do"

:help do
:help dp
:help :diffput
:help :diffget

to obtain the diff from the other window, or put the current diff
in the other window.

This assumes that, in your example, that diff mode has aligned
line 1 of file1 with line 8 of file2. If not, diff-mode won't help
you much in this case, so you'd have to revert to the yank/paste
method.

If that's what you're doing and you're still having trouble, you'd
have to expand on what you mean by "having trouble moving text."

-tim




K otgc

no leída,
3 mar 2023, 8:08:173/3/23
a vim_use
Thanks, I actually posted this about a week ago.
I figured out I just have to manually delete, yank and put.
I was hoping vimdiff would do and dp.
The biggest headache was sorting the lines, as dates were majorly messed up due to a very old syncing error before the iPhone came out.
I have just watched some awesome vim tutorials and learned about the command 'sort'.  Hopefully this well save time for future edits coming up.
Perhaps once lines are sorted by date, the do and dp my work.

Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos