|
|
|
|
|
|
| Author |
Message |
gargoyle *nix forums beginner
Joined: 01 Mar 2005
Posts: 19
|
Posted: Sun Feb 13, 2005 3:06 pm Post subject:
Re: Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
On 2005-02-10, Janis Papanagnou <Janis_Papanagnou@hotmail.com> wrote:
| Quote: | In vi-mode you can <Esc>-scrollback-<V> to edit _any_ command in the
history, not just the last one.
Ksh's v-command is able to work during your scrolling through the command
history, you don't need to know the command numbers. For example you can
type
ESC
/pattern
n
n
v
to _interactively_ iterate through the history and select the v command
when you are at the desired line.
|
It works "sorta ok" in emacs mode on my OpenBSD 3.6 box (PD KSH
v5.2.14). The only downside is that some "junk" characters get inserted
when I try to edit a history line. I posted about this a few months ago,
here's the relevant text. Maybe this will help you a little. I still
haven't figured out where the junk chars are coming from, or why DEL key
doesn't work. :-(
2) Ctrl-R allows cycling through the history, but when it presents me
the desired command line, I can't seem to edit it without adding "junk"
characters.
Example:
ksh$ <- type Ctrl-R here
I-search: <- type s here
ksh$ ls /dev/zero <- type u here
ksh$ ls /usr/ports/net <- type d here
ksh$ sudo tcpdump <- hit RightArrow key here
ksh$ sud[Co tcpdump
Here I wanted to recall an earlier "sudo tcpdump" command line, and
replace it with "sudo tcpdump -n". I started typing the beginning
characters of "sudo" until it found the right line. Then I stopped and
used the right arrow key to move the cursor one space to the right, and
that's when it inserted these two characters: [C
Note that immediately after that initial garbage input, the Arrow keys
work normally. Weird...
I could have used Ctrl-E to go to the end of the line and use backspace
to erase the unwanted "tcpdump" string, but in some cases that's more
trouble than it's worth, especially when editing something in the middle
or beginning of a long line.
Are there any terminal settings I must use? I don't currently have
anything special set, just the default ksh running in an rxvt. However,
this behavior also happens at the text console as well, so I didn't
spend too much time playing around with Xresources/xmodmap settings.
If it matters, here's my software versions:
PD KSH v5.2.14 99/07/13.2
OpenBSD 3.6 (i386)
rxvt-2.7.10
Possibly relevant env vars currently set:
TERM=xterm-color
COLORTERM=rxvt-xpm
My ~/.profile has:
set +o vi
set -o emacs
The output from "stty -a" is:
speed 38400 baud; 52 rows; 135 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc -xcase
iflags: -istrip icrnl -inlcr -igncr -iuclc ixon -ixoff -ixany imaxbel
-ignbrk brkint -inpck ignpar -parmrk
oflags: opost onlcr -ocrnl -onocr -onlret -olcuc -oxtabs -onoeot
cflags: cread cs8 -parenb -parodd -hupcl -clocal -cstopb -crtscts -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^@;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
3) The Delete key doesn't work at all, it just inserts ~ (ASCII 0x7e)
characters instead. This also happens in console mode, not just X11.
Any ideas on things I can do or should look at? |
|
| Back to top |
|
 |
Janis Papanagnou *nix forums Guru
Joined: 24 Feb 2005
Posts: 450
|
Posted: Thu Feb 10, 2005 9:42 pm Post subject:
Re: Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
Kevin Rodgers wrote:
| Quote: | Janis Papanagnou wrote:
Kevin Rodgers wrote:
Mike Woinoski wrote:
If ksh93 is set to vi mode (set -o vi), the "v" command launches a
visual edit session on a temp file containing the command. This is
very useful for modifying complex commands.
Is there an equivalent command in ksh emacs mode (set -o emacs)?
alias v='fc -e ${FCEDIT:-emacs}'
How would that be invoked to work as in vi-mode?
|
I asked how that would work *as* [the v-command] in vi-mode.
| Quote: | It works by defining an alias, which is invoked like any other command
regardless of the editing mode.
|
You describe your code but did not answer the question. That's not how
the vi-mode v-command works.
| Quote: | In vi-mode you can <Esc>-scrollback-<V> to edit _any_ command in the
history, not just the last one.
v 3 # to edit command 3
v -7 # to edit the 7th previous command
|
Ksh's v-command is able to work during your scrolling through the command
history, you don't need to know the command numbers. For example you can
type
ESC
/pattern
n
n
v
to _interactively_ iterate through the history and select the v command
when you are at the desired line.
That is a very useful feature that a simple alias version seems not to be
able to cover.
Janis |
|
| Back to top |
|
 |
Kevin Rodgers *nix forums beginner
Joined: 01 Mar 2005
Posts: 29
|
Posted: Thu Feb 10, 2005 7:52 pm Post subject:
Re: Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
Janis Papanagnou wrote:
| Quote: | Kevin Rodgers wrote:
Mike Woinoski wrote:
If ksh93 is set to vi mode (set -o vi), the "v" command launches a
visual edit session on a temp file containing the command. This is
very useful for modifying complex commands.
Is there an equivalent command in ksh emacs mode (set -o emacs)?
alias v='fc -e ${FCEDIT:-emacs}'
How would that be invoked to work as in vi-mode?
|
It works by defining an alias, which is invoked like any other command
regardless of the editing mode.
| Quote: | In vi-mode you can <Esc>-scrollback-<V> to edit _any_ command in the
history, not just the last one.
|
v 3 # to edit command 3
v -7 # to edit the 7th previous command
--
Kevin Rodgers |
|
| Back to top |
|
 |
Janis Papanagnou *nix forums Guru
Joined: 24 Feb 2005
Posts: 450
|
Posted: Wed Feb 09, 2005 6:51 pm Post subject:
Re: Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
Kevin Rodgers wrote:
| Quote: | Mike Woinoski wrote:
If ksh93 is set to vi mode (set -o vi), the "v" command launches a
visual edit session on a temp file containing the command. This is
very useful for modifying complex commands.
Is there an equivalent command in ksh emacs mode (set -o emacs)?
alias v='fc -e ${FCEDIT:-emacs}'
|
How would that be invoked to work as in vi-mode?
In vi-mode you can <Esc>-scrollback-<V> to edit _any_ command in the
history, not just the last one.
Janis |
|
| Back to top |
|
 |
Kevin Rodgers *nix forums beginner
Joined: 01 Mar 2005
Posts: 29
|
Posted: Wed Feb 09, 2005 3:17 pm Post subject:
Re: Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
Mike Woinoski wrote:
| Quote: | If ksh93 is set to vi mode (set -o vi), the "v" command launches a
visual edit session on a temp file containing the command. This is very
useful for modifying complex commands.
Is there an equivalent command in ksh emacs mode (set -o emacs)?
|
alias v='fc -e ${FCEDIT:-emacs}'
--
Kevin Rodgers |
|
| Back to top |
|
 |
Mike Woinoski *nix forums beginner
Joined: 08 Feb 2005
Posts: 2
|
Posted: Tue Feb 08, 2005 7:55 pm Post subject:
Is there a ksh emacs mode equivalent to the vi mode's "v" command?
|
|
|
If ksh93 is set to vi mode (set -o vi), the "v" command launches a visual edit
session on a temp file containing the command. This is very useful for modifying
complex commands.
Is there an equivalent command in ksh emacs mode (set -o emacs)?
Thanks,
Mike |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 12:29 am | All times are GMT
|
|
Mortgages | Remortgages | Loans | Bankruptcy | MPAA
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|