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

2

12

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?

Original answered 20/5, 2016 at 8:59 Comment(2)
What do you mean by force word wrap on my system?Gervais
my system = virtual linux machine in my work (logging in from windows with VNC viewer), cent os 6.5, gnome, tc shell.Original
G
8

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 "
Gervais answered 20/5, 2016 at 9:12 Comment(1)
thanks. solved. when i do echo "$LESS" i see "-i-S-q-u-R". That's why word wrap is disabled by default.Original
A
28

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
Ajmer answered 20/5, 2016 at 9:23 Comment(1)
Great tip for a plus sign!Buhl
G
8

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 "
Gervais answered 20/5, 2016 at 9:12 Comment(1)
thanks. solved. when i do echo "$LESS" i see "-i-S-q-u-R". That's why word wrap is disabled by default.Original

© 2022 - 2024 — McMap. All rights reserved.