Emacs Editing Mode

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Appendix E.  Korn Shell Man Page


This mode is entered by enabling either the emacs or gmacs option. The only difference between these two modes is the way they handle ^T. To edit, the user moves the cursor to the point needing correction and then inserts or deletes characters or words as needed. All the editing commands are control characters or escape sequences. The notation for control characters is caret (^) followed by the character. For example, ^F is the notation for control F. This is entered by depressing 'f' while holding down the 'CTRL' (control) key. The 'SHIFT' key is not depressed. (The notation ^? indicates the DEL (delete) key.)

The notation for escape sequences is M- followed by a character. For example, M-f (pronounced Meta f) is entered by depressing ESC (ascii 033) followed by 'f'. (M-F would be the notation for ESC followed by 'SHIFT' (capital) 'F'.)

All edit commands operate from any place on the line (not just at the beginning). Neither the 'RETURN' nor the 'LINE FEED' key is entered after edit commands except when noted.

^F

Move cursor forward (right) one character.

M-f

Move cursor forward one word. (The emacs editor's idea of a word is a string of characters consisting of only letters, digits and underscores.)

^B

Move cursor backward (left) one character.

M-b

Move cursor backward one word.

^A

Move cursor to start of line.

^E

Move cursor to end of line.

b^]char

Move cursor forward to character char on current line.

M-^]char

Move cursor back to character char on current line.

^X^X

Interchange the cursor and mark.

erase

Delete previous character. (User defined erase character as defined by the stty command, usually ^H or #.)

^D

Delete current character.

M-d

Delete current word.

M-^H

(Meta-backspace) Delete previous word.

M-h

Delete previous word.

M-^?

(Meta-Delete) Delete previous word (if your interrupt character is (Delete, the default) then this command will not work).

^T

Transpose current character with next character in emacs mode. Transpose two previous characters in gmacs mode.

^C

Capitalize current character.

M-c

Capitalize current word.

M-l

Change the current word to lower case.

^K

Delete from the cursor to the end of the line. If preceded by a numerical parameter whose value is less than the current cursor position, then delete from given position up to the cursor. If preceded by a numerical parameter whose value is greater than the current cursor position, then delete from cursor up to given cursor position.

^W

Kill from the cursor to the mark.

M-p

Push the region from the cursor to the mark on the stack.

kill

(User defined kill character as defined by the stty command, usually ^G or @.) Kill the entire current line. If two kill characters are entered in succession, all kill characters from then on cause a line feed (useful when using paper terminals).

^Y

Restore last item removed from line. (Yank item back to the line.)

^L

Line feed and print current line.

^@

(Null character) Set mark.

M-space

(Meta space) Set mark.

^J

(New line) Execute the current line.

^M

(Return) Execute the current line.

eof

End-of-file character, normally ^D, is processed as an End-of-file only if the current line is null.

^P

Fetch previous command. Each time ^P is entered the previous command back in time is accessed. Moves back one line when not on the first line of a multi-line command.

M-<

Fetch the least recent (oldest) history line.

M->

Fetch the most recent (youngest) history line.

^N

Fetch next command line. Each time ^N is entered the next command line forward in time is accessed.

^Rstring

Reverse search history for a previous command line containing string. If a parameter of zero is given, the search is forward. String is terminated by a Return or Newline. If string is preceded by a ^, the matched line must begin with string. If string is omitted, then the next command line containing the most recent string is accessed. In this case a parameter of zero reverses the direction of the search.

^O

Operate - Execute the current line and fetch the next line relative to current line from the history file.

M-digits

(Escape) Define numeric parameter, the digits are taken as a parameter to the next command. The commands that accept a parameter are ^F, ^B, erase, ^C, ^D, ^K, ^R, ^P, ^N, M-., M-^], M-_, M-b, M-c, M-d, M-f, M-h, M-l and M-^H.

M- letter

Soft-key - Your alias list is searched for an alias by the name letter and if an alias of this name is defined, its value will be inserted on the input queue. The letter must not be one of the above meta-functions.

M-] letter

Soft-key - Your alias list is searched for an alias by the name letter and if an alias of this name is defined, its value will be inserted on the input queue. The can be used to program functions keys on many terminals.

M-.

The last word of the previous command is inserted on the line. If preceded by a numeric parameter, the value of this parameter determines which word to insert rather than the last word.

M-_

Same as M-..

M-*

Attempt file name generation on the current word. An asterisk is appended if the word doesn't match any file or contain any special pattern characters.

M-Esc

File name completion. Replaces the current word with the longest common prefix of all filenames matching the current word with an asterisk appended. If the match is unique, a / is appended if the file is a directory and a space is appended if the file is not a directory.

M-=

List files matching current word pattern if an asterisk were appended.

^U

Multiply parameter of next command by 4.

\

Escape next character. Editing characters, the user's erase, kill and interrupt (normally ^?) characters may be entered in a command line or in a search string if preceded by a \. The \ removes the next character's editing features (if any).

^V

Display version of the Korn shell.

M-#

Insert a # at the beginning of the line and execute it. This causes a comment to be inserted in the history file.


       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net