简体   繁体   中英

how to copy from other file in vi editor

how to copy from other file with ctrl-c and in vi editor with p yank (paste), i have no idea!! thinks

You can also do: :r filename

This will pull in the file. It can also be used for output from a command:

:r! grep some_text file
:r! which perl

The other way is to use buffers.

:e other_file.txt

Once you yank, you can :bn to switch to the other buffer and paste

If you are just concerned about pasting, ctrl-v or shift+insert also work to paste the contents of the clipboard.

Once you have yanked (copied) text in vi, you can type <ESC>:e filename to open another file for editing. Your yank buffer will still be the same, letting you paste into the other file. You must be copying text from one file in vi into another file in vi.

If you want to paste text from outside of vi, you need to setup your terminal and vi specially to allow that.

You can't. The yank buffer is private to vim, not shared with the system clipboard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM