Smart word wrapping in `less`?
I use the Python package rtv
as a terminal client to read Reddit. When it gets to a large text box, it calls less
display the text. Currently, less
wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?
linux bash terminal cygwin less
add a comment |
I use the Python package rtv
as a terminal client to read Reddit. When it gets to a large text box, it calls less
display the text. Currently, less
wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?
linux bash terminal cygwin less
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39
add a comment |
I use the Python package rtv
as a terminal client to read Reddit. When it gets to a large text box, it calls less
display the text. Currently, less
wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?
linux bash terminal cygwin less
I use the Python package rtv
as a terminal client to read Reddit. When it gets to a large text box, it calls less
display the text. Currently, less
wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?
linux bash terminal cygwin less
linux bash terminal cygwin less
asked Jul 20 '16 at 18:22
Ed Doe
111
111
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39
add a comment |
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39
add a comment |
3 Answers
3
active
oldest
votes
One solution is to use the -S
(--chop-long-lines
) command line option for less
. This tells less
to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.
You can enable this behavior by adding -S
to the command line or setting the environment variable, LESS
, like this in Bash:
$ export LESS='-S'
More on word wrapping can be found in this question: How to turn off word-wrap in less
add a comment |
Put this in your .bashrc or similar configuration file.
export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""
add a comment |
I use the unix toolbox for my terminal/bash viewer:
alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1103256%2fsmart-word-wrapping-in-less%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
One solution is to use the -S
(--chop-long-lines
) command line option for less
. This tells less
to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.
You can enable this behavior by adding -S
to the command line or setting the environment variable, LESS
, like this in Bash:
$ export LESS='-S'
More on word wrapping can be found in this question: How to turn off word-wrap in less
add a comment |
One solution is to use the -S
(--chop-long-lines
) command line option for less
. This tells less
to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.
You can enable this behavior by adding -S
to the command line or setting the environment variable, LESS
, like this in Bash:
$ export LESS='-S'
More on word wrapping can be found in this question: How to turn off word-wrap in less
add a comment |
One solution is to use the -S
(--chop-long-lines
) command line option for less
. This tells less
to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.
You can enable this behavior by adding -S
to the command line or setting the environment variable, LESS
, like this in Bash:
$ export LESS='-S'
More on word wrapping can be found in this question: How to turn off word-wrap in less
One solution is to use the -S
(--chop-long-lines
) command line option for less
. This tells less
to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.
You can enable this behavior by adding -S
to the command line or setting the environment variable, LESS
, like this in Bash:
$ export LESS='-S'
More on word wrapping can be found in this question: How to turn off word-wrap in less
edited Mar 20 '17 at 10:17
Community♦
1
1
answered Jul 22 '16 at 0:07
Stephen Balousek
17614
17614
add a comment |
add a comment |
Put this in your .bashrc or similar configuration file.
export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""
add a comment |
Put this in your .bashrc or similar configuration file.
export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""
add a comment |
Put this in your .bashrc or similar configuration file.
export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""
Put this in your .bashrc or similar configuration file.
export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""
answered Apr 14 '17 at 19:23
ASaylover3156
111
111
add a comment |
add a comment |
I use the unix toolbox for my terminal/bash viewer:
alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
add a comment |
I use the unix toolbox for my terminal/bash viewer:
alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
add a comment |
I use the unix toolbox for my terminal/bash viewer:
alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
I use the unix toolbox for my terminal/bash viewer:
alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
answered Dec 3 at 20:03
sbin_bash
1
1
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
add a comment |
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
– Scott
Dec 3 at 20:25
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1103256%2fsmart-word-wrapping-in-less%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39