Making Emacs to show line number


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Making Emacs to show line number
# 1  
Old 01-27-2004
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
# 2  
Old 01-28-2004
Try putting this in your .emacs file:

(line-number-mode 1)
# 3  
Old 01-28-2004
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
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
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
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
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Show difference between two number

Hi, I would like to show the difference between two numbers. For example. input.txt 1 7 2 10 0 0 6 7 I would like a third field showing the difference between the numbers as below: ouput.txt 1 7 6 2 10 8 0 0 0 6 7 1 How do I do this? (4 Replies)
Discussion started by: general_lee
4 Replies

2. UNIX for Dummies Questions & Answers

How to use emacs? Also how to open existing emacs files with .cgi format?

Hi All, I am new to this forum and a beginner in unix. Please correct me if I put the question in a wrong way.. How to use emacs editor? Also how to open existing emacs files with .cgi format? I have the following link :- http link i.e. url and path : /abc/xyz.dev/xyz/documents What... (7 Replies)
Discussion started by: swathi123
7 Replies

3. Shell Programming and Scripting

How to use command tail -f & show line number.

Hello Guys, I have created function which is as follow: tail -f filename |grep "Key word" output from this command 19-11-2011 21:09:15,234 - INFO Numbement - error number:result = :11 19-11-2011 21:09:15,286 - INFO Numbement - error number:result = :11 19-11-2011 21:09:15,523 - INFO... (5 Replies)
Discussion started by: ooilinlove
5 Replies

4. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

5. Shell Programming and Scripting

Making script show command (e.g. copy) being executed and variable substitution?

When script is running you only see when some of the commands are not successfull. Is there a way to see which command are executed and to show the substitution of variables as every line is executed ? (3 Replies)
Discussion started by: gr0124
3 Replies

6. Programming

Emacs line indentation

Hi. I'm writing a document in Python, so indentation is crucial. I want to indent a whole section by exactly one tab. Any idea how to go about this? I'm using terminal emacs (no mouse input) Thanks for any help! (2 Replies)
Discussion started by: Rledley
2 Replies

7. Shell Programming and Scripting

Show result only if number is greater then

Hello all Im trying to write one liner that will show me results only if the result of the expression is greater then 0 For example: I do : find . -name "*.dsp" | xargs grep -c SecurityHandler the result are : ./foo/blah/a.dsp:0 ./foo/blah1/b.dsp:1 ./foo/blah2/c.dsp:2... (1 Reply)
Discussion started by: umen
1 Replies

8. Shell Programming and Scripting

making sure a command line paramter is a number

i need to make sure that a command line paramter is with in a certin set of numbers and i dont know how todo it with out checking individual numbers. if test $1 -eq (need something here) then echo hi fi like if i put individual numbers in there it works fine but how do i do a range (3 Replies)
Discussion started by: rcunn87
3 Replies

9. UNIX for Dummies Questions & Answers

emacs as a line editor

hello, I would like to use emacs as a line editor (I use emacs as editor). I try "set -o emacs" but I have nothing. Thank you for any help (5 Replies)
Discussion started by: annemar
5 Replies
Login or Register to Ask a Question