Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dear All
Can you please do me favor and let me know how can I copy some text in one file and paste it to another file ,when both of the files are being opened by vi text editor ?
Thank you in advance
To copy the current line use yy , copy a word yw , copy 4 words y4w like that
to paste what you've copied use p or P
Thank you very much for your reply . But I meant copy from one file and paste to the other file , that both of the files are being opened concurrently in separate vi sessions . Can you please do me favor and modify your proposed procedure to get through ?
Thank you in advance
To copy the current line use yy , copy a word yw , copy 4 words y4w like that
to paste what you've copied use p or P
Translated, this means that, unless you are either a masochist or a computer software historian, you should choose a modern text editor.
I can use an abacus that is ingeniously connected to a computer, but I would prefer to use something a bit more up-to-date. By the same reasoning I would prefer any editor -- any editor -- over vi. My antique program Apple Writer, which ran on the Apple II and was terribly limited by modern standards, easily outperformed vi.
There are dozens of programs more usable than vi, whose command set was originally designed to avoid an unnecessary waste of paper at a time when all computer transactions were conducted on a paper teletype terminal, at great cost and expenditure of time. (I was obliged to use vi while working on the NASA Space Shuttle in the early 1970s.)
The appearance of the first glass terminal ought to have marked the end of vi's useful life, but no ... not even close. At a time when there are fantastic free text editors that know a mouse is something other than a nuisance rodent, a small clique of technological throwbacks patiently enter the archaic commands required of vi, as though the last forty years had not taken place.
When people ask for useful vi commands, I am tempted to reply:
Translated, this means that, unless you are either a masochist or a computer software historian, you should choose a modern text editor.
I can use an abacus that is ingeniously connected to a computer, but I would prefer to use something a bit more up-to-date. By the same reasoning I would prefer any editor -- any editor -- over vi. My antique program Apple Writer, which ran on the Apple II and was terribly limited by modern standards, easily outperformed vi.
There are dozens of programs more usable than vi, whose command set was originally designed to avoid an unnecessary waste of paper at a time when all computer transactions were conducted on a paper teletype terminal, at great cost and expenditure of time. (I was obliged to use vi while working on the NASA Space Shuttle in the early 1970s.)
The appearance of the first glass terminal ought to have marked the end of vi's useful life, but no ... not even close. At a time when there are fantastic free text editors that know a mouse is something other than a nuisance rodent, a small clique of technological throwbacks patiently enter the archaic commands required of vi, as though the last forty years had not taken place.
When people ask for useful vi commands, I am tempted to reply:
Code:
# rm -f `whereis -b vi`
Newbies: the above is a joke, don't type it.
Not everyone can agree with you(atleast I can't). I don't understand why you hate vi this much; atleast the popularity of vi just does prove that it is NOT as BAD as you're saying
Translated, this means that, unless you are either a masochist or a computer software historian, you should choose a modern text editor.
I totally disagree with that and it doesn't have anything to do with the original question.
All text editors have a learning curve and some editors you like and some you don't, a very personal choice.
And be very careful with the rm command you put down (a joke I know, but still....).
@hadimotamedi: Can't you use the mouse to select (part of) the text and paste it into the other vi session?
If you have gvim installed as well, try to use that one, it comes with pulldown menu's and copy/paste options (not limited to one session).
vi has 26+1 buffers; you can acces them with a double quote followed by the letters a to z and this can be used when editing 2 or more files (e.g vi abc.txt def.txt). One buffer does not have a letter and only works on the current file.
Thank you very much for your reply . But I meant copy from one file and paste to the other file , that both of the files are being opened concurrently in separate vi sessions . Can you please do me favor and modify your proposed procedure to get through ?
Thank you in advance
Open both of your files:
eg:
Code:
vi file1 file2
press CTRL+W,N
then enter :n
you'll see two interchangeable windows; each window represents your file1 and file2
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.