LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-19-2011, 08:21 AM   #1
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Rep: Reputation: 0
Question vi editor auto-completion


Hi guys!
I am using ex-050325.tar.bz2 (traditional vi editor),
and complie it from source.
I want to accomplish auto-completion in this version of vi editor.
(e.g. by typing "gr<space>", the string "group" emerges on the screen.)
I did this by adding the following line to my ~/.exrc:
------------
ab gr group
------------
The problem is, I have some hundreds of such abbreviations to add.
However, I always get an "ERROR" when the number of lines of .exrc file
reach a certain limit.
Can anybody help me out? New ways of solution are always welcome!

Notice that I also use the command
-------------
so /root/mylist_of_abbreviations
-------------
in the editor to use /root/my...tions as a source read by vi,
and the same problem occurred:
there is a limit of number of lines for the sourced file...

PS: Please do not recommend another editor, though a newbie, I am
quite hard-nose on the traditional vi editor, and there is no reason
for changing only because of this little problem.
(everything perfectly feed my needs except this one)
 
Old 11-20-2011, 05:35 AM   #2
davemguru
Member
 
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87

Rep: Reputation: 42
Would you consider "vim" to be "another editor"? It has all the "vi" facilities and much more facilities for "abbr" and mapping.

Alternatively - if you look at the source file "ex_tune.h" you will see
Code:
/*
 * Size of in-core buffers for temporary file. Since this is
 * sizeof (char) * (INCORB + 1) * BUFSIZ, it should not be too
 * large.
 *
 * If not defined, no in-core buffers are used.
 */
#ifdef  VMUNIX
#if     (BUFSIZ - 0) <= 16384
#define INCORB          (65536/BUFSIZ)
#else   /* Huge-memory systems. */
#define INCORB          4
#endif  /* Huge-memory systems. */
#endif  /* VMUNIX */

/*
 * Except on VMUNIX, these are a ridiculously small due to the
 * lousy arglist processing implementation which fixes core
 * proportional to them.  Argv (and hence NARGS) is really unnecessary,
 * and argument character space not needed except when
 * arguments exist.  Argument lists should be saved before the "zero"
 * of the incore line information and could then
 * be reasonably large.
 */
BUFSIZ is defined as 512 - therefore - (assuming VMUNIX is false) INCORB = 4 seems to be a limiting factor. Perhaps you could try undefining INCORB and see if "no in core buffers are used" will remove the limitations you are experiencing - OR instead of 4 for INCORB - try a factor of 10 bigger?

Dave

Last edited by davemguru; 11-20-2011 at 05:54 AM.
 
1 members found this post helpful.
Old 11-20-2011, 09:54 AM   #3
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Original Poster
Rep: Reputation: 0
Smile

davemguru, Thank you very much for your insightful reply!
I think I will try the ex_tune.h method as soon as possible.
Since I am not familiar with computer program languages (only a user of Linux), I have not consider the problem as far as you do...
I will finally post the result for my problem. :-)
 
Old 11-20-2011, 11:38 PM   #4
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Original Poster
Rep: Reputation: 0
Smile

davemguru: hi, I tried out the two ways you propose *, but neither of them work.
A little pity. Maybe I shall try vim instead.
(* That is, undefine INCORB by comment out the whole section you posted and compile again, or change the line
-------
#define INCORB 4
-------
to
------
#define INCORB 9
------
and re-compile.)
Anyway, thank you for your time and effort.

Last edited by iamonly; 11-20-2011 at 11:39 PM.
 
Old 11-23-2011, 09:38 AM   #5
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Original Poster
Rep: Reputation: 0
Talking

Hi, guys.
I finally find a fair solution myself.
After searching on the net a huge time, I learned that the traditional vi editor
has a limitation on the number of key maps in exrc file.
(It is designed to have this limitation!!)
http://publib.boulder.ibm.com/infoce...ixcmds6/vi.htm

I now switch to the editor nvi (new vi), it is great!
http://en.wikipedia.org/wiki/Nvi
https://sites.google.com/a/bostic.com/keithbostic/nvi

It retains the heritages of the traditional vi
(elegance, simplicity, ...) and removes the limitations of the traditional vi.
So now I can have hundreds of abbreviations defined in exrc.
I must say that, nvi perhaps is the simplest editor which possesses all the
powerful functions of triditional vi, yet free of the many limitations of it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] VIM auto completion possum Linux - Newbie 3 04-23-2011 02:29 PM
vim: auto-completion in ex chexmix Solaris / OpenSolaris 1 08-28-2008 03:26 PM
TAB Auto Completion rsmccain Linux - Software 6 11-20-2007 10:47 PM
jdee auto completion xeon123 Linux - Software 1 03-16-2007 07:59 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration