How do I make nano act like vi when it comes to text wrapping?
When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.
How can I make nano behave like vi when it becomes to this feature?
vi newlines nano
add a comment |
When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.
How can I make nano behave like vi when it becomes to this feature?
vi newlines nano
add a comment |
When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.
How can I make nano behave like vi when it becomes to this feature?
vi newlines nano
When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.
How can I make nano behave like vi when it becomes to this feature?
vi newlines nano
vi newlines nano
edited Sep 5 '17 at 23:56
Gilles
528k12810571583
528k12810571583
asked Sep 5 '17 at 23:40
mrjayviper
4971619
4971619
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.
To disable this feature in nano, press Alt+L. In nvi, set wraplen
and wrapmagin
to 0 (:set wl=0 wm=0
).
Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.
If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.
¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
add a comment |
https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char
answered by @Marco Ceppi:
Nano Install Nano is a little easier. You can launch nano with the -L
flag (or --nonewlines if you're more the visual type). This will
disable the automatic addition of the newline to the end of the file
(so long as one was not actually entered). Ideally you could setup
this alias in your ~/.bashrc: alias nanon=nano -L which would launch
Nano with the no newlines flag included in it.
add a comment |
Open the nanorc generally at ~/.nanorc
or /etc/nanorc
, comment out the line
set nowrap
And uncomment line
set softwrap
Hope it helps.
Note: This only works for nano 2 and not nano 3. Since nano 2,set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignoreset softwrap
and continue to hardwrap ifset nowrap
isn't added. So add bothset nowrap
andset softwrap
for textwrapping that doesn't break your files.
– x0a
4 mins ago
add a comment |
The wrapping behavior of nano 1, nano 2, and nano 3 differs.
On nano 1, you only have the set nowrap
setting which disables all wrapping.
On nano 2, set softwrap
enables softwrapping and disables hardwrapping.
On nano 3, set softwrap
is ignored and nano continues to hardwrap unless you also set set nowrap
.
So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc
set nowrap
set softwrap
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f390585%2fhow-do-i-make-nano-act-like-vi-when-it-comes-to-text-wrapping%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.
To disable this feature in nano, press Alt+L. In nvi, set wraplen
and wrapmagin
to 0 (:set wl=0 wm=0
).
Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.
If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.
¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
add a comment |
Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.
To disable this feature in nano, press Alt+L. In nvi, set wraplen
and wrapmagin
to 0 (:set wl=0 wm=0
).
Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.
If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.
¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
add a comment |
Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.
To disable this feature in nano, press Alt+L. In nvi, set wraplen
and wrapmagin
to 0 (:set wl=0 wm=0
).
Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.
If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.
¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.
Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.
To disable this feature in nano, press Alt+L. In nvi, set wraplen
and wrapmagin
to 0 (:set wl=0 wm=0
).
Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.
If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.
¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.
answered Sep 5 '17 at 23:56
Gilles
528k12810571583
528k12810571583
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
add a comment |
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
– mrjayviper
Sep 6 '17 at 0:49
add a comment |
https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char
answered by @Marco Ceppi:
Nano Install Nano is a little easier. You can launch nano with the -L
flag (or --nonewlines if you're more the visual type). This will
disable the automatic addition of the newline to the end of the file
(so long as one was not actually entered). Ideally you could setup
this alias in your ~/.bashrc: alias nanon=nano -L which would launch
Nano with the no newlines flag included in it.
add a comment |
https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char
answered by @Marco Ceppi:
Nano Install Nano is a little easier. You can launch nano with the -L
flag (or --nonewlines if you're more the visual type). This will
disable the automatic addition of the newline to the end of the file
(so long as one was not actually entered). Ideally you could setup
this alias in your ~/.bashrc: alias nanon=nano -L which would launch
Nano with the no newlines flag included in it.
add a comment |
https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char
answered by @Marco Ceppi:
Nano Install Nano is a little easier. You can launch nano with the -L
flag (or --nonewlines if you're more the visual type). This will
disable the automatic addition of the newline to the end of the file
(so long as one was not actually entered). Ideally you could setup
this alias in your ~/.bashrc: alias nanon=nano -L which would launch
Nano with the no newlines flag included in it.
https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char
answered by @Marco Ceppi:
Nano Install Nano is a little easier. You can launch nano with the -L
flag (or --nonewlines if you're more the visual type). This will
disable the automatic addition of the newline to the end of the file
(so long as one was not actually entered). Ideally you could setup
this alias in your ~/.bashrc: alias nanon=nano -L which would launch
Nano with the no newlines flag included in it.
answered Sep 5 '17 at 23:53
NOP
1184
1184
add a comment |
add a comment |
Open the nanorc generally at ~/.nanorc
or /etc/nanorc
, comment out the line
set nowrap
And uncomment line
set softwrap
Hope it helps.
Note: This only works for nano 2 and not nano 3. Since nano 2,set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignoreset softwrap
and continue to hardwrap ifset nowrap
isn't added. So add bothset nowrap
andset softwrap
for textwrapping that doesn't break your files.
– x0a
4 mins ago
add a comment |
Open the nanorc generally at ~/.nanorc
or /etc/nanorc
, comment out the line
set nowrap
And uncomment line
set softwrap
Hope it helps.
Note: This only works for nano 2 and not nano 3. Since nano 2,set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignoreset softwrap
and continue to hardwrap ifset nowrap
isn't added. So add bothset nowrap
andset softwrap
for textwrapping that doesn't break your files.
– x0a
4 mins ago
add a comment |
Open the nanorc generally at ~/.nanorc
or /etc/nanorc
, comment out the line
set nowrap
And uncomment line
set softwrap
Hope it helps.
Open the nanorc generally at ~/.nanorc
or /etc/nanorc
, comment out the line
set nowrap
And uncomment line
set softwrap
Hope it helps.
edited Aug 24 at 11:59
GAD3R
25.4k1750106
25.4k1750106
answered Aug 24 at 10:22
Prashant Shubham
312
312
Note: This only works for nano 2 and not nano 3. Since nano 2,set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignoreset softwrap
and continue to hardwrap ifset nowrap
isn't added. So add bothset nowrap
andset softwrap
for textwrapping that doesn't break your files.
– x0a
4 mins ago
add a comment |
Note: This only works for nano 2 and not nano 3. Since nano 2,set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignoreset softwrap
and continue to hardwrap ifset nowrap
isn't added. So add bothset nowrap
andset softwrap
for textwrapping that doesn't break your files.
– x0a
4 mins ago
Note: This only works for nano 2 and not nano 3. Since nano 2,
set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap
and continue to hardwrap if set nowrap
isn't added. So add both set nowrap
and set softwrap
for textwrapping that doesn't break your files.– x0a
4 mins ago
Note: This only works for nano 2 and not nano 3. Since nano 2,
set nowrap
no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap
and continue to hardwrap if set nowrap
isn't added. So add both set nowrap
and set softwrap
for textwrapping that doesn't break your files.– x0a
4 mins ago
add a comment |
The wrapping behavior of nano 1, nano 2, and nano 3 differs.
On nano 1, you only have the set nowrap
setting which disables all wrapping.
On nano 2, set softwrap
enables softwrapping and disables hardwrapping.
On nano 3, set softwrap
is ignored and nano continues to hardwrap unless you also set set nowrap
.
So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc
set nowrap
set softwrap
New contributor
add a comment |
The wrapping behavior of nano 1, nano 2, and nano 3 differs.
On nano 1, you only have the set nowrap
setting which disables all wrapping.
On nano 2, set softwrap
enables softwrapping and disables hardwrapping.
On nano 3, set softwrap
is ignored and nano continues to hardwrap unless you also set set nowrap
.
So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc
set nowrap
set softwrap
New contributor
add a comment |
The wrapping behavior of nano 1, nano 2, and nano 3 differs.
On nano 1, you only have the set nowrap
setting which disables all wrapping.
On nano 2, set softwrap
enables softwrapping and disables hardwrapping.
On nano 3, set softwrap
is ignored and nano continues to hardwrap unless you also set set nowrap
.
So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc
set nowrap
set softwrap
New contributor
The wrapping behavior of nano 1, nano 2, and nano 3 differs.
On nano 1, you only have the set nowrap
setting which disables all wrapping.
On nano 2, set softwrap
enables softwrapping and disables hardwrapping.
On nano 3, set softwrap
is ignored and nano continues to hardwrap unless you also set set nowrap
.
So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc
set nowrap
set softwrap
New contributor
New contributor
answered 2 mins ago
x0a
1011
1011
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f390585%2fhow-do-i-make-nano-act-like-vi-when-it-comes-to-text-wrapping%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