DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 27th April 2013
Skinny Skinny is offline
Port Guard
 
Join Date: Jul 2012
Posts: 25
Default ksh: wrap lines?

Is it possible to configure ksh to wrap lines which exceed the terminal width?
I couldn't find anything appropriate in ksh/stty/getty man pages...
Reply With Quote
  #2   (View Single Post)  
Old 27th April 2013
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

I think some wrap occur through your terminal.
from man xterm
Quote:
-aw This option indicates that auto-wraparound should be allowed.
This allows the cursor to automatically wrap to the beginning
of the next line when it is at the rightmost position of a line
and text is output.
Additionally, you can set line length with format
in man vim
Reply With Quote
  #3   (View Single Post)  
Old 27th April 2013
Skinny Skinny is offline
Port Guard
 
Join Date: Jul 2012
Posts: 25
Default

Thanks.

I'm away of 'set textwidth=n' in vim but I want line wrapping the the shell.
'xterm -aw' doesn't fix that.
Running bash in the same xterm *does* line wrapping. So it seems this behavior is causes by ksh.

Any further ideas?
Reply With Quote
  #4   (View Single Post)  
Old 28th April 2013
thomasw_ thomasw_ is offline
Real Name: thomas
Port Guard
 
Join Date: Feb 2013
Location: kimberley
Posts: 30
Default

I think you want to do a set -o multiline.

Excerpt from man ksh:

multiline:

The built-in editors will use multiple lines on the screen for lines that are longer than the width of the screen.

BTW, if using the standard vi editor in OpenBSD, not vim, you will get line wrapping at 72 characters with the following in a ~/.exrc :>

set wrapmargin=8
set autoindent
set shiftwidth=4
Reply With Quote
  #5   (View Single Post)  
Old 28th April 2013
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by thomasw_ View Post
I think you want to do a set -o multiline.

Excerpt from man ksh:

multiline:

The built-in editors will use multiple lines on the screen for lines that are longer than the width of the screen.
The multiline option sounds very interesting, but I don't find it in ksh(1). Is it perhaps for a variant version of ksh that has to be installed as a package?
Reply With Quote
  #6   (View Single Post)  
Old 29th April 2013
thomasw_ thomasw_ is offline
Real Name: thomas
Port Guard
 
Join Date: Feb 2013
Location: kimberley
Posts: 30
Default

Yes if I recall it is 5.12; so for OpenBSD ksh console, I think the LINES perimeter needs to be set.

If in X, one could do something like this in a ~/.profile:

alias resize='eval `/usr/bin/X11/resize`'

or

eval $(resize) -- the resize utility has two options:> [-u] [-s [row col]

Set the ksh alias; after resizing a window in X, but before running an application, type:

resize

that should do it.
Reply With Quote
  #7   (View Single Post)  
Old 1st May 2013
Skinny Skinny is offline
Port Guard
 
Join Date: Jul 2012
Posts: 25
Default

'resize' doesn't work for me. It sets the COLUMNS and LINES variable but the ksh still doesn't wrap long lines.
It hard to imagine all ksh users are satisfied with the non-wrapping behavior...
Reply With Quote
  #8   (View Single Post)  
Old 1st May 2013
denta denta is offline
Shell Scout
 
Join Date: Nov 2009
Location: Sweden
Posts: 95
Default

Just to clarify, you mean wrapping your input lines?

edit: or I guess output from commands such as ps -aux

Last edited by denta; 2nd May 2013 at 10:26 AM.
Reply With Quote
  #9   (View Single Post)  
Old 3rd May 2013
Skinny Skinny is offline
Port Guard
 
Join Date: Jul 2012
Posts: 25
Default

Quote:
Originally Posted by denta View Post
Just to clarify, you mean wrapping your input lines?
Yes.
Because I'd like to see the whole command before hitting Return.
Reply With Quote
Old 3rd May 2013
denta denta is offline
Shell Scout
 
Join Date: Nov 2009
Location: Sweden
Posts: 95
Default

Alright! It can be done by disabling emacs editing mode.

Code:
$ set +o emacs
Its a scary world without it though, if you are used to it

Last edited by denta; 3rd May 2013 at 02:34 PM.
Reply With Quote
Old 3rd May 2013
Skinny Skinny is offline
Port Guard
 
Join Date: Jul 2012
Posts: 25
Default

Thank you! I always knew emacs is the root of all evil.

Strangely enough 'set -o vi' behaves like emacs with respect to line wrapping.
Reply With Quote
Old 3rd May 2013
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Coming back to thomasw's suggestion of

% set -o multiline

this works with ksh93 (verified on Linux). That isn't the OpenBSD system ksh, but it's available as a package, so might be worth a try if you're willing to install another shell.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting whitespace from otherwise blank lines J65nko Guides 4 18th June 2013 08:44 AM
Deleting lines with certain letters/keywords. bigb89 Programming 4 12th November 2008 11:59 PM
Putting Lines to Together. bigb89 Programming 4 24th September 2008 03:59 AM
Adding multiple lines into file c0mrade Programming 4 7th June 2008 11:03 PM


All times are GMT. The time now is 06:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick