Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
09-26-2007, 12:22 PM
|
#1
|
Member
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76
Rep:
|
vi vagaries
I just discovered something unexpected in vi (vim actually). Here's the situation:
Inside a single bash shell (RH Enterprise 4), I found that you can open a vi session on a file, use yy to yank some lines, close the vi session, vi a different file, and paste the yanked lines into it.
The surprise came when I discovered that regardless of how many lines you yank, only the first 50 lines can be pasted into the second file. It's great to be able to yank & paste between files, but why would you want to cap the number of lines at 50?
And now for a more practical question; is the 50 line limit hard coded into a binary somewhere? Can you set the number higher and if so, where?
WN
|
|
|
09-26-2007, 12:29 PM
|
#2
|
Member
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76
Original Poster
Rep:
|
Oh, I forgot to include another detail:
If you vi both files with the same command, then the 50 line limit doesn't come into effect and you can paste as many lines into the second file as you want.
|
|
|
09-26-2007, 01:08 PM
|
#3
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
50 lines may be a hard-coded default, but vim should allow you to override that default.
yy will yank the current line; 55yy should yank the current line plus the next 54 lines.
|
|
|
09-26-2007, 01:38 PM
|
#4
|
Member
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202
Rep:
|
I looked at source and even though I didn't get into the details my impression is that 50 is hardcoded magic number. When you do "yy" lines are copied into the buffer named `"'(in some places of Vim help they also called "registers"). When you close vim session the current state is stored in ~/.viminfo, and it looks like that only 50 lines are copied from the RAM. You could examine this file for you educational pleasure. The relevant source which does the job is in .../vim71/ops.c and option.c . I didn't see the way to overwrite the default.
Last edited by rsashok; 09-26-2007 at 01:41 PM.
|
|
|
09-26-2007, 02:58 PM
|
#5
|
Member
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76
Original Poster
Rep:
|
Thanks for the replies!
Since I could work around it already, "educational pleasure" was pretty much the only reason I asked anyway. Isn't it amazing the strange (and often useless) things that geeks like me can get curious about?
|
|
|
09-26-2007, 03:09 PM
|
#6
|
Member
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202
Rep:
|
If there is something we could know about there is no reason we should not.
|
|
|
All times are GMT -5. The time now is 04:42 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|