Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Making Emacs to show line number Post 46874 by oombera on Wednesday 28th of January 2004 11:28:28 AM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
LEDIT(1)						      General Commands Manual							  LEDIT(1)

NAME
ledit - line editor, version 2.03 SYNOPSIS
ledit [-h file] [-x] [-t] [-l length] [-a | -u] [command options] DESCRIPTION
The command ledit allows to edit lines one by one when running an interactive command. When typing a line, some keys with control or meta are interpreted: it is possible to insert characters in the middle of the line, go to the beginning or the end of the line, get a previous line, search for a line with a pattern, etc. OPTIONS
The options are: -h file Save the lines typed (history) in file. The default is to have them only in memory (so, they are lost at the end of the program). -x Extend the history file (given in option "-h") if it already exists. The default is to truncate the history file. -t Display the sequences generated by the keys (for debugging). -v Print ledit version and exit. -l length Tells that length is the maximum line length displayed. If the line edited is longer than this length, the line scrolls horizon- tally, while editing. The default value is 70. -a Ascii encoding: characters whose code is greater than 128 are displayed with a backslash followed by their code. -u Unicode encoding: the terminal must have been set in unicode mode. See commands unicode_start and unicode_stop. command options Runs the command command and its possible options. This must be the last option of ledit. The default value is "cat". KEYS BINDINGS
When ledit starts, some default key bindings are defined. The can be completed with a "leditrc" file. See the section LEDITRC. In the following lines, the caret sign "^" means "control" and the sequence "M-" means "meta" (either with the "meta" prefix, or by press- ing the "escape" key before). Examples: ^a press the "control" key, then press "a", then release "a", then release "control". M-a press the "meta" key, then press "a", then release "a", then release "meta", or: press and release the "escape" key, then press and release "a" (the manipulation with "meta" may not work in some systems: in this case, use the manipulation with "escape"). The default editing commands are: ^a : beginning of line ^e : end of line ^f : forward char ^b : backward char M-f : forward word M-b : backard word TAB : complete file name ^p : previous line in history ^n : next line in history M-< : first line in history M-> : last line in history ^r : reverse search in history (see below) ^d : delete char (or EOF if the line is empty) ^h : (or backspace) backward delete char ^t : transpose chars M-c : capitalize word M-u : upcase word M-l : downcase word M-d : kill word M-^h : (or M-del or M-backspace) backward kill word ^q : insert next char M-/ : expand abbreviation ^k : cut until end of line ^y : paste ^u : line discard ^l : redraw current line ^g : abort prefix ^c : interrupt ^z : suspend ^ : quit return : send line ^x : send line and show next history line other : insert char The arrow keys can be used, providing your keyword returns standard key sequences: up arrow : previous line in history down arrow : next line in history right arrow : forward char left arrow : backward char Other keys: home : beginning of line end : end of line delete : delete char page up : previous line in history page down : next line in history shift home : beginning of history shift end : end of history REVERSE SEARCH
The reverse search in incremental, i.e. ledit backward searchs in the history a line holding the characters typed. If you type "a", its search the first line before the current line holding an "a" and displays it. If you then type a "b", its search a line holding "ab", and so on. If you type ^h (or backspace), it returns to the previous line found. To cancel the search, type ^g. To find another line before holding the same string, type ^r. To stop the editing and display the current line found, type "escape" (other commands of the normal editing, different from ^h, ^g, and ^r stop the editing too). Summary of reverse search commands: ^g : abort search ^r : search previous same pattern ^h : (or backspace) search without the last char del : search without the last char any other command : stop search and show the line found LEDITRC
If the environment variable LEDITRC is set, it contains the name of the leditrc file. Otherwise it is the file named ".leditrc" in user's home directory. When starting, ledit reads this file, if it exists, to modify or complete the default bindings. If this file is changed while reading lines, it is read again to take the new file into account. Bindings lines are the ones which start with a string defining the key sequence and follow with a colon and a binding. A binding is either a string or a command. The other lines are ignored For example,the line: "C-a": beginning-of-line binds the sequence "control-a" to the command "beginning-of-line". The key sequence may contain the specific meta-sequences: C- followed by a key: "control" of this key M- followed by a key: "meta" of this key e the "escape" key nn where nnn is one, two, or three octal digits, or: xnn where nn is one or two hexadecimal digits: the binary representation of a byte a bell = C-g  backspace = C-h d delete = 277 f form feed = C-l newline = C-j carriage return = C-m tabulation = C-i v vertical tabulation = C-k The commands are: abort: do nothing accept-line: send the current line backward-char: move the cursor to the previous character backward-delete-char: delete the previous character backward-kill-word: delete the previous word backward-word: move the cursor before the previous word beginning-of-history: display the first line of the history beginning-of-line: move the cursor at the beginning of the line capitalize-word: uppercase the first char and lowercase the rest delete-char: delete the character under the cursor delete-char-or-end-of-file: same but eof if no character in the line downcase-word: lowercase whole word end-of-history: display the last line of the history end-of-line: move the cursor to the end of the line expand-abbrev: try to complete the word by looking at the history expand-to-file-name: try to complete the word from a file name forward-char: move the cursor after the next word forward-word: move the cursor to the next character interrupt: interrupt command (send control-C) kill-line: delete from the cursor to the end and save in buffer kill-word: delete the next word next-history: display the next line of the history operate-and-get-next: send line and display the next history line previous-history: display the previous line of the history quit: quit ledit quoted-insert: insert the next character as it is redraw-current-line: redisplay the current line reverse-search-history: backward search in the history suspend: suspend ledit (send control-Z) transpose-chars: exchange the last two characters unix-line-discard: kill current line upcase-word: uppercase whole word yank: insert kill buffer KNOWN BUGS
If ledit has been launched in a shell script, the suspend command kills it and its command... Use "exec ledit comm" instead of "ledit comm". The suspend command stops ledit but not the called program. Do not do this if the called program is not waiting on standard input. In some systems (e.g. alpha), pasting two many characters works bad and may block the terminal. Probably a kernel problem. No solution. SEE ALSO
unicode_start(1), unicode_stop(1). AUTHOR
Daniel de Rauglaudre, at INRIA, france. daniel.de_rauglaudre@inria.fr INRIA
Wed Jan 23, 2008 LEDIT(1)
All times are GMT -4. The time now is 08:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy