Unix Shell - set -o vi issues on ksh

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > April 2004 > set -o vi issues on ksh





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author set -o vi issues on ksh
sriram sitararman

2004-04-21, 1:35 am

Hi.
I use /bin/ksh on linux and use set -o vi, for line edits on command
line. On Solaris, it works find, with as many charecters per line, but
on LINUX, it wraps around after certain number of charecters, and
shows me only the last few charecters.
my prompt is 30 charecters long. I have notice that if I set my prompt
to more than 80 chars, it ponly shows that last few.

ths screws up in long commands on the shell command line.. like for
loop etc.

I have tried adjusting vi (or vim) options, by changing the EXINIT
variable/ .exrc/ .vimrc file, for nowarp/ textwidth/ wrapmargin etc..

even the cols and rows. I have seen this behaviour only when I set my
EDITOR=vi, or set -o vi.

help. I want to use ksh on linux (red hat whatever), and use set -o
vi/ and be able to type more than 80 charecters on the command line.

Sriram
Post a follow-up to this message
William Park

2004-04-21, 1:35 am

sriram sitararman <sriram_sitaraman@yahoo.com> wrote:
> Hi.
> I use /bin/ksh on linux and use set -o vi, for line edits on command
> line. On Solaris, it works find, with as many charecters per line, but
> on LINUX, it wraps around after certain number of charecters, and
> shows me only the last few charecters.
> my prompt is 30 charecters long. I have notice that if I set my prompt
> to more than 80 chars, it ponly shows that last few.
>
> ths screws up in long commands on the shell command line.. like for
> loop etc.
>
> I have tried adjusting vi (or vim) options, by changing the EXINIT
> variable/ .exrc/ .vimrc file, for nowarp/ textwidth/ wrapmargin etc..


'set -o vi' has nothing to do with external editor, like vi, vim, emacs.
It simply tells Bash to use Vi-mode in editing the command line.

I'm using Bash and 'set -o vi' without any problem.

>
> even the cols and rows. I have seen this behaviour only when I set my
> EDITOR=vi, or set -o vi.
>
> help. I want to use ksh on linux (red hat whatever), and use set -o
> vi/ and be able to type more than 80 charecters on the command line.
>
> Sriram
> Post a follow-up to this message


--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution/training/migration, Thin-client
Bill Marcum

2004-04-21, 4:34 am

On 20 Apr 2004 22:10:38 -0700, sriram sitararman
<sriram_sitaraman@yahoo.com> wrote:
> Hi.
> I use /bin/ksh on linux and use set -o vi, for line edits on command
> line. On Solaris, it works find, with as many charecters per line, but
> on LINUX, it wraps around after certain number of charecters, and
> shows me only the last few charecters.
> my prompt is 30 charecters long. I have notice that if I set my prompt
> to more than 80 chars, it ponly shows that last few.
>

Are there any non-printing characters (e.g. color codes) in your prompt?
man ksh, search for PS1.


--
Giraffe: a ruminant with a view.
Villy Kruse

2004-04-21, 10:35 am

On Wed, 21 Apr 2004 07:57:48 -0000,
Bill Marcum <bmarcum@iglou.com.urgent> wrote:


> On 20 Apr 2004 22:10:38 -0700, sriram sitararman
> <sriram_sitaraman@yahoo.com> wrote:
> Are there any non-printing characters (e.g. color codes) in your prompt?
> man ksh, search for PS1.
>



Try embed a newline in PS1. Like this:

PS1='longstring with full pathname, full hostname, and username etc
$ '

Then you get a two line prompt.

Villy
Kevin Collins

2004-04-21, 6:36 pm

In article <c65138$7l6c1$2@ID-99293.news.uni-berlin.de>, William Park wrote:
> sriram sitararman <sriram_sitaraman@yahoo.com> wrote:
>
> 'set -o vi' has nothing to do with external editor, like vi, vim, emacs.
> It simply tells Bash to use Vi-mode in editing the command line.
>
> I'm using Bash and 'set -o vi' without any problem.
>


You may very well be, but the OP specifically says "/bin/ksh".
[vbcol=seagreen]

I too have seen this problem and it is annying. I'd love to find a quick fix.

Kevin
William Park

2004-04-21, 8:34 pm

Kevin Collins <spamtotrash@toomuchfiction.com> wrote:
> In article <c65138$7l6c1$2@ID-99293.news.uni-berlin.de>, William Park wrote:
>
> You may very well be, but the OP specifically says "/bin/ksh".


I was typing too fast... also in Ksh93 (Slackware-9.1).

--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution/training/migration, Thin-client
Stephane CHAZELAS

2004-04-22, 3:36 am

