Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn on word wrap in linux less viewer? [closed]

Word wrap mode of "less" viewer is disabled by default in the system I work on. According to "less" viewer help, it is disabled with -S or --chop-long-lines flags. I did not find how to force word wrap on my system. Is there any known flag, or any other way, for enabling the mode?

like image 614
user1952686 Avatar asked May 20 '16 08:05

user1952686


People also ask

How do you wrap text in Linux?

In Linux, the fold command can wrap text that displays wider than a monitor's width. The Linux fold takes lines of text and breaks them into chunks based on the arguments that you provide. With no arguments, fold will break lines at 80 characters.

How do I turn word wrap on?

Enable or disable text wrapping for a text box, rich text box, or expression box. Right-click the control for which you want to enable or disable text wrapping, and then click Control Properties on the shortcut menu. Click the Display tab. Select or clear the Wrap text check box.

How do I turn off word wrap in terminal?

Completely disabling line wrapping for embedded terminals in VSCode is not possible because the shell running within the terminal window always breaks lines to its visible width. As of VSCode 1.61 (Sep 2021) you can set a wider virtual width of the terminal window.

Which tag is used to turn off the word wrapping?

Word Wrapping Netscape includes two tags: <NOBR>... </NOBR>, and <WBR>. The former turns off wordwrapping between the start and end NOBR tag, while WBR is for the rare case when you want to specify where to break the line if needed.


2 Answers

Word wrapping is disabled using -S. Following the man page, you can reset that option by passing -+S to the command line.

Let's say you have $LESS set to -S, you can re-enable it on the command line with

less -+S file
like image 199
hek2mgl Avatar answered Oct 01 '22 08:10

hek2mgl


You may try using the LESS environment variable. For example, you can put the following into system-wide shell initialization script (/etc/profile for bash/ksh):

 export LESS="-S "
like image 20
GMichael Avatar answered Oct 01 '22 10:10

GMichael