Difference between revisions of "Editor: nano"

From Dreamwidth Notes
Jump to: navigation, search
(Linebreaks in Nano)
 
 
(4 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
<source lang="bash">nano -w filename</source>
 
<source lang="bash">nano -w filename</source>
  
You may want to make this a default by aliasing the command:
+
To tell nano to not wrap lines by default, add (or uncomment) this line in <code>/etc/nanorc</code> or <code>~/.nanorc</code>:
  
<source lang="bash">echo 'alias nano="nano -w"' >> ~/.bashrc</source>
+
<source lang="text">set nowrap</source>
  
Now, whenever you run 'nano', it'll run 'nano -w' instead.
+
To convert typed tabs to spaces by default, add (or uncomment) this line in <code>/etc/nanorc</code> or <code>~/.nanorc</code>:
 +
 
 +
<source lang="text">set tabstospaces</source>
 +
 
 +
[[Category: Editors]]

Latest revision as of 22:21, 7 April 2009

Expand: This needs expansion.

By default nano quietly adds linebreaks to the file that you're working on, not just word-wraps it for display in the editor. This can cause trouble with generating patches, and because it's indistinguishable from word-wrapping in the editor, it can take you a while to diagnose it. To prevent this from happening, when you call nano, do it with the -w flag, which will turn off auto-linebreaking:

nano -w filename

To tell nano to not wrap lines by default, add (or uncomment) this line in /etc/nanorc or ~/.nanorc:

set nowrap

To convert typed tabs to spaces by default, add (or uncomment) this line in /etc/nanorc or ~/.nanorc:

set tabstospaces