2004-04-20, 22:10(-07), sriram sitararman:
> I use /bin/ksh on linux and use set -o vi, for line edits on command
> line. On Solaris, it works find, with as many charecters per line, but
> on LINUX, it wraps around after certain number of charecters, and
> shows me only the last few charecters.


You may want to try zsh ksh emulation. You'd even be able to use
many of the powerful zsh features including prompt extensions.

Just create a symlink to zsh named ksh. Or start zsh with
ARGV0=ksh zsh, or issue "emulate ksh" within zsh.

(get zsh 4.2 preferably).

--
Stéphane ["Stephane.Chazelas" at "free.fr"]
Geoff Clare

2004-04-22, 10:44 am

"sriram sitararman" <sriram_sitaraman@yahoo.com> wrote, on Wed, 21 Apr 2004:

> I use /bin/ksh on linux and use set -o vi, for line edits on command
> line. On Solaris, it works find, with as many charecters per line, but
> on LINUX, it wraps around after certain number of charecters, and
> shows me only the last few charecters.
> my prompt is 30 charecters long. I have notice that if I set my prompt
> to more than 80 chars, it ponly shows that last few.


Sounds like you have "viraw" turned on for Linux but not for Solaris.
What does "set -o" say about the viraw setting on each system?

--
Geoff Clare <nospam@gclare.org.uk>
budman

2004-04-25, 12:34 pm

On Wed, 21 Apr 2004 05:33:28 +0000, William Park wrote:

> sriram sitararman <sriram_sitaraman@yahoo.com> wrote:


>
> 'set -o vi' has nothing to do with external editor, like vi, vim, emacs.
> It simply tells Bash to use Vi-mode in editing the command line.
>
> I'm using Bash and 'set -o vi' without any problem.
>


I have the same issue with ksh on SGI and Linux. However, ksh on Solaris
is fine.

I checked the stty parms, nothing changed on the Linux machine.
I login with the ksh, had command line limit with or without set -o vi.
When I ran bash, the command line was set to wrap, then I tried set -o vi,
same results. No problem in bash, so its ksh related.

The PS1 embedded newline works, it give you some more space at least, but
still no line wrap.

Examples:
prompt$ xxxxxxxxxxxxxxxxxxxsssssss ssldskdl*
prompt$ xxxxxxxxxxxxxxxxxx <

I curse having to edit a previous command, I usually use history then
paste with the mouse. Pain the balls.. but.. it works. It really sucks as
you traverse directories.. one time I think I had an 8 character command
line - try typing in that. I didn't bother with the prompt because ksh
does not work with escaped controls, didn't think of embedding. I will
from now on, at least I can see 80 chars.

It would be great to fix this, I know many people that would be really
happy!

Rich
David Douthitt

2004-04-26, 6:37 pm

On 20 Apr 2004 22:10:38 -0700, sriram_sitaraman@yahoo.com (sriram
sitararman) wrote:

> I use /bin/ksh on linux and use set -o vi, for line edits on command
>line. On Solaris, it works find, with as many charecters per line, but
>on LINUX, it wraps around after certain number of charecters, and
>shows me only the last few charecters.


>my prompt is 30 charecters long. I have notice that if I set my prompt
>to more than 80 chars, it ponly shows that last few.
>
>ths screws up in long commands on the shell command line.. like for
>loop etc.


The command 'set -o vi' sets the command-line editing mode to vi and
has nothing to do with vim, ex, ed, or any other editor.

The command line is unaffected by this "shift"; if you want to see the
beginning of the line use the vi command to go to start of line ("0").

Both bash and pdksh support a variable called COLUMNS which sets the
number of columns to use for the command line; the shell only
"scrolls" or "shifts" when the number of characters goes beyond the
number of characters specified in COLUMNS.

To change it:

export COLUMNS=132

....to make it 132 columns.

Another thing: as you are typing, you can hit return in the middle of
a for loop after a do command, and the shell knows that more is
required. For instance,

# for i in * ; do
> echo ---- $i ----
> ls -ldi $i
> done


The ">" is the normal "continue" prompt (set in PS2).

If you prefer ksh (as compared to bash) I'd use pdksh. pdksh is a
complete ksh clone and doesn't give you any non-ksh surprises.
..
David Douthitt (david@douthitt.net)
UNIX System Administrator
HP-UX, Unixware, Linux
Linux+, LPIC-1
lvirden@yahoo.com

2004-04-29, 10:35 am


According to David Douthitt <ssrat@mailbag.com>:
:If you prefer ksh (as compared to bash) I'd use pdksh. pdksh is a
:complete ksh clone and doesn't give you any non-ksh surprises.

Why not just build ksh or dtksh directly? The source is now available
for download and building...

--
<URL: http://wiki.tcl.tk/ > In God we trust.
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:lvirden@yahoo.com > <URL: http://www.purl.org/NET/lvirden/ >
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com