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
UTALK(1)						      General Commands Manual							  UTALK(1)

NAME
utalk - a UDP-based full screen talk program SYNOPSIS
utalk [options] user[@host][#tty] utalk [options] !port@host utalk [options] -s port utalk [options] -c host port OPTIONS
-s, --server Tells utalk not to use the talk daemons to announce itself, and instead wait for a connection on the given port number. -c, --client Tells utalk not to use the talk daemons to announce itself, and instead connect to the given port number on the given host. -a, --announce-only Makes utalk decide on a local port number, and send out an announce with the port number instead of your username. Useful to start a utalk session with a host that has a talk daemon when yours doesn't. -7, --seven-bit Makes utalk convert all characters to 7-bit US-ASCII before displaying them; useful if you don't have an iso-8859-1 capable termi- nal. -8, --eight-bit Makes utalk show iso-8859-1 encoded characters on the screen, as they are received. ARGUMENTS
user@host[#tty] Specifies the user to ring. The "user@host" part can be replaced with an alias name defined in your ~/.utalkrc. If you specify the tty, utalk will ask the talk daemon to ring the user on that particular tty. The username can be prefixed by a '!', which utalk will strip. !port@host Specifies the port number to connect to, and the host. Useful to answer to a utalk -a. DESCRIPTION
utalk is a text-based chat program in the vein of talk and YTalk, which uses a better protocol built over UDP for communication. Because it does not require that network packets arrive in sequence to be able to display them, utalk can be used over unreliable links where a TCP/IP connection such as a telnet or a talk would be too slow to be usable. Additionally, utalk supports full editing of previously typed text, scrollback, keyboard bindings, and aliases. utalk is incompatible with any other talk programs, as it uses a completely different protocol. Unfortunately, the text "respond with: talk" is hard-coded in the talk daemon, and cannot be set by the client. To avoid confusion, utalk's talk requests send the username prefixed with a '!', which must be understood as ``respond with utalk''. DISPLAY
As in talk and YTalk, the utalk screen is divided in a number of separate scrolling areas, one for yourself and one for each other con- nected client (currently limited to one). At any time, one of these windows is active. Each scrolling area has a status line at the top, with the name of the client and the follow- ing flags: [m] This flag is always present on the top window: it's "my" window. [*] This flag means that the window is active and in read-write mode. This is the normal mode for your own window; in this mode, you can type and edit, and when you move your cursor and/or scroll back all other connected clients see the cursor move too. [R] This flag means that the window is active and in read-only mode. This is the only way another window than yours can be active (i.e you can't type text in someone else's window); setting your own window in read-only mode lets you scroll back through what you typed without all other clients seeing your do it. [n] Means that the window is not yet connected; the user hasn't responded yet. [c] Means that the window is connected. [b] Means that the window is connected, but no data (even control data that utalk sends periodically) has been received for a while, so the connection might be broken or the client on the other side might have crashed. utalk will not interrupt a connection because of this, it's up to you to stop it after a while if it doesn't come back. EDITING
utalk's editing keys can be configured to emulate either vi or emacs, in a limited way. By default, utalk is in emacs mode. utalk keeps a table of bindings for each of three modes: emacs mode, vi command mode, and vi insert mode. These tables are initialized to suitable defaults, and you can add bindings with the bind command in your ~/.utalkrc file. The following is a list of all key commands and their default bindings in emacs mode, vi command mode, and vi insert mode respectively. self-insert (printable chars) (unbound) (printable chars) The keypress gets inserted at the current cursor position, and the cursor moves forward one step. insert-in-place (unbound) (unbound) (unbound) The keypress gets inserted at the current cursor position, and the cursor does not move. quote-char (^Q) (unbound) (^V) Insert the following key literally. tab (^I) (unbound) (^I) Moves the cursor to the next tab stop. new-line (^M, ^J) (^M, ^J) (^M, ^J) Moves the cursor to the first position on the next line, possibly creating the line. delete (^D) (x) (unbound) Deletes the character under the cursor. delete-end-of-line (^K) (D, d$) (unbound) Deletes from the cursor to the end of the line. delete-beginning-of-line (unbound) (d0, d^) (unbound) Deletes from the beginning of the line to the cursor. delete-line (^U) (dd) (^U) Deletes the current line. delete-word (ESC d) (dw, dW) (unbound) Deletes to the beginning of the next word. delete-end-of-word (unbound) (de) (unbound) Deletes to the end of the current word. backspace (^H, DEL) (X) (^H, DEL) Moves back the cursor one position, erasing the character in that position. backspace-word (^W) (unbound) (^W) Backspaces over one word. backward (^B, ESC [D) (h, [D) (unbound) Moves backward one position. forward (^F, ESC [C) (l, [C) (unbound) Moves forward one position. backward-word (ESC b) (b, B) (unbound) Moves backward one word. forward-word (ESC f) (w, W) (unbound) Moves forward one word. end-of-word (unbound) (e) (unbound) Moves to the end of the current word. beginning-of-line (^A) (0, ^) (unbound) Moves to the beginning of the current line. end-of-line (^E) ($) (unbound) Moves to the end of the current line. nop (unbound) (ESC) (unbound) Does nothing. beep (unbound) (unbound) (unbound) Beeps the terminal (does not send a beep across to the other clients). up (^P, ESC [A) (k, [A) (unbound) Moves the cursor up one line. down (^N, ESC [B) (j, [B) (unbound) Moves the cursor down one line. up-page (ESC v) (^B) (unbound) Moves the cursor up one page if the screen is in read/write mode, and scrolls up by one page if it is in read-only mode. down-page (^V) (^F) (unbound) Moves the cursor down one page if the screen is in read/write mode, and scrolls down by one page if it is in read-only mode. up-half-page (unbound) (^U) (unbound) Moves the cursor up half a page if the screen is in read/write mode, and scrolls up by half a page if it is in read-only mode. down-half-page (unbound) (^D) (unbound) Moves the cursor down half a page if the screen is in read/write mode, and scrolls down by half a page if it is in read-only mode. top-of-screen (unbound) (H) (unbound) Moves the cursor to the first line of the current visible screen. middle-of-screen (unbound) (M) (unbound) Moves the cursor to the middle of the screen. bottom-of-screen (unbound) (L) (unbound) Moves the cursor to the last line of the current visible screen. top-or-up-page (unbound) (unbound) (unbound) Moves the cursor to the top of the screen if it's not there, or scrolls up by one page if it is. bottom-or-down-page (unbound) (unbound) (unbound) Moves the cursor to the bottom of the screen if it's not there, or scrolls down by one page if it is. vi-goto-line (unbound) (G) (unbound) Moves the cursor to the line number entered as a prefix, if any; otherwise moves to the last line of the buffer. redisplay (^L) (^L) (^L) Redraws the screen. resynch (^R) (^R) (^R) Requests immediate transmission of all missing packets. next-window (^X b, ^X o, ^G) (g) (unbound) Cycles the active window between your window in read/write mode, your window in read-only mode, and each of the other windows. set-topic (^T) (^T) (unbound) Prompts the user for a ``topic'', which will be displayed at the top of the screen for all users. vi-insert-mode (unbound) (i, R) (unbound) Sets vi insert mode. vi-command-mode (unbound) (unbound) (unbound) Sets vi command mode. emacs-mode (unbound) (unbound) (unbound) Sets emacs mode. quit (^X c) (ZZ) (unbound) Quits utalk. vi-escape (unbound) (unbound) (ESC) Sets vi command mode and moves the cursor one position to the left. vi-add (unbound) (a) (unbound) Moves the cursor one position to the right and sets vi insert mode. vi-add-at-end-of-line (unbound) (A) (unbound) Moves the cursor to the end of the current line and sets vi insert mode. vi-insert-at-beginning-of-line (unbound) (I) (unbound) Moves the cursor to the beginning of the current line and sets vi insert mode. vi-open (unbound) (o) (unbound) Moves the cursor to the beginning of the next line and sets vi insert mode. vi-open-above (unbound) (O) (unbound) Moves the cursor to the beginning of the previous line and sets vi insert mode. vi-replace-char (unbound) (r) (unbound) Replaces the char under the cursor with the following key. vi-find-char (unbound) (f) (unbound) Moves the cursor to the next occurrence of the following key on the same line. vi-reverse-find-char (unbound) (F) (unbound) Moves the cursor to the previous occurrence of the following key on the same line. vi-till-char (unbound) (t) (unbound) Moves the cursor to one position before the next occurrence of the following key on the same line. vi-reverse-till-char (unbound) (T) (unbound) Moves the cursor to one position after the previous occurrence of the following key on the same line. vi-repeat-find (unbound) (;) (unbound) Repeats the previous find or till command. vi-reverse-repeat-find (unbound) (,) (unbound) Repeats the previous find or till command, reversing the direction. vi-delete-find-char (unbound) (df) (unbound) Deletes all characters between the current position and the next occurrence of the following key on the same line, both included. vi-delete-reverse-find-char (unbound) (dF) (unbound) Deletes all characters between the current position and the previous occurrence of the following key on the same line, both included. vi-delete-till-char (unbound) (dt) (unbound) Deletes all characters between the current position and the next occurrence of the following key on the same line, not including the latter. vi-delete-reverse-till-char (unbound) (dF) (unbound) Deletes all characters between the current position and the previous occurrence of the following key on the same line, not including the latter. vi-flip-case (unbound) (~) (unbound) Flip the case of the character under the cursor. CONFIGURATION
You can specify a number of settings for utalk in a configuration file called .utalkrc in your home directory. Valid commands are: emacs-mode vi-mode bind key function bind! key function alias alias value set setting on|off Settings are: beep Makes utalk let beeps through or silence them. word-wrap, wordwrap, ww Turns word-wrap on or off (only at the end of the last line in the buffer). eight-bit, eightbit, eb Lets eight-bit iso-latin-1 characters through or maps them to US-ASCII. meta-esc, metaesc, me Maps keys with the high bit set to ESC followed by key, or lets them through (only affects emacs-mode). "toggle" and "se" are synonyms for "set". "bindkey" and "bindkey!" are synonyms for "bind" and "bind!", respectively. In settings, "on" and "off" arguments are optional, "on" is assumed by default, unless the setting's name is prefixed with "no". Bindings apply to the current mode; to change bindings in vi mode, put a "vi-mode" first, then your "bind"s and "bind!"s. In emacs mode, "bind" and "bind!" are synonymous. In a binding, the key must be a character or sequence of characters, not separated with any spaces. The following sequences are recognized to specify characters: ^char, C-char -- Control-char M-char -- Meta-char e -- ESC -- Tab -- Carriage return (^M) -- Newline (^J) xhex code -- Ascii code given in hex char -- That char, taken literally Note that you shouldn't bind functions to M-key combinations in emacs mode; use ESC key combinations instead, and turn meta-esc on if you want to use your Meta key like in emacs. You can make aliases for addresses of people to ring, in either of 3 forms: alias aliasname@ username@ Replaces aliasname@host with username@host for every host. The '@' at the end of username@ is not required. alias @aliashost @realhost Replaces user@aliashost with user@realhost for every user. The '@' at the beginning of @realhost is not required. alias aliasname user@host Replaces aliasname with user@host. COPYING
utalk is free software. You can redistribute it and/or modify it under the GNU General Public License as published by the Free Software Foundation. See the file LICENSE for details. SEE ALSO
talk(1), ytalk(1), mesg(1) FILES
~/.utalkrc configuration file BUGS
This is a beta version of utalk, so some bugs are to be expected... please report any bugs to the author. There is no way to insert (rather than overwrite) text. This will be hard to fix, as it is a requirement of utalk and the SRDP protocol that the whole protocol must be commutative. There is no way (as of yet...) to do n-way utalk sessions. The vi and emacs emulations are relatively primitive. AUTHOR
utalk was written by Roger Espel Llima <roger.espel.llima@pobox.com>. Roger Espel Llima Nov 24, 1996 UTALK(1)
All times are GMT -4. The time now is 06:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy