The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding a columnfrom a specifit line number to a specific line number Ezy Shell Programming and Scripting 2 05-12-2008 05:29 AM
Appending line number to each line and getting total number of lines chiru_h Shell Programming and Scripting 2 03-25-2008 07:19 AM
Show result only if number is greater then umen Shell Programming and Scripting 1 12-05-2007 01:03 AM
making sure a command line paramter is a number rcunn87 Shell Programming and Scripting 3 07-13-2006 07:36 AM
Need ls to show number of lines in each file GMMike UNIX for Dummies Questions & Answers 1 11-19-2004 02:53 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-27-2004
Registered User
 

Join Date: Jan 2004
Posts: 16
Making Emacs to show line number

Hi all
How can I make Emacs to show the line numbers at the left or right as a default. This might help me to quickly jump to a given line.
Thanks
SS
Forum Sponsor
  #2  
Old 01-28-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Try putting this in your .emacs file:

(line-number-mode 1)
  #3  
Old 01-28-2004
Registered User
 

Join Date: Jan 2004
Posts: 16
I tried that but it is not working. Actually, I do get line number on the mode line but I would like numbers at the left or right end of the buffer.
I have been suggested this
http://www.emacswiki.org/cgi-bin/wiki.pl?LineNumbers
but I didn't understand abc of it. Can you please have a look at it and let me know.
SS
  #4  
Old 01-28-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Sorry, I never even used emacs ( vi rules). Just searched for a possible solution to your problem to assist.

The code seems like a bit much for putting in line numbers but you might try it - seems to be the only thing to do if you really want the line numbers. And I have no clue of how you are suppose to use the program. I didn't find any 'set up' instructions.

I did note the waste of cpu...

Setnu is a mode that displays line numbers in Emacs buffers, much as the "set nu" command does under VI, hence the name. Setnu works under XEmacs and GNU Emacs. This package is best used on files with a few thousand lines at most, unless you have very fast hardware and are willing to waste it recalculating and redisplaying line numbers. The latest version of setnu is 1.06.
  #5  
Old 01-28-2004
Registered User
 

Join Date: Jan 2004
Posts: 16
Ok, I know you are not emacs user, so if you have to go to some line in the middle of buffer, how do you go there quickly? I though if I knew line number, I would use move to line funct to go there.
SS
  #6  
Old 01-28-2004
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Even if you could display line numbers in emacs, how would you know which line you were trying to skip to.. just guess which one is approximately "in the middle of the buffer"? ... and is there even a command in emacs that allows you to skip to a specified line?

Maybe it'd be easier to search for a string than to skip to a line number...

Take a look at this tutorial:
http://www.doc.ic.ac.uk/~wjk/UnixInt...html#emacs-6-3

Quote:
6.3.6 Quick reference for emacs

Cursor movement:

C-a beginning of line
C-e end of line
C-< top of document
C-> end of document
M-x goto-line Go to line
C-v page forward
M-v page backward

Deleting and moving text:

Backspace delete character before cursor
(subject to modification of .emacs)
C-d delete character under cursor
M-d delete word
C-k delete to end of line(s)
(restore with C-y)
C-SPC set mark
C-w delete from mark to cursor
(restore with C-y)

Search and replace:

C-s incremental search forward
C-r incremental search backward
C-% query replace
M-x replace-string <ENTER> <searchstr> <ENTER> <replstr>

Miscellaneous:

C-x u undo
C-x C-s save file
C-x C-f find file
C-x 2 2 windows
C-x 1 1 window
C-x o switch between windows
C-x b switch buffers
M-q reformat paragraph
C-x C-c quit

Useful customisable keys (configured using the provided .emacs file):

C-x g goto line
C-x c compile program (useful with C-x 2)
C-x C-u open Unix shell (useful with C-x 2)
C-x a repeat command
C-x m manual entry
  #7  
Old 01-28-2004
Registered User
 

Join Date: Jan 2004
Posts: 16
Yes, those are the keys that I am using though not all of them.
What I was looking is - if it numbers line of a file , then I can jump to a particular line immediately using go to line command ofcourse it will work good only for a page. how do you do this?
SS
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0