from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

87889

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->app-editors->nano

Configuring the nano text editor


nano is a small, free and friendly editor which aims to replace Pico, the default editor included in the non-free Pine package. Rather than just copying Pico's look and feel, nano also implements some missing (or disabled by default) features in Pico, such as "search and replace" and "goto line number".

Lets go ahead and configure it.

($:~)=> nano -w ~/.nanorc
# Use auto-indentation  
set autoindent

# Backup files to filename~
set backup

# Use cut to end of line with ^K by default
set cut

# Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

# Don't convert files from DOS/Mac format
set noconvert

# Don't follow symlinks when writing files
# set nofollow

# Don't display the help lists at the bottom of the screen
# set nohelp

# Don't wrap text at all
set nowrap

# Use smooth scrolling as the default
set smooth

# Use this spelling checker instead of the internal one. This option
# does not properly have a default value.
set speller "aspell -c"

# Allow nano to be suspended with ^Z
# set suspend

# Use this tab size instead of the default; it must be greater than 0
# set tabsize 8

# Save automatically on exit, don't prompt
# set tempfile

# Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

# Disallow file modification, why would you want this in an rc file? ;)
# set view

#Color Syntax Highlighting
syntax "c-file" "\.(c|h)$"
color red "\<[A-Z_]{2,}\>"
color green "\<(float|char|int|void|static|const|struct)\>"
color brightyellow "\<(if|while|do|else|case|switch)\>"
color brightcyan "^#( )*(define|include|ifn?def|endif|elif|else|if)"
color brightyellow "<[^= ]*>" ""(.|[^"])*""
color brightyellow start=""(\\.|[^\"])*\\( | )*$" end="^(\\.|[^\"])*""
color brightblue "//.*"
color brightblue start="/\*" end="\*/"

syntax "HTML" "\.html$"
color blue start="<" end=">"
color red "&[^; ]*;"

syntax "TeX" "\.tex$"
color green "\\.|\\[A-Za-z]*"
color magenta "[{}]"
color blue "%.*"

syntax "mutt"
color green "^>.*"

syntax "php" ".*/*.php$"
color brightwhite "\{|\}|\."
color red "('[^']*')"
color red "\"[^\"]*\""
color brightblue "(\$([[:alpha:]_]|->)*)"
color brightgreen "((\$(([[:alpha:]_0-9])+\->)+)[[:alpha:]_0-9]+\()"
color yellow " (if|else if|else|return|case|break)"
color yellow "\|\||\?|!|\||&&|=|;|\(|\)"
color red "false|true"
color brightwhite "[[:space:]]+debug|[[:space:]]+echo|\$this\->debug"
color cyan "//.*"
color cyan start="/\*" end="\*/"

syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
color cyan "^\.ds [^ ]*"
color cyan "^\.nr [^ ]*"
color brightmagenta "\\."
color brightmagenta "\\f."
color brightmagenta "\\f\(.."
color brightmagenta "\\s(\+|\-)?[0-9]"
color cyan "(\\|\\\\)n."
color cyan "(\\|\\\\)n\(.."
color cyan start="(\\|\\\\)n\[" end="]"
color brightgreen "^\. *[^ ]*"
color yellow "^\.\\\".*$"
color green "(\\|\\\\)\*."
color green "(\\|\\\\)\*\(.."
color green start="(\\|\\\\)\*\[" end="]"
color brightred "\\\(.."
color brightred start="\\\[" end="]"
color brightcyan "\\\\\$[1-9]"

syntax "perl" "\.p[lm]$"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o
|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid
|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|
int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop
|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|
mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|st
udy|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
color cyan start="[$@%]" end="( |\\W|-)"
color yellow "".*"|qq\|.*\|"
color white "[sm]/.*/"
color white start="(^use| = new)" end=";"
color green "#.*"
color yellow start="<< 'STOP'" end="STOP"

syntax "Java source" "\.java$"
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
color red ""[^"]*""
color yellow "<(true|false|null)>"
color blue "//.*"
color blue start="/\*" end="\*/"
color brightblue start="/\*\*" end="\*/"
color brightgreen,brightgreen "[ ]+$"

syntax "nanorc" "[\.]*nanorc$"
color white "^ *(set|unset).*$"
color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
color brightwhite "^ *syntax [^ ]*"
color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
color white "^ *color\>.*"
color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
color magenta "^ *color\>"
color green "^#.*$"

syntax "bash" "\.sh$"
color brightblack "#.*"
color brightyellow "\(" "\)" "\{" "\}"
color red "\<[A-Z_]{2,}\>"
color red "[\$\*\'\`\|\=]"
color brightblue "\[.*\]"
color green "\<-e\>" "\<-d\>" "\<-f\>" "\<-r\>" "\<-g\>" "\<-u\>" "\<-u\>" "\<-w\>" "\<-x\>" "\<-L\>"
color green "\<-eq\>" "\<-ne\>" "\<-gt\>" "\<-lt\>" "\<-ge\>" "\<-le\>" "\<-s\>" "\<-n\>" "\<-z\>"
color blue "\" "\" "\" "\" "\" "\" "\" "\" "\"
color blue "\" "\" "\" "\" "\"
color brightwhite "\.*"


And thats it. You may want to read the /usr/share/doc/nano/nanorc.sample file for any other options you may want or change the color highlighting a bit.
rate this article:
current rating: average rating: 1.4 (58 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-08-23
ggml - 0.21.0-r1
Ebuild name:

sci-ml/ggml-0.21.0-r1

Description

Tensor library for machine learning

Added to portage

2026-08-23

2026-08-22
asteval - 1.0.10
Ebuild name:

dev-python/asteval-1.0.10

Description

Evaluator of Python expression using ast module

Added to portage

2026-08-22

boto3 - 1.43.78
Ebuild name:

dev-python/boto3-1.43.78

Description

The AWS SDK for Python

Added to portage

2026-08-22

botocore - 1.43.78
Ebuild name:

dev-python/botocore-1.43.78

Description

Low-level, data-driven core of boto 3

Added to portage

2026-08-22

brotlicffi - 1.2.0.2
Ebuild name:

dev-python/brotlicffi-1.2.0.2

Description

Python binding to the Brotli library

Added to portage

2026-08-22

cachelib - 0.16.1
Ebuild name:

dev-python/cachelib-0.16.1

Description

Collection of cache libraries in the same API interface. Extracted from

Added to portage

2026-08-22

cfg-update - 1.11.0
Ebuild name:

app-portage/cfg-update-1.11.0

Description

Easy to use GUI & CLI alternative for etc-update

Added to portage

2026-08-22

cgreen - 1.7.0
Ebuild name:

dev-libs/cgreen-1.7.0

Description

Unit test and mocking framework for C and C++

Added to portage

2026-08-22

charm - 6.10.2
Ebuild name:

sys-cluster/charm-6.10.2

Description

Message-passing parallel language and runtime system

Added to portage

2026-08-22

cjose - 0.6.2.8
Ebuild name:

dev-libs/cjose-0.6.2.8

Description

C library implementing the Javascript Object Signing and Encryption (JOSE)

Added to portage

2026-08-22

confuse - 3.4
Ebuild name:

dev-libs/confuse-3.4

Description

a configuration file parser library

Added to portage

2026-08-22

cramjam - 2.12.0
Ebuild name:

dev-python/cramjam-2.12.0

Description

Thin Python bindings to de/compression algorithms in Rust

Added to portage

2026-08-22

cython - 3.3.0
Ebuild name:

dev-python/cython-3.3.0

Description

A Python to C compiler

Added to portage

2026-08-22

dbutils - 3.2.0
Ebuild name:

dev-python/dbutils-3.2.0

Description

Database connections for multi-threaded environments

Added to portage

2026-08-22

dealii - 9.8.0
Ebuild name:

sci-libs/dealii-9.8.0

Description

Solving partial differential equations with the finite element method

Added to portage

2026-08-22

dependency-groups - 1.3.2
Ebuild name:

dev-python/dependency-groups-1.3.2

Description

A tool for resolving PEP 735 Dependency Group data

Added to portage

2026-08-22

faker - 40.37.0
Ebuild name:

dev-python/faker-40.37.0

Description

A Python package that generates fake data for you

Added to portage

2026-08-22

fwupd - 2.1.7
Ebuild name:

sys-apps/fwupd-2.1.7

Description

Aims to make updating firmware on Linux automatic, safe and reliable

Added to portage

2026-08-22

libcap-ng - 0.9.5-r1
Ebuild name:

sys-libs/libcap-ng-0.9.5-r1

Description

POSIX 1003.1e capabilities

Added to portage

2026-08-22

libplatform - 2.2.0
Ebuild name:

dev-libs/libplatform-2.2.0

Description

Platform support library used by libCEC and binary add-ons for Kodi

Added to portage

2026-08-22

libsecret - 0.21.7
Ebuild name:

app-crypt/libsecret-0.21.7

Description

GObject library for accessing the freedesktop.org Secret Service API

Added to portage

2026-08-22

libsecret - 0.21.7-r1
Ebuild name:

app-crypt/libsecret-0.21.7-r1

Description

GObject library for accessing the freedesktop.org Secret Service API

Added to portage

2026-08-22

libxmlb - 0.3.29
Ebuild name:

dev-libs/libxmlb-0.3.29

Description

Library to help create and query binary XML blobs

Added to portage

2026-08-22

mac - 13.26
Ebuild name:

media-sound/mac-13.26

Description

Monkey's Audio Codecs

Added to portage

2026-08-22

mesa - 26.2.1
Ebuild name:

media-libs/mesa-26.2.1

Description

OpenGL-like graphic library for Linux

Added to portage

2026-08-22

mesa_clc - 26.2.1
Ebuild name:

dev-util/mesa_clc-26.2.1

Description

mesa_clc tool used for building OpenCL C to SPIR-V

Added to portage

2026-08-22

nanobind - 3.0.0
Ebuild name:

dev-python/nanobind-3.0.0

Description

Tiny and efficient C++/Python bindings

Added to portage

2026-08-22

ncspot - 1.4.0
Ebuild name:

media-sound/ncspot-1.4.0

Description

ncurses Spotify client written in Rust using librespot

Added to portage

2026-08-22

nss - 3.127
Ebuild name:

dev-libs/nss-3.127

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-08-22

openpgp-keys-zsh - 2026.07.12
Ebuild name:

sec-keys/openpgp-keys-zsh-2026.07.12

Description

PGP keys used to sign ZSH releases

Added to portage

2026-08-22

portage - 3.0.82
Ebuild name:

sys-apps/portage-3.0.82

Description

The package management and distribution system for Gentoo

Added to portage

2026-08-22

portalocker - 4.2.0
Ebuild name:

dev-python/portalocker-4.2.0

Description

A library for Python file locking

Added to portage

2026-08-22

powercap-utils - 0.6.0
Ebuild name:

sys-power/powercap-utils-0.6.0

Description

C bindings to the Linux Power Capping Framework in sysfs

Added to portage

2026-08-22

rss2email - 3.14-r4
Ebuild name:

net-mail/rss2email-3.14-r4

Description

A python script that converts RSS/Atom newsfeeds to email

Added to portage

2026-08-22

sabctools - 9.7.0
Ebuild name:

dev-python/sabctools-9.7.0

Description

Module providing raw yEnc encoding/decoding for SABnzbd

Added to portage

2026-08-22

scipy - 1.18.1
Ebuild name:

dev-python/scipy-1.18.1

Description

Scientific algorithms library for Python

Added to portage

2026-08-22

shadowsocks-libev - 3.3.6
Ebuild name:

net-proxy/shadowsocks-libev-3.3.6

Description

A lightweight secured SOCKS5 proxy for embedded devices and low e

Added to portage

2026-08-22

sphinx-argparse - 0.6.1
Ebuild name:

dev-python/sphinx-argparse-0.6.1

Description

Sphinx extension that automatically documents argparse commands an

Added to portage

2026-08-22

spidermonkey - 140.14.0
Ebuild name:

dev-lang/spidermonkey-140.14.0

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-08-22

spidermonkey - 153.1.0
Ebuild name:

dev-lang/spidermonkey-153.1.0

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-08-22

spirv-llvm-translator - 24.0.0_pre20260820
Ebuild name:

dev-util/spirv-llvm-translator-24.0.0_pre20260820

Description

Bi-directional translator between SPIR-V and LLVM

Added to portage

2026-08-22

symbols-nerd-font - 3.5.1
Ebuild name:

media-fonts/symbols-nerd-font-3.5.1

Description

Symbols-only font containing the Nerd Font icons

Added to portage

2026-08-22

tree-sitter-cmake - 0.7.4
Ebuild name:

dev-libs/tree-sitter-cmake-0.7.4

Description

CMake grammar for tree-sitter

Added to portage

2026-08-22

tree-sitter-ocaml - 0.25.0
Ebuild name:

dev-libs/tree-sitter-ocaml-0.25.0

Description

OCaml grammar for Tree-sitter

Added to portage

2026-08-22

tree-sitter-scala - 0.26.2
Ebuild name:

dev-libs/tree-sitter-scala-0.26.2

Description

Scala grammar for Tree-sitter

Added to portage

2026-08-22

wine-proton - 11.0.2
Ebuild name:

app-emulation/wine-proton-11.0.2

Description

Valve Software's fork of Wine

Added to portage

2026-08-22

wine-vanilla - 11.16
Ebuild name:

app-emulation/wine-vanilla-11.16

Description

Free implementation of Windows(tm) on Unix, without external patch

Added to portage

2026-08-22

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 57.2 ms