In-Line Editors

   

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

Table of Contents
Appendix G.  Pdksh Quick Reference


In-line editing provides the ability to edit the current or previous commands before executing them. There are three in-line editing modes available: emacs, gmacs, and vi. The emacs and gmacs modes are basically the same, except for the way Ctl-t is handled. The inline editing mode is specified by setting the EDITOR or VISUAL variables, or with the set o command. The editing window width is specified by the COLUMNS variable. For lines longer than the window width, a mark is displayed to notify position. The marks >, <, and * specify that the line extends to the right, left, or both sides of the window.

Vi Input Mode Commands

#, <Backspace>

delete previous character

Ctl-d

terminate the Korn shell

Ctl-v

escape next character

Ctl-w

delete previous word

Ctl-x, @

kill the entire line

<Return>

execute current line

\

escape next erase or kill character

Vi Motion Edit Commands

[n]h, [n]<Backspace>

move left one character

[n]l, [n]<Space>

move forward one character

[n]b

move backward one word

[n]B

move backward one word; ignore punctuation

[n]w

move forward one word

[n]W

move forward one word; ignore punctuation

[n]e

move to end of next word

[n]E

move to end of next word; ignore punctuation

[n]fc

move forward to character c

[n]Fc

move backward to character c

[n]tc

move forward to character before character c

[n]Tc

move backward to character before character c

[n];

repeat last f, F, t, or T command

[n],

repeat last f, F, t, or T command, but in opposite direction

0

move cursor to start of line

^

move cursor to first non-blank character in line

$

move cursor to end of line

Vi Search/Edit History Commands

[n]G

get last command (or command n)

[n]j, [n]+

get next command from history file

[n]k, [n]?/span>

get previous command from history file

n

repeat last / or ? search

N

repeat last / or ? search, except in opposite direction

/string

search backward in history file for command that matches string

?string

search forward in history file for command that matches string

Vi Text Modification Commands

a

add text after current character

A

append text to end of current line

[n]cX, c[n]X

change current character up to cursor position defined by X

[n]dX, d[n] X

delete current character up to cursor position defined by X

[n]yX, y[n]X

copy current character up to cursor position defined by X into buffer

X

used to define ending cursor position for c, d, or y commands

b

backwards to beginning of word

e

cursor to end of current word

w

cursor to beginning of next word

W B E

same as w b e, but ignore punctuation

0

before cursor to end of current line

$

cursor to end of current line

C

change current character to end of line

D

delete current character through end of line

i

insert text left of the current character

I

insert text before beginning of line

[n]p

put previously yanked/deleted text after cursor

[n]P

put previously yanked/deleted text before cursor

[n]rc

replace current character with c

R

replace text from cursor to <ESCAPE>

S

delete entire line and enter input mode

yy

copy current line into buffer

[n]x

delete current character

[n]X

delete previous character

[n].

repeat last text modification command

[n]~

toggle case of current character

[n]_

append last word of previous ksh command

\

replace current word with filename that matches word*. For unique matches, append a / to directories and " " (space) for files.

Vi Other Edit Commands

u

undo last text modification command

U

undo text modification commands on current line

[n]v

return output of fc e command

Ctl-l

redisplay current line

Ctl-j

execute current line

Ctl-m

execute current line

#

insert a # (comment) at beginning of current line

=

list files that match current word*

*

replace current word with files that match word*

@_c

insert value of alias c

Emacs/Gmacs In-Line Editor Commands

Ctl-b

move left one character

Ctl-f

move right one character

Esc-b

move left one word

Esc-f

move right one word

Ctl-a

move to beginning of line

Ctl-e

move to end of line

Ctl-h

delete preceding character

Ctl-x

delete the entire line

Ctl-k

delete from cursor to end of line

Ctl-d

delete current character

Esc-d

delete current word

Ctl-w

delete from cursor to mark

Ctl-y

undo last delete (w/Esc-p)

Ctl-p

get previous command from history file

Ctl-n

get next command from history file

Ctl-o

execute current command line and get next command line

Ctl-rstring

search backward in history file for command that contains string

Ctl-c

change current character to upper case

Esc-c

change current word to upper case

Esc-l

change current character to lower case

Esc-p

save to buffer from cursor to mark

Esc-<SPACE>, Ctl-@

mark current location

Ctl-l

redisplay current line

Ctl-]c

move cursor forward to character c

Ctl-xCtl-x

interchange the cursor and mark

erase

delete previous character

Esc-Ctl-h

delete previous word

Esc-h

delete previous word

Ctl-t

transpose current and next character (emacs)

Ctl-t

transpose two previous characters (gmacs)

Ctl-j

execute current line

Ctl-m

execute current line

Esc-<

get oldest command line

Esc->

get previous command line

Esc-n

define numeric parameter n for next command (command can be Ctl-c, Ctl-d, Ctl-k, Ctl-n, Ctl-p, Ctl-r, Esc-., Ctl-]c, Esc-_, Esc-b, Esc-c, Esc-d, Esc-f, Esc-h, Esc-l, Esc-Ctl-h)

Esc-c

insert value of alias _c (c cannot be b, c, d, f, h, l, or p)

Esc-., Esc-_

insert last word of previous command

Esc-Esc

replace current word with filename that matches word*. For unique matches, append a / to directories and " " (space) for files

Esc-=

list files that match current word*

Ctl-u

multiply parameter of next command by 4

\

escape next character

Ctl-v

display version of shell

Esc-#

insert a # (comment) at beginning of current line


       
    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