Compare commits

...

27 Commits

Author SHA1 Message Date
Chris Allegretta
170679294b GNU nano 2.3.99pre1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-06 15:20:04 +00:00
Chris Allegretta
4b3f2771b5 2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
        go which have tools to automatically lint and reformat the text for
        you (gofmt), which is lovely.  rcfile option formatter, function
        text.c:do_formatter() and some other calls.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5100 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-03 07:24:17 +00:00
Benno Schulenberg
a44def03a0 Adding Mark to the scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:27:56 +00:00
Benno Schulenberg
9f1b1e2b14 Removing the names of past translators from the Easter-egg scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5098 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:23:31 +00:00
Benno Schulenberg
e99f0b609b Gettextizing the "File being edited" prompt,
and improving its wording.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 21:58:27 +00:00
Benno Schulenberg
5bb10d25ef Colorizing the section headers %pretrans and %posttrans fully.
Original patch from Savannah patch #8573 by Daniel Vrátil.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5096 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-11-30 12:05:13 +00:00
Benno Schulenberg
edabd27cd8 Recognizing also header lines that use "/usr/bin/env" to call
the program, instead of just a direct call via "/bin/program".
Doing this for Shell scripts, and for Python, Perl and Ruby.
This fixes Savannah bug #43270 reported by Kitty.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-09-21 15:29:40 +00:00
Benno Schulenberg
97a5d1270a Replacing the old get_shortcut() wrapper with the new func_from_key().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5094 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 20:03:58 +00:00
Benno Schulenberg
f729c6dae5 Adding name of reporter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 19:22:15 +00:00
Benno Schulenberg
a3cc4e6ecd Improving some wordings and formatting in the texinfo document.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5092 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-10 16:27:30 +00:00
Benno Schulenberg
2a9536c4e8 Removing a mistaken doubled-up | which causes
an 'empty (sub)expression' error on MacOS X.
This fixes Savannah bug #42929.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5091 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-07 20:27:21 +00:00
Benno Schulenberg
1f960f7e34 Improving some of the wordings and formatting of the nanorc manpage.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5090 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:57:15 +00:00
Benno Schulenberg
3f4389b968 Tweaking the formatting of the man pages a bit
so that po4a will create a nicer POT file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5089 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:25:16 +00:00
Benno Schulenberg
700c43bd42 Standardizing the formatting of command-line options -- each one separately.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5088 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-02 20:47:35 +00:00
Benno Schulenberg
2ec70b6466 Separating short and long option by a customary comma
instead of putting the long one between parentheses.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5087 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-01 21:04:35 +00:00
Benno Schulenberg
cf9f32b009 Reordering a few things, and adjusting some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5086 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:49:32 +00:00
Benno Schulenberg
fcd4468f90 Adjusting some indentation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:44:19 +00:00
Benno Schulenberg
7239fda971 Using still further the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 21:07:15 +00:00
Benno Schulenberg
47dffa483f Using still more the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5083 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 20:16:28 +00:00
Benno Schulenberg
266e0496ab Using the more direct func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:32:03 +00:00
Benno Schulenberg
dbb5e7cd8e Moving first_sc_for() next to its sister function too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5081 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:23:41 +00:00
Benno Schulenberg
80750632d0 Moving strtokeytype() next to its sister function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5080 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:18:00 +00:00
Benno Schulenberg
d23283e249 Removing the now unused and unneeded addition ability to the shortcut list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5079 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:13:46 +00:00
Jordi Mallach
7ffc7b0438 * doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5078 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-24 16:11:20 +00:00
Benno Schulenberg
1a8c90eec7 Removing 'undo' from the valid options, so it gets coloured brightred.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5077 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-22 08:17:20 +00:00
Jordi Mallach
ea40ebb648 * doc/nanorc.sample.in: Remove ‘undo’ section which is now obsolete.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-21 21:27:15 +00:00
Chris Allegretta
1c8cdfd174 Add release to ChangeLog and back to svn version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 15:32:28 +00:00
58 changed files with 12108 additions and 10523 deletions

View File

@@ -1,3 +1,79 @@
GNU nano 2.3.99pre1 - 2015.01.06
2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
go which have tools to automatically lint and reformat the text for
you (gofmt), which is lovely. rcfile option formatter, function
text.c:do_formatter() and some other calls.
2014-12-28 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_lockfile): Gettextize the "File being edited"
prompt, and improve its wording.
* src/winio.c (do_credits): Remove the names of past translators
from the Easter-egg scroll.
* THANKS: Add a missing historical translator name.
* src/winio.c (do_credits): Add Mark to the scroll, for all his
undo work, colouring nano's interface, and other patches.
2014-11-30 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/spec.nanorc: Colorize %pretrans and %posttrans fully.
Original patch from Savannah patch #8573 by Daniel Vrátil.
2014-09-21 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header
lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing".
This fixes Savannah bug #43270 reported by Kitty.
2014-08-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_justify): Replace the old get_shortcut() wrapper
with the new func_from_key().
2014-08-10 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Improve some wordings and formatting.
2014-08-07 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/nanorc.nanorc: Remove a mistaken OR which causes a
'Bad regex, empty (sub)expression' error on some systems. This
fixes Savannah bug #42929 reported by Misty De Meo.
2014-08-03 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nano.1, doc/man/rnano.1: Tweak the formatting a bit so that
po4a will create a nicer POT file.
* doc/man/nanorc.5: Improve some of the wordings and formatting.
2014-08-02 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Standardize the formatting of command-line
options -- each one separately. Also add some more markup.
2014-08-01 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nano.1, doc/man/rnano.1: Separate short and long option
by a comma instead of putting the long one between parentheses.
And showing the required quotes around the argument of -Q.
2014-07-31 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_insertfile): Adjust some indentation.
* src/prompt.c (do_statusbar_input), src/browser.c (do_browser):
Reorder a few things, and adjust some whitespace.
2014-07-27 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (add_to_sclist): Remove the now unused and unneeded
addition ability from this builder function of the shortcut list.
* src/global.c (strtokeytype): Move this to a better place.
* src/global.c (first_sc_for): Move this too to a better place.
* src/prompt.c (do_yesno_prompt): Use the new and more direct
func_from_key() wrapper instead of get_shortcut().
* src/text.c (do_linter): Likewise.
* src/files.c (do_insertfile, do_writeout): Likewise.
2014-07-24 Jordi Mallach <jordi@gnu.org>
* doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
2014-07-22 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/nanorc.nanorc: Remove 'undo' from the valid options.
2014-07-21 Jordi Mallach <jordi@gnu.org>
* doc/nanorc.sample.in: Remove undo section which is now obsolete.
GNU nano 2.3.6 - 2014.07.17
2014-07-16 Jordi Mallach <jordi@gnu.org>
* doc/man/rnano.1: Additional printing formatting improvement from
Bjarni Ingi Gislason.

11
NEWS
View File

@@ -1,3 +1,14 @@
2015.01.06 - GNU nano 2.3.99pre1 "Junior" is released. As the first
2.4 release candidate there will be fewer new features
but many bugfixes going forward. This release contains
new support for language reformatters like go's gofmt
command which takes the place of the spelling checker.
Fixes in this release include many syntax highlighting
fixes and improvements, and documentation formatting updates.
As always please report bugs via the Savannah bug page for
nano (https://savannah.gnu.org/bugs/?group=nano), so we can
release a super awesome and bug-free 2.4.0 soon!
2014.07.17 - GNU nano 2.3.6 "Columbo" is released. This release
contains a fix for installing internationalization
files. Also included are scattered documentation

1
THANKS
View File

@@ -23,6 +23,7 @@ Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk translator
Florian König <floki@bigfoot.com> German translator
Wojciech Kotwica <wkotwica@post.pl> Polish translator
Clement Laforet <clem_laf@wanadoo.fr> French translator
Daniele Medri <madrid@linux.it> Italian translator
Gergely Nagy <algernon@debian.org> Hungarian translator
Kalle Olavi Niemitalo <kon@iki.fi> Finnish translator
A. Murat EREN <meren@comu.edu.tr> Turkish translator

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.3.6], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.3.99pre1], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE

View File

@@ -20,7 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 2.3.5" "June 2014"
.TH NANO 1 "version 2.3.7" "August 2014"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -30,7 +30,6 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
.SH SYNOPSIS
.B nano
.RI [ options "] [[+" line , column "]\ " file "]..."
.br
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -46,65 +45,65 @@ Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
(at least one of which must be specified) on startup, instead of the
default line 1, column 1.
.TP
.B \-A (\-\-smarthome)
.BR \-A ", " \-\-smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B \-B (\-\-backup)
.BR \-B ", " \-\-backup
When saving a file, back up the previous version of it to the current
filename suffixed with a tilde (\fB~\fP).
.TP
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
.TP
.B \-D (\-\-boldtext)
.BR \-D ", " \-\-boldtext
Use bold text instead of reverse video text.
.TP
.B \-E (\-\-tabstospaces)
.BR \-E ", " \-\-tabstospaces
Convert typed tabs to spaces.
.TP
.B \-F (\-\-multibuffer)
.BR \-F ", " \-\-multibuffer
Enable multiple file buffers (if support for them has been compiled in).
.TP
.B \-G (\-\-locking)
.BR \-G ", " \-\-locking
Enable vim-style file locking when editing files.
.TP
.B \-H (\-\-historylog)
.BR \-H ", " \-\-historylog
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
retrieved in later sessions.
.TP
.B \-I (\-\-ignorercfiles)
.BR \-I ", " \-\-ignorercfiles
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
.TP
.B \-K (\-\-rebindkeypad)
.BR \-K ", " \-\-rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B \-L (\-\-nonewlines)
.BR \-L ", " \-\-nonewlines
Don't add newlines to the ends of files.
.TP
.B \-N (\-\-noconvert)
.BR \-N ", " \-\-noconvert
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-O (\-\-morespace)
.BR \-O ", " \-\-morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B \-P (\-\-poslog)
.BR \-P ", " \-\-poslog
Log and later read back the location of the cursor and place it there
again.
.TP
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
Set the quoting string for justifying. The default is
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
Tab.
.TP
.B \-R (\-\-restricted)
.BR \-R ", " \-\-restricted
Restricted mode: don't read or write to any file not specified on the
command line; don't read any \fInanorc\fP files nor history files;
don't allow suspending nor spell checking;
@@ -113,80 +112,80 @@ different name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking \fBnano\fP
with any name beginning with 'r' (e.g. "rnano").
.TP
.B \-S (\-\-smooth)
.BR \-S ", " \-\-smooth
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
.TP
.B \-T \fInumber\fP (\-\-tabsize=\fInumber\fP)
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
Set the size (width) of a tab to \fInumber\fP columns. The value of
\fInumber\fP must be greater than 0. The default value is 8.
.TP
.B \-U (\-\-quickblank)
.BR \-U ", " \-\-quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that \fB\-c\fP overrides this.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.TP
.B \-W (\-\-wordbounds)
.BR \-W ", " \-\-wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
.TP
.B \-Y \fIname\fP (\-\-syntax=\fIname\fP)
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files.
.TP
.B \-c (\-\-const)
.BR \-c ", " \-\-const
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
.TP
.B \-d (\-\-rebinddelete)
.BR \-d ", " \-\-rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B \-h (\-\-help)
.BR \-h ", " \-\-help
Show a summary of the available command-line options and exit.
.TP
.B \-i (\-\-autoindent)
.BR \-i ", " \-\-autoindent
Indent new lines to the previous line's indentation. Useful when
editing source code.
.TP
.B \-k (\-\-cut)
.BR \-k ", " \-\-cut
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
.TP
.B \-l (\-\-nofollow)
.BR \-l ", " \-\-nofollow
If the file being edited is a symbolic link, replace the link with
a new file instead of following it. Good for editing files in
\fI/tmp\fP, perhaps?
.TP
.B \-m (\-\-mouse)
.BR \-m ", " \-\-mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B \-n (\-\-noread)
.BR \-n ", " \-\-noread
Treat any name given on the command line as a new file. This allows
\fBnano\fR to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file". This way
\fBnano\fR can be used as an editor in combination with for instance
\fBgpg\fR without having to write sensitive data to disk first.
.TP
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
Set the operating directory. This makes \fBnano\fP set up something
similar to a chroot.
.TP
.B \-p (\-\-preserve)
.BR \-p ", " \-\-preserve
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
.TP
.B \-q (\-\-quiet)
.BR \-q ", " \-\-quiet
Do not report errors in the \fInanorc\fP files nor ask them to be
acknowledged by pressing Enter at startup.
.TP
.B \-r \fInumber\fP (\-\-fill=\fInumber\fP)
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
will occur at the width of the screen less \fInumber\fP columns, allowing
the wrap point to vary along with the width of the screen if the screen
@@ -194,28 +193,28 @@ is resized. The default value is \-8. This option conflicts with
.B \-w
-- the last one given takes effect.
.TP
.B \-s \fIprogram\fP (\-\-speller=\fIprogram\fP)
Enable alternative spell checker command.
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
Use this alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
.BR \-t ", " \-\-tempfile
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
option.
.TP
.B \-v (\-\-view)
.BR \-v ", " \-\-view
View-file (read-only) mode.
.TP
.B \-w (\-\-nowrap)
.BR \-w ", " \-\-nowrap
Disable the hard-wrapping of long lines. This option conflicts with
.B \-r
-- the last one given takes effect.
.TP
.B \-x (\-\-nohelp)
.BR \-x ", " \-\-nohelp
Don't show the two help lines at the bottom of the screen.
.TP
.B \-z (\-\-suspend)
.BR \-z ", " \-\-suspend
Enable the suspend ability.
.TP
.B \-$ (\-\-softwrap)
.BR \-$ ", " \-\-softwrap
Enable 'soft wrapping'. This will make \fBnano\fP attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines. Since
@@ -223,7 +222,7 @@ continuing it over multiple screen lines. Since
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
separately (e.g.\& 'nano \-wS \-$').
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
Ignored, for compatibility with Pico.
.SH INITIALIZATION FILE
@@ -267,7 +266,7 @@ http://www.nano-editor.org/
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
Chris Allegretta <chrisa@asty.org>, et al (see the files \fIAUTHORS\fP and
\fITHANKS\fP for details). This manual page was originally written by
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
others).

View File

@@ -38,38 +38,42 @@ commands, which can be used to configure nano on startup without using
command-line options. Additionally, there are some commands to define
syntax highlighting and to rebind keys -- see the two separate sections
on those. \fBnano\fP reads one command per line.
.PP
Options in \fInanorc\fP files take precedence over nano's defaults, and
command-line options override \fInanorc\fP settings. Also, options are
unset by default, except for those that take arguments.
Quotes inside string parameters don't have to be escaped with
command-line options override \fInanorc\fP settings. Also, options that
do not take an argument are unset by default. So using the \fBunset\fR
command is only needed when wanting to override a setting of the system's
\fInanorc\fR file in your own \fB~/.nanorc\fR. Options that take an
argument cannot be unset.
.PP
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
Quotes inside these string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
.PP
The supported commands and arguments are:
.TP 3
.B set/unset allow_insecure_backup
.B set allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions
can't be (re)set due to special OS considerations. You should
NOT enable this option unless you are sure you need it.
.TP
.B set/unset autoindent
.B set autoindent
Use auto-indentation.
.TP
.B set/unset backup
.B set backup
Create backup files by adding a tilde (\fB~\fP) to each file's name.
.TP
.B set backupdir "\fIdirectory\fP"
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
.TP
.B set/unset backwards
.B set backwards
Do backwards searches by default.
.TP
.B set/unset boldtext
.B set boldtext
Use bold instead of reverse video for the titlebar, statusbar, key combos,
and selected text. This can be overridden for the first three by setting
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
@@ -80,26 +84,26 @@ paragraphs. This may not include blank characters. Only closing
punctuation (see \fBpunct\fP), optionally followed by the specified
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
.TP
.B set/unset casesensitive
.B set casesensitive
Do case-sensitive searches by default.
.TP
.B set/unset const
.B set const
Constantly display the cursor position in the status bar.
.TP
.B set/unset cut
.B set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
.TP
.B set fill \fIn\fP
Hard-wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
maximum line length will be the screen width less \fIn\fP columns. The
default value is \-8.
.B set fill \fInumber\fR
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
the maximum line length will be the screen width less \fInumber\fP columns.
The default value is \fB\-8\fR.
.TP
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset historylog
.B set historylog
Enable the use of \fB~/.nano/search_history\fP for saving and reading
search/replace strings.
.TP
@@ -108,7 +112,7 @@ Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset locking
.B set locking
Enable vim-style lock-files for when editing files.
.TP
.B set matchbrackets "\fIstring\fP"
@@ -117,32 +121,32 @@ searches. This may not include blank characters. The opening set must
come before the closing set, and the two sets must be in the same order.
The default value is "\fB(<[{)>]}\fP".
.TP
.B set/unset morespace
.B set morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B set/unset mouse
.B set mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B set/unset multibuffer
.B set multibuffer
Allow inserting files into their own buffers.
.TP
.B set/unset noconvert
.B set noconvert
Don't convert files from DOS/Mac format.
.TP
.B set/unset nofollow
.B set nofollow
Don't follow symlinks when writing files.
.TP
.B set/unset nohelp
.B set nohelp
Don't display the two help lines at the bottom of the screen.
.TP
.B set/unset nonewlines
.B set nonewlines
Don't automatically add a newline to the ends of files.
.TP
.B set/unset nowrap
.B set nowrap
Don't hard-wrap text at all.
.TP
.B set operatingdir "\fIdirectory\fP"
@@ -151,10 +155,10 @@ subdirectories. Also, the current directory is changed to here, so
files are inserted from this directory. By default, the operating
directory feature is turned off.
.TP
.B set/unset poslog
.B set poslog
Save the cursor position of files between editing sessions.
.TP
.B set/unset preserve
.B set preserve
Preserve the XON and XOFF keys (^Q and ^S).
.TP
.B set punct "\fIstring\fP"
@@ -163,11 +167,11 @@ paragraphs. This may not include blank characters. Only the
specfified closing punctuation, optionally followed by closing brackets
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
.TP
.B set/unset quickblank
.B set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
.TP
.B set/unset quiet
.B set quiet
\fBnano\fP will not report errors in the \fInanorc\fP file nor ask them
to be acknowledged by pressing Enter at startup. If this is used, it
should be placed at the top of the file to be fully effective.
@@ -180,30 +184,30 @@ otherwise a literal string. The default value is
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
Tab character.
.TP
.B set/unset rebinddelete
.B set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B set/unset rebindkeypad
.B set rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B set/unset regexp
.B set regexp
Do extended regular expression searches by default.
.TP
.B set/unset smarthome
.B set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B set/unset smooth
.B set smooth
Use smooth scrolling by default.
.TP
.B set/unset softwrap
.B set softwrap
Enable soft line wrapping for easier viewing of very long lines.
.TP
.B set speller "\fIspellprog\fP"
@@ -214,17 +218,17 @@ calls \fIspell\fP.
Specify the color combination to use for the statusbar.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset suspend
.B set suspend
Allow \fBnano\fP to be suspended.
.TP
.B set tabsize \fIn\fP
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
than 0. The default value is 8.
.B set tabsize \fInumber\fR
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
greater than 0. The default value is \fB8\fR.
.TP
.B set/unset tabstospaces
.B set tabstospaces
Convert typed tabs to spaces.
.TP
.B set/unset tempfile
.B set tempfile
Save automatically on exit, don't prompt.
.TP
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
@@ -233,14 +237,14 @@ Valid color names for foreground and background are:
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP
.B set/unset view
.B set view
Disallow file modification.
.TP
.B set whitespace "\fIstring\fP"
Set the two characters used to indicate the presence of tabs and
spaces. They must be single-column characters.
.TP
.B set/unset wordbounds
.B set wordbounds
Detect word boundaries more accurately by treating punctuation
characters as parts of words.
@@ -266,6 +270,11 @@ For the currently defined syntax, use the given \fIprogram\fR
to invoke the linter (this overrides the speller function when
defined).
.TP
.BI formatter " program " \fR[ "arg " \fR...]
For the currently defined syntax, use the given \fIprogram\fR
to automatically re-format text, useful in certain programming
languages (e.g. go)
.TP
.BR header " [""\fIregex\fR"" ...]
For the currently defined syntax, add one or more regexes which will
be compared against the very first line of the file to be edited,
@@ -464,7 +473,7 @@ Goes to the last line of the file.
Goes to a specific line (and column if specified).
.TP
.B gototext
Switches from targetting a line number to searching for text.
Switches from targeting a line number to searching for text.
.TP
.B findbracket
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches

View File

@@ -1,7 +1,7 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
.\" Skeleton based on nano-tiny.1:
.\" Copyright (C) 2002 Free Software Foundation, Inc.
.\" $Id$
.\"
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 Free Software Foundation, Inc.
.\"
.\" This document is dual-licensed. You may distribute and/or modify it
.\" under the terms of either of the following licenses:
@@ -19,8 +19,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH RNANO 1 "version 2.3.3" "April 2014"
.TH RNANO 1 "version 2.3.7" "August 2014"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -30,7 +29,6 @@ Pico clone
.SH SYNOPSIS
.B rnano
.RI [ options "] [[+" line , column "]\ " file "]..."
.br
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -58,14 +56,13 @@ use backup files or spell checking.
.SH OPTIONS
.TP
.B \-h (\-\-help)
Show a summary of command line options and exit.
.BR \-h ", " \-\-help
Show a summary of command-line options and exit.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.PP
See the \fBnano\fP(1) manpage for the complete documentation of
\fBnano\fP.
See the \fBnano\fP(1) manpage for all of the possible options.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
@@ -79,7 +76,7 @@ of "subscribe".
http://www.nano-editor.org/
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
Chris Allegretta <chrisa@asty.org>, et al (see the file AUTHORS for details).
This manual page was originally written by Thijs Kinkhorst
<thijs@kinkhorst.com>, for the Debian system (but may be used by
others).

View File

@@ -165,10 +165,6 @@
## Save automatically on exit; don't prompt.
# set tempfile
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
## cuts.
# set undo
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view

View File

@@ -40,3 +40,6 @@ color brightblue start="/\*" end="\*/"
# Trailing whitespace.
color ,green "[[:space:]]+$"
# Set up the formatter since spelling is probably useless...
formatter gofmt -w

View File

@@ -6,12 +6,12 @@ syntax "nanorc" "\.?nanorc$"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|undo|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor||statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter)[[:space:]]+.*$"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|extendsyntax)\>"
# Colors

View File

@@ -1,7 +1,7 @@
## Here is an example for Perl.
syntax "perl" "\.p[lm]$"
header "^#!.*/perl[-0-9._]*"
header "^#!.*perl[-0-9._]*"
magic "Perl script text"
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(dir)?)\>" "\<(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|study|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)\>"

View File

@@ -1,7 +1,7 @@
## Here is an example for Python.
syntax "python" "\.py$"
header "^#!.*/python[-0-9._]*"
header "^#!.*python[-0-9._]*"
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"

View File

@@ -1,7 +1,7 @@
## Here is an example for Ruby.
syntax "ruby" "\.rb$"
header "^#!.*/ruby[-0-9._]*"
header "^#!.*ruby[-0-9._]*"
# Asciibetical list of reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"

View File

@@ -1,7 +1,7 @@
## Here is an example for Bourne shell scripts.
syntax "sh" "\.sh$"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
header "^#!.*(ba|k|pdk)?sh[-0-9_]*"
magic "(POSIX|Bourne.*) shell script text"
icolor brightgreen "^[0-9A-Z_]+\(\)"

View File

@@ -24,8 +24,8 @@ color yellow start="%__" end="\ "
color magenta start="%\{" end="\}"
color yellow start="%\{__" end="\}"
# Sections.
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)"
color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|verifyscript)"
# Conditionals and defines.
color brightred "%(if|else|endif|define|global|undefine)"

View File

@@ -7,9 +7,9 @@
@c This file has the new style title page commands.
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook
@set EDITION 0.2
@set VERSION 2.3.5
@set UPDATED June 2014
@set EDITION 0.3
@set VERSION 2.3.7
@set UPDATED August 2014
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 2.3.5
@subtitle version 2.3.7
@author Chris Allegretta
@page
@@ -119,187 +119,226 @@ Email bug reports to @email{nano@@nano-editor.org}.
@node Command Line Options
@section Command Line Options
@code{nano} takes the following options from the command line:
@command{nano} takes the following options from the command line:
@table @code
@item +<line>,<column>
Start at line number <line> and column number <column> (at least one of
@table @option
@item +@var{line},@var{column}
Start at line number @var{line} and column number @var{column} (at least one of
which must be specified) instead of the default of line 1, column 1.
@item -A, --smarthome
@item -A
@itemx --smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
@item -B, --backup
@item -B
@itemx --backup
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
filename suffixed with a @samp{~}.
@item -C <dir>, --backupdir=<dir>
Set the directory where @code{nano} puts unique backup files if file
@item -C @var{directory}
@itemx --backupdir=@var{directory}
Set the directory where @command{nano} puts unique backup files if file
backups are enabled.
@item -D, --boldtext
@item -D
@itemx --boldtext
Use bold text instead of reverse video text.
@item -E, --tabstospaces
@item -E
@itemx --tabstospaces
Convert typed tabs to spaces.
@item -F, --multibuffer
@item -F
@itemx --multibuffer
Enable multiple file buffers (if support for them has been compiled in).
@item -G, --locking
@item -G
@itemx --locking
Enable vim-style file locking when editing files.
@item -H, --historylog
Log search and replace strings to ~/.nano/search_history, so they can be
retrieved in later sessions.
@item -H
@itemx --historylog
Log search and replace strings to @file{~/.nano/search_history},
so they can be retrieved in later sessions.
@item -I, --ignorercfiles
Don't look at the system's nanorc file nor at the user's ~/.nanorc.
@item -I
@itemx --ignorercfiles
Don't look at the system's nanorc file nor at the user's @file{~/.nanorc}.
@item -K, --rebindkeypad
@item -K
@itemx --rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item -L, --nonewlines
@item -L
@itemx --nonewlines
Don't add newlines to the ends of files.
@item -N, --noconvert
@item -N
@itemx --noconvert
Disable automatic conversion of files from DOS/Mac format.
@item -O, --morespace
@item -O
@itemx --morespace
Use the blank line below the titlebar as extra editing space.
@item -P, --poslog
@item -P
@itemx --poslog
Log for each file the last location of the cursor, and read it
back upon reopening the file and place it there again.
@item -Q <str>, --quotestr=<str>
@item -Q "@var{characters}"
@itemx --quotestr="@var{characters}"
Set the quoting string for justifying. The default value is
@quotation
@code{^([ \t]*[|>:@}#])+}
"^([ \t]*[|>:@}#])+"
@end quotation
if extended regular expression support is available, or "> " otherwise.
if extended regular expression support is available, or @code{> } otherwise.
Note that @code{\t} above stands for a literal Tab character.
@item -R, --restricted
@item -R
@itemx --restricted
Restricted mode: don't read or write to any file not specified on the
command line; don't read any nanorc files nor history files; don't allow
suspending nor spell checking; don't
allow a file to be appended to, prepended to, or saved under a different
name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking @code{nano} with
any name beginning with 'r' (e.g. "rnano").
This restricted mode is also accessible by invoking @command{nano} with
any name beginning with @samp{r} (e.g. @command{rnano}).
@item -S, --smooth
@item -S
@itemx --smooth
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
@item -T <number>, --tabsize=<number>
Set the displayed tab length to <number> columns. The value of <number>
must be greater than 0. The default value is 8.
@item -T @var{number}
@itemx --tabsize=@var{number}
Set the displayed tab length to @var{number} columns. The value of
@var{number} must be greater than 0. The default value is @samp{8}.
@item -U, --quickblank
@item -U
@itemx --quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that -c overrides this.
keystroke instead of 25. Note that @option{-c} overrides this.
@item -V, --version
@item -V
@itemx --version
Show the current version number and exit.
@item -W, --wordbounds
@item -W
@itemx --wordbounds
Detect word boundaries more accurately by treating punctuation
characters as parts of words.
@item -Y <name>, --syntax=<name>
@item -Y @var{name}
@itemx --syntax=@var{name}
Specify a specific syntax from the nanorc files to use for highlighting.
See @xref{Syntax Highlighting}, for more info.
@item -c, --const
@item -c
@itemx --const
Constantly display the cursor position and line number on the statusbar.
Note that this overrides -U.
Note that this overrides @option{-U}.
@item -d, --rebinddelete
@item -d
@itemx --rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
@item -h, --help
@item -h
@itemx --help
Show a summary of command-line options and exit.
@item -i, --autoindent
@item -i
@itemx --autoindent
Automatically indent new lines to the same number of spaces and tabs as
the previous line.
@item -k, --cut
@item -k
@itemx --cut
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
@item -l, --nofollow
@item -l
@itemx --nofollow
When writing files, if the given file is a symbolic link, it is removed
and a new file is created.
@item -m, --mouse
@item -m
@itemx --mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
@item -n, --noread
@item -n
@itemx --noread
Treat any name given on the command line as a new file. This allows
@code{nano} to write to named pipes: it will start with a blank buffer,
@command{nano} to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file". This way
@code{nano} can be used as an editor in combination with for instance
@code{gpg} without having to write sensitive data to disk first.
@command{nano} can be used as an editor in combination with for instance
@command{gpg} without having to write sensitive data to disk first.
@item -o <dir>, --operatingdir=<dir>
Set operating directory. Makes @code{nano} set up something similar to
a chroot.
@item -o @var{directory}
@itemx --operatingdir=@var{directory}
Set the operating directory. This makes @command{nano} set up something
similar to a chroot.
@item -p, --preserve
@item -p
@itemx --preserve
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
editor can be stopped and started.
@item -q, --quiet
@item -q
@itemx --quiet
Do not report errors in the nanorc file nor ask them to be acknowledged
by pressing Enter at startup.
@item -r <number>, --fill=<number>
Hard-wrap lines at column <number> (by inserting a newline character).
@item -r @var{number}
@itemx --fill=@var{number}
Hard-wrap lines at column @var{number} (by inserting a newline character).
If the given value is 0 or less, wrapping will occur at the width of
the screen minus the given amount, allowing the wrapping width to
vary along with the width of the screen if and when it is resized.
The default value is -8. This option conflicts with -w -- the last
one given takes effect.
The default value is @samp{-8}. This option conflicts with @option{-w}
-- the last one given takes effect.
@item -s <program>, --speller=<program>
Invoke the given program as the spell checker. By default, @code{nano}
uses the command specified in the SPELL environment variable, or, if
SPELL is not set, its own interactive spell checker that requires the
@code{spell} program to be installed on your system.
@item -s @var{program}
@itemx --speller=@var{program}
Invoke the given program as the spell checker. By default, @command{nano}
uses the command specified in the @env{SPELL} environment variable, or,
if @env{SPELL} is not set, its own interactive spell checker that requires
the @command{spell} program to be installed on your system.
@item -t, --tempfile
@item -t
@itemx --tempfile
Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @code{nano} as the
exiting, assume yes. This is most useful when using @command{nano} as the
composer of a mailer program.
@item -v, --view
@item -v
@itemx --view
Don't allow the contents of the file to be altered. Note that this
option should NOT be used in place of correct file permissions to
implement a read-only file.
@item -w, --nowrap
@item -w
@itemx --nowrap
Don't hard-wrap long lines at any length. This option conflicts with
-r -- the last one given takes effect.
@option{-r} -- the last one given takes effect.
@anchor{Expert Mode}
@item -x, --nohelp
@item -x
@itemx --nohelp
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
This affects the location of the statusbar as well, as in Expert Mode it
is located at the very bottom of the editor.
@@ -307,19 +346,26 @@ is located at the very bottom of the editor.
Note: When accessing the help system, Expert Mode is temporarily
disabled to display the help-system navigation keys.
@item -z, --suspend
Enable the ability to suspend @code{nano} using the system's suspend
@item -z
@itemx --suspend
Enable the ability to suspend @command{nano} using the system's suspend
keystroke (usually ^Z).
@item -$, --softwrap
Enable 'soft wrapping'. This will make @code{nano} attempt to display the
@item -$
@itemx --softwrap
Enable 'soft wrapping'. This will make @command{nano} attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines. Since
'$' normally refers to a variable in the Unix shell, you should specify
@samp{$} normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. @code{nano -wS$}) or pass it
separately (e.g. @code{nano -wS -$}).
@item -a, -b, -e, -f, -g, -j
@item -a
@itemx -b
@itemx -e
@itemx -f
@itemx -g
@itemx -j
Ignored, for compatibility with Pico.
@end table
@@ -532,8 +578,11 @@ and to rebind keys -- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
@code{nano} will read one command per line.
Options in nanorc files take precedence over @code{nano}'s defaults, and
command-line options override nanorc settings. Options are also unset
by default, except for those that take arguments.
command-line options override nanorc settings. Also, options that do not
take an argument are unset by default. So using the @code{unset} command
is only needed when wanting to override a setting of the system's nanorc
file in your own @file{~/.nanorc}. Options that take an argument cannot
be unset.
Quotes inside string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
@@ -553,15 +602,15 @@ The supported settings in a nanorc file are:
@table @code
@item set/unset allow_insecure_backup
@item set allow_insecure_backup
When backing up files, allow the backup to succeed even if its
permissions can't be (re)set due to special OS considerations.
You should NOT enable this option unless you are sure you need it.
@item set/unset autoindent
@item set autoindent
Use auto-indentation.
@item set/unset backup
@item set backup
When saving a file, back up the previous version of it to the current
filename suffixed with a tilde (@code{~}).
@@ -569,88 +618,88 @@ filename suffixed with a tilde (@code{~}).
Set the directory where @code{nano} puts unique backup files, if file
backups are enabled.
@item set/unset backwards
@item set backwards
Do backwards searches by default.
@item set/unset boldtext
@item set boldtext
Use bold instead of reverse video for the titlebar, statusbar, key combos,
and selected text. This can be overridden for the first three by setting
the options "titlecolor", "statuscolor", and "keycolor".
@item set brackets "string"
@item set brackets "@var{string}"
Set the characters treated as closing brackets when justifying
paragraphs. This may not include blank characters. Only closing
punctuation (see "punct"), optionally followed by the specified
closing brackets, can end sentences. The default value is
@quotation
@code{""')>]@}"}
""')>]@}"
@end quotation
@item set/unset casesensitive
@item set casesensitive
Do case-sensitive searches by default.
@item set/unset const
@item set const
Constantly display the cursor position in the status bar.
@item set/unset cut
@item set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
@item set fill "n"
Hard-wrap lines at column number "n". If "n" is 0 or less, the maximum line
length will be the screen width less "n" columns. The default value is
-8.
@item set fill @var{number}
Hard-wrap lines at column number @var{number}. If @var{number} is 0 or less,
the maximum line length will be the screen width less @var{number} columns.
The default value is -8.
@item set functioncolor fgcolor,bgcolor
@item set functioncolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset historylog
Enable the use of ~/.nano/search_history for saving and reading
@item set historylog
Enable the use of @file{~/.nano/search_history} for saving and reading
search/replace strings.
@item set keycolor fgcolor,bgcolor
@item set keycolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset locking
@item set locking
Enable vim-style lock-files for when editing files.
@item set matchbrackets "string"
@item set matchbrackets "@var{string}"
Set the opening and closing brackets that can be found by bracket
searches. This may not include blank characters. The opening set must
come before the closing set, and the two sets must be in the same order.
The default value is
@quotation
@code{"(<[@{)>]@}"}
"(<[@{)>]@}"
@end quotation
@item set/unset morespace
@item set morespace
Use the blank line below the titlebar as extra editing space.
@item set/unset mouse
@item set mouse
Enable mouse support, so that mouse clicks can be used to place the
cursor, set the mark (with a double click), or execute shortcuts.
@item set/unset multibuffer
@item set multibuffer
Allow inserting files into their own buffers.
@item set/unset noconvert
@item set noconvert
Don't convert files from DOS/Mac format.
@item set/unset nofollow
@item set nofollow
Don't follow symlinks when writing files.
@item set/unset nohelp
@item set nohelp
Don't display the help lists at the bottom of the screen.
@item set/unset nonewlines
@item set nonewlines
Don't add newlines to the ends of files.
@item set/unset nowrap
@item set nowrap
Don't hard-wrap text at all.
@item set operatingdir "directory"
@@ -659,102 +708,102 @@ subdirectories. Also, the current directory is changed to here, so
files are inserted from this directory. By default, the operating
directory feature is turned off.
@item set/unset poslog
@item set poslog
Save the cursor position of files between editing sessions.
@item set/unset preserve
@item set preserve
Preserve the XON and XOFF keys (^Q and ^S).
@item set punct "string"
@item set punct "@var{string}"
Set the characters treated as closing punctuation when justifying
paragraphs. This may not include blank characters. Only the
specified closing punctuation, optionally followed by closing brackets
(see "brackets"), can end sentences. The default value is @code{"!.?"}.
(see "brackets"), can end sentences. The default value is "!.?".
@item set/unset quickblank
@item set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
@item set/unset quiet
@item set quiet
When set, @code{nano} will not report errors in the nanorc file nor ask them
to be acknowledged by pressing Enter at startup. If this option is used, it
should be placed at the top of the file to be fully effective.
@item set quotestr "string"
@item set quotestr "@var{string}"
The email-quote string, used to justify email-quoted paragraphs. This
is an extended regular expression if your system supports them,
otherwise a literal string. The default value is
@quotation
@code{"^([ \\t]*[#:>\\|@}])+"}
"^([ \\t]*[#:>\\|@}])+"
@end quotation
if you have extended regular expression support, and "> " otherwise.
Note that '\\t' stands for a literal Tab character.
@item set/unset rebinddelete
@item set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
@item set/unset rebindkeypad
@item set rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item set/unset regexp
@item set regexp
Do extended regular expression searches by default.
@item set/unset smarthome
@item set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
@item set/unset smooth
@item set smooth
Use smooth scrolling by default.
@item set/unset softwrap
@item set softwrap
Enable soft line wrapping for easier viewing of very long lines.
@item set speller "spellprog"
Use spelling checker "spellprog" instead of the built-in one, which
calls "spell".
@item set statuscolor fgcolor,bgcolor
@item set statuscolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the statusbar.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset suspend
@item set suspend
Allow @code{nano} to be suspended.
@item set tabsize "n"
Use a tab size of "n" columns. The value of "n" must be greater than 0.
The default value is 8.
@item set tabsize @var{number}
Use a tab size of @var{number} columns. The value of @var{number} must be
greater than 0. The default value is 8.
@item set/unset tabstospaces
@item set tabstospaces
Convert typed tabs to spaces.
@item set/unset tempfile
@item set tempfile
Save automatically on exit, don't prompt.
@item set titlecolor fgcolor,bgcolor
@item set titlecolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the titlebar.
Valid color names for foreground and background are:
white, black, red, blue, green, yellow, magenta, and cyan.
And either "fgcolor" or ",bgcolor" may be left out.
And either @var{fgcolor} or @var{,bgcolor} may be left out.
@item set/unset view
@item set view
Disallow file modification.
@anchor{Whitespace}
@item set whitespace "string"
@item set whitespace "@var{string}"
Set the two characters used to indicate the presence of tabs and
spaces. They must be single-column characters. The default pair
for a UTF-8 locale is "»·", and for other locales ">.".
@item set/unset wordbounds
@item set wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
@@ -989,7 +1038,7 @@ Goes to the last line of the file.
Goes to a specific line (and column if specified).
@item gototext
Switches from targetting a line number to searching for text.
Switches from targeting a line number to searching for text.
@item findbracket
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches

584
po/bg.po

File diff suppressed because it is too large Load Diff

831
po/ca.po

File diff suppressed because it is too large Load Diff

887
po/cs.po

File diff suppressed because it is too large Load Diff

585
po/da.po

File diff suppressed because it is too large Load Diff

587
po/de.po

File diff suppressed because it is too large Load Diff

586
po/eo.po

File diff suppressed because it is too large Load Diff

588
po/es.po

File diff suppressed because it is too large Load Diff

584
po/eu.po

File diff suppressed because it is too large Load Diff

620
po/fi.po

File diff suppressed because it is too large Load Diff

598
po/fr.po

File diff suppressed because it is too large Load Diff

584
po/ga.po

File diff suppressed because it is too large Load Diff

585
po/gl.po

File diff suppressed because it is too large Load Diff

584
po/hu.po

File diff suppressed because it is too large Load Diff

585
po/id.po

File diff suppressed because it is too large Load Diff

586
po/it.po

File diff suppressed because it is too large Load Diff

583
po/ja.po

File diff suppressed because it is too large Load Diff

584
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

761
po/nb.po

File diff suppressed because it is too large Load Diff

586
po/nl.po

File diff suppressed because it is too large Load Diff

584
po/nn.po

File diff suppressed because it is too large Load Diff

842
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

585
po/ro.po

File diff suppressed because it is too large Load Diff

586
po/ru.po

File diff suppressed because it is too large Load Diff

584
po/sl.po

File diff suppressed because it is too large Load Diff

623
po/sr.po

File diff suppressed because it is too large Load Diff

1727
po/sv.po

File diff suppressed because it is too large Load Diff

585
po/tr.po

File diff suppressed because it is too large Load Diff

586
po/uk.po

File diff suppressed because it is too large Load Diff

586
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -268,12 +268,12 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_up_void) {
if (selected >= width)
selected -= width;
} else if (func == do_left) {
if (selected > 0)
selected--;
} else if (func == do_down_void) {
if (selected + width <= filelist_len - 1)
selected += width;
} else if (func == do_left) {
if (selected > 0)
selected--;
} else if (func == do_right) {
if (selected < filelist_len - 1)
selected++;
@@ -581,8 +581,7 @@ void browser_refresh(void)
/* The maximum length of the file information in
* columns: seven for "--", "(dir)", or the file size,
* and 12 for "(parent dir)". */
bool dots = (COLS >= 15 && filetaillen >= longest -
foomaxlen - 1);
bool dots = (COLS >= 15 && filetaillen >= longest - foomaxlen - 1);
/* Do we put an ellipsis before the filename? Don't set
* this to TRUE if we have fewer than 15 columns (i.e.
* one column for padding, plus seven columns for a

View File

@@ -288,7 +288,7 @@ int do_lockfile(const char *filename)
fprintf(stderr, "user which created this lock file should be %s\n",
lockuser);
#endif
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
sprintf(promptstr, _("File is being edited (by %s, PID %d, user %s); continue?"),
lockprog, lockpid, lockuser);
ans = do_yesno_prompt(FALSE, promptstr);
if (ans < 1) {
@@ -1026,7 +1026,6 @@ void do_insertfile(
size_t current_x_save = openfile->current_x;
ssize_t current_y_save = openfile->current_y;
bool edittop_inside = FALSE;
const sc *s;
#ifndef NANO_TINY
bool right_side_up = FALSE, single_line = FALSE;
#endif
@@ -1084,14 +1083,13 @@ void do_insertfile(
break;
} else {
size_t pww_save = openfile->placewewant;
functionptrtype func = func_from_key(&i);
ans = mallocstrcpy(ans, answer);
s = get_shortcut(&i);
#ifndef NANO_TINY
#ifndef DISABLE_MULTIBUFFER
if (s && s->scfunc == new_buffer_void) {
if (func == new_buffer_void) {
/* Don't allow toggling if we're in view mode. */
if (!ISSET(VIEW_MODE))
TOGGLE(MULTIBUFFER);
@@ -1100,14 +1098,14 @@ void do_insertfile(
continue;
}
#endif
if (s && s->scfunc == flip_execute_void) {
if (func == flip_execute_void) {
execute = !execute;
continue;
}
#endif /* !NANO_TINY */
#ifndef DISABLE_BROWSER
if (s && s->scfunc == to_files_void) {
if (func == to_files_void) {
char *tmp = do_browse_from(answer);
if (tmp == NULL)
@@ -1131,18 +1129,18 @@ void do_insertfile(
continue;
#ifndef NANO_TINY
/* Keep track of whether the mark begins inside the
* partition and will need adjustment. */
if (openfile->mark_set) {
filestruct *top, *bot;
size_t top_x, bot_x;
/* Keep track of whether the mark begins inside the
* partition and will need adjustment. */
if (openfile->mark_set) {
filestruct *top, *bot;
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x,
&right_side_up);
single_line = (top == bot);
}
single_line = (top == bot);
}
#endif
#ifndef DISABLE_MULTIBUFFER
@@ -2234,7 +2232,6 @@ bool do_writeout(bool exiting)
static bool did_credits = FALSE;
#endif
bool retval = FALSE;
const sc *s;
currmenu = MWRITEFILE;
@@ -2306,11 +2303,12 @@ bool do_writeout(bool exiting)
retval = FALSE;
break;
} else {
functionptrtype func = func_from_key(&i);
ans = mallocstrcpy(ans, answer);
s = get_shortcut(&i);
#ifndef DISABLE_BROWSER
if (s && s->scfunc == to_files_void) {
if (func == to_files_void) {
char *tmp = do_browse_from(answer);
if (tmp == NULL)
@@ -2322,26 +2320,26 @@ bool do_writeout(bool exiting)
} else
#endif /* !DISABLE_BROWSER */
#ifndef NANO_TINY
if (s && s->scfunc == dos_format_void) {
if (func == dos_format_void) {
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
DOS_FILE;
continue;
} else if (s && s->scfunc == mac_format_void) {
} else if (func == mac_format_void) {
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
MAC_FILE;
continue;
} else if (s && s->scfunc == backup_file_void) {
} else if (func == backup_file_void) {
TOGGLE(BACKUP_FILE);
continue;
} else
#endif /* !NANO_TINY */
if (s && s->scfunc == prepend_void) {
if (func == prepend_void) {
append = (append == PREPEND) ? OVERWRITE : PREPEND;
continue;
} else if (s && s->scfunc == append_void) {
} else if (func == append_void) {
append = (append == APPEND) ? OVERWRITE : APPEND;
continue;
} else if (s && s->scfunc == do_help_void) {
} else if (func == do_help_void) {
continue;
}

View File

@@ -285,21 +285,7 @@ void flip_execute_void(void)
{
}
/* Set the type of command key based on the string. */
key_type strtokeytype(const char *str)
{
if (str[0] == '^')
return CONTROL;
else if (str[0] == 'M')
return META;
else if (str[0] == 'F')
return FKEY;
else
return RAWINPUT;
}
/* Add a string to the function list struct.
* Does not allow updates, not yet anyway. */
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
bool blank_after, bool viewok)
{
@@ -326,54 +312,26 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
#endif
}
/* Return the first shortcut in the list of shortcuts that
* matches the given func in the given menu. */
const sc *first_sc_for(int menu, void (*func)(void))
{
const sc *s;
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & menu) && s->scfunc == func)
return s;
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
}
/* Add a string to the shortcut list.
* Allows updates to existing entries in the list. */
/* Add a key combo to the shortcut list. */
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
{
sc *s;
static sc *tailsc;
sc *s = (sc *)nmalloc(sizeof(sc));
if (sclist == NULL) {
sclist = (sc *)nmalloc(sizeof(sc));
s = sclist;
s->next = NULL;
} else {
for (s = sclist; s->next != NULL; s = s->next)
if (s->menu == menu && s->keystr == scstring)
break;
/* Start the list, or tack on the next item. */
if (sclist == NULL)
sclist = s;
else
tailsc->next = s;
tailsc = s;
s->next = NULL;
if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
#ifdef DEBUG
fprintf(stderr, "No match found...\n");
#endif
s->next = (sc *)nmalloc(sizeof(sc));
s = s->next;
s->next = NULL;
}
}
s->type = strtokeytype(scstring);
/* Fill in the data. */
s->menu = menu;
s->scfunc = func;
s->toggle = toggle;
s->keystr = (char *) scstring;
s->scfunc = func;
s->type = strtokeytype(scstring);
assign_keyinfo(s);
#ifdef DEBUG
@@ -391,6 +349,23 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
s->scfunc = newfunc;
}
/* Return the first shortcut in the list of shortcuts that
* matches the given func in the given menu. */
const sc *first_sc_for(int menu, void (*func)(void))
{
const sc *s;
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & menu) && s->scfunc == func)
return s;
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
}
/* Return the given menu's first shortcut sequence, or the default value
* (2nd arg). Assumes currmenu for the menu to check. */
int sc_seq_or(void (*func)(void), int defaultval)
@@ -416,6 +391,19 @@ functionptrtype func_from_key(int *kbinput)
return NULL;
}
/* Return the type of command key based on the given string. */
key_type strtokeytype(const char *str)
{
if (str[0] == '^')
return CONTROL;
else if (str[0] == 'M')
return META;
else if (str[0] == 'F')
return FKEY;
else
return RAWINPUT;
}
/* Assign the info to the shortcut struct.
* Assumes keystr is already assigned, naturally. */
void assign_keyinfo(sc *s)
@@ -651,6 +639,7 @@ void shortcut_init(void)
const char *nano_lint_msg = N_("Invoke the linter, if available");
const char *nano_prevlint_msg = N_("Go to previous linter msg");
const char *nano_nextlint_msg = N_("Go to next linter msg");
const char *nano_formatter_msg = N_("Invoke formatter, if available");
#endif
#endif /* !DISABLE_HELP */
@@ -747,6 +736,8 @@ void shortcut_init(void)
#ifndef DISABLE_COLOR
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), IFSCHELP(nano_formatter_msg), TOGETHER, NOVIEW);
#endif
#ifndef NANO_TINY
@@ -1019,6 +1010,8 @@ void shortcut_init(void)
#ifndef DISABLE_COLOR
add_to_sclist(MMAIN, "^T", do_linter, 0);
add_to_sclist(MMAIN, "F12", do_linter, 0);
add_to_sclist(MMAIN, "^T", do_formatter, 0);
add_to_sclist(MMAIN, "F12", do_formatter, 0);
#endif
#endif
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0);
@@ -1190,17 +1183,24 @@ void shortcut_init(void)
}
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void)
void set_lint_or_format_shortcuts(void)
{
#ifndef DISABLE_SPELLER
replace_scs_for(do_spell, do_linter);
if (openfile->syntax->formatter) {
replace_scs_for(do_spell, do_formatter);
replace_scs_for(do_linter, do_formatter);
} else {
replace_scs_for(do_spell, do_linter);
replace_scs_for(do_formatter, do_linter);
}
#endif
}
void set_spell_shortcuts(void)
{
#ifndef DISABLE_SPELLER
replace_scs_for(do_linter, do_spell);
replace_scs_for(do_formatter, do_spell);
replace_scs_for(do_linter, do_spell);
#endif
}
#endif
@@ -1528,7 +1528,7 @@ int strtomenu(char *input)
return MHELP;
#endif
#ifndef DISABLE_SPELLER
else if (!strcasecmp(input, "spell"))
else if (!strcasecmp(input, "spell") || !strcasecmp(input, "formatter"))
return MSPELL;
#endif
else if (!strcasecmp(input, "linter"))

View File

@@ -251,6 +251,8 @@ typedef struct syntaxtype {
/* The colors used in this syntax. */
char *linter;
/* The command to lint this type of file. */
char *formatter;
/* Use this formatter command (for programming lang mainly) */
int nmultis;
/* How many multi-line strings this syntax has. */
struct syntaxtype *next;

View File

@@ -151,15 +151,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
'\0' || currmenu != MWRITEFILE)
do_statusbar_cut_text();
} else if (s->scfunc == do_right)
do_statusbar_right();
else if (s->scfunc == do_left)
} else if (s->scfunc == do_left)
do_statusbar_left();
else if (s->scfunc == do_right)
do_statusbar_right();
#ifndef NANO_TINY
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word(FALSE);
else if (s->scfunc == do_prev_word_void)
do_statusbar_prev_word(FALSE);
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word(FALSE);
#endif
else if (s->scfunc == do_home)
do_statusbar_home();
@@ -340,13 +340,12 @@ void do_statusbar_home(void)
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
} else {
} else
#endif
{
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
#ifndef NANO_TINY
}
#endif
if (need_statusbar_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
@@ -431,14 +430,13 @@ void do_statusbar_cut_text(void)
#ifndef NANO_TINY
if (ISSET(CUT_TO_END))
null_at(&answer, statusbar_x);
else {
else
#endif
{
null_at(&answer, 0);
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
#ifndef NANO_TINY
}
#endif
update_statusbar_line(answer, statusbar_x);
}
@@ -777,7 +775,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
}
#ifdef DEBUG
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif
update_statusbar_line(answer, statusbar_x);
@@ -901,7 +899,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
wnoutrefresh(bottomwin);
}
#ifndef DISABLE_HISTORIES
/* Set the current position in the history list to the bottom,
* and free magichistory if we need to. */
@@ -913,7 +910,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
}
#endif
/* We've finished putting in an answer or run a normal shortcut's
* associated function, so reset statusbar_x and statusbar_pww. If
* we've finished putting in an answer, reset the statusbar cursor
@@ -1045,7 +1041,6 @@ int do_yesno_prompt(bool all, const char *msg)
const char *yesstr; /* String of Yes characters accepted. */
const char *nostr; /* Same for No. */
const char *allstr; /* And All, surprise! */
const sc *s;
int oldmenu = currmenu;
assert(msg != NULL);
@@ -1106,15 +1101,16 @@ int do_yesno_prompt(bool all, const char *msg)
do {
int kbinput;
functionptrtype func;
#ifndef DISABLE_MOUSE
int mouse_x, mouse_y;
#endif
currmenu = MYESNO;
kbinput = get_kbinput(bottomwin);
s = get_shortcut(&kbinput);
func = func_from_key(&kbinput);
if (s && s->scfunc == do_cancel)
if (func == do_cancel)
ok = -1;
#ifndef DISABLE_MOUSE
else if (kbinput == KEY_MOUSE) {
@@ -1146,7 +1142,7 @@ int do_yesno_prompt(bool all, const char *msg)
}
}
#endif /* !DISABLE_MOUSE */
else if (s && s->scfunc == total_refresh) {
else if (func == total_refresh) {
total_redraw();
continue;
} else {

View File

@@ -359,7 +359,7 @@ void assign_keyinfo(sc *s);
void print_sclist(void);
void shortcut_init(void);
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void);
void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
@@ -688,6 +688,7 @@ void do_spell(void);
#endif
#ifndef DISABLE_COLOR
void do_linter(void);
void do_formatter(void);
#endif
#ifndef NANO_TINY
void do_wordlinechar_count(void);
@@ -780,7 +781,7 @@ void check_statusblank(void);
char *display_string(const char *buf, size_t start_col, size_t len, bool
dollars);
void titlebar(const char *path);
void set_modified(void);
extern void set_modified(void);
void statusbar(const char *msg, ...);
void bottombars(int menu);
void onekey(const char *keystroke, const char *desc, size_t len);

View File

@@ -328,6 +328,7 @@ void parse_syntax(char *ptr)
endsyntax->next = NULL;
endsyntax->nmultis = 0;
endsyntax->linter = NULL;
endsyntax->formatter = NULL;
#ifdef DEBUG
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
@@ -995,6 +996,31 @@ void parse_linter(char *ptr)
else
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
}
void parse_formatter(char *ptr)
{
assert(ptr != NULL);
if (syntaxes == NULL) {
rcfile_error(
N_("Cannot add formatter without a syntax command"));
return;
}
if (*ptr == '\0') {
rcfile_error(N_("Missing formatter command"));
return;
}
if (endsyntax->formatter != NULL)
free(endsyntax->formatter);
/* Let them unset the formatter by using "". */
if (!strcmp(ptr, "\"\""))
endsyntax->formatter = NULL;
else
endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr);
}
#endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a
@@ -1130,6 +1156,8 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE);
else if (strcasecmp(keyword, "linter") == 0)
parse_linter(ptr);
else if (strcasecmp(keyword, "formatter") == 0)
parse_formatter(ptr);
#endif /* !DISABLE_COLOR */
else if (strcasecmp(keyword, "bind") == 0)
parse_binding(ptr, TRUE);

View File

@@ -1883,6 +1883,10 @@ void do_justify(bool full_justify)
bool filebot_inpar = FALSE;
/* Whether the text at filebot is part of the current
* paragraph. */
int kbinput;
/* The first keystroke after a justification. */
functionptrtype func;
/* The function associated with that keystroke. */
/* We save these variables to be restored if the user
* unjustifies. */
@@ -1897,9 +1901,6 @@ void do_justify(bool full_justify)
#endif
bool modified_save = openfile->modified;
int kbinput;
const sc *s;
/* Move to the beginning of the current line, so that justifying at
* the end of the last line of the file, if that line isn't blank,
* will work the first time through. */
@@ -2218,9 +2219,9 @@ void do_justify(bool full_justify)
/* Now get a keystroke and see if it's unjustify. If not, put back
* the keystroke and return. */
kbinput = do_input(FALSE);
s = get_shortcut(&kbinput);
func = func_from_key(&kbinput);
if (s && s->scfunc == do_uncut_text) {
if (func == do_uncut_text) {
/* Splice the justify buffer back into the file, but only if we
* actually justified something. */
if (first_par_line != NULL) {
@@ -2934,7 +2935,6 @@ void do_linter(void)
static char **lintargs = NULL;
char *lintcopy;
char *convendptr = NULL;
const sc *s;
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
if (!openfile->syntax || !openfile->syntax->linter) {
@@ -3135,9 +3135,10 @@ void do_linter(void)
bottombars(MLINTER);
tmplint = NULL;
curlint = lints;
while (1) {
while (TRUE) {
ssize_t tmpcol = 1;
int kbinput;
functionptrtype func;
if (curlint->colno > 0)
tmpcol = curlint->colno;
@@ -3193,30 +3194,24 @@ void do_linter(void)
}
kbinput = get_kbinput(bottomwin);
s = get_shortcut(&kbinput);
func = func_from_key(&kbinput);
tmplint = curlint;
if (!s)
continue;
else if (s->scfunc == do_cancel)
if (func == do_cancel)
break;
else if (s->scfunc == do_help_void) {
else if (func == do_help_void) {
tmplint = NULL;
do_help_void();
} else if (s->scfunc == do_page_down) {
} else if (func == do_page_down) {
if (curlint->next != NULL)
curlint = curlint->next;
else {
else
statusbar(_("At last message"));
continue;
}
} else if (s->scfunc == do_page_up) {
} else if (func == do_page_up) {
if (curlint->prev != NULL)
curlint = curlint->prev;
else {
else
statusbar(_("At first message"));
continue;
}
}
}
blank_statusbar();
@@ -3230,6 +3225,160 @@ free_lints_and_return:
}
lint_cleanup();
}
/* Run a formatter for the given syntax.
* Expects the formatter to be non-interactive and
* operate on a file in-place, which we'll pass it
* on the command line. Another mashuhp of the speller
* and alt_speller routines.
*/
void do_formatter(void)
{
bool status;
FILE *temp_file;
char *temp = safe_tempfile(&temp_file);
int format_status;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
ssize_t current_y_save = openfile->current_y;
ssize_t lineno_save = openfile->current->lineno;
pid_t pid_format;
char *ptr;
static int arglen = 3;
static char **formatargs = NULL;
char *finalstatus = NULL;
/* Check whether we're using syntax highlighting
* and formatter option it set
*/
if (openfile->syntax == NULL || openfile->syntax->formatter == NULL) {
statusbar(_("Error: no linter defined"));
return;
}
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
return;
}
if (temp == NULL) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
return;
}
/* we're not supporting partial formatting, oi vey */
openfile->mark_set = FALSE;
status = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
if (!status) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
free(temp);
return;
}
if (openfile->totsize == 0) {
statusbar(_("Finished"));
return;
}
blank_bottombars();
statusbar(_("Invoking formatter, please wait"));
doupdate();
endwin();
/* Set up an argument list to pass execvp(). */
if (formatargs == NULL) {
formatargs = (char **)nmalloc(arglen * sizeof(char *));
formatargs[0] = strtok(openfile->syntax->formatter, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
formatargs = (char **)nrealloc(formatargs, arglen *
sizeof(char *));
formatargs[arglen - 3] = ptr;
}
formatargs[arglen - 1] = NULL;
}
formatargs[arglen - 2] = temp;
/* Start a new process for the formatter. */
if ((pid_format = fork()) == 0) {
/* Start alternate format program; we are using $PATH. */
execvp(formatargs[0], formatargs);
/* Should not be reached, if alternate formatter is found!!! */
exit(1);
}
/* If we couldn't fork, get out. */
if (pid_format < 0) {
statusbar(_("Could not fork"));
return;
}
#ifndef NANO_TINY
/* Don't handle a pending SIGWINCH until the alternate format checker
* is finished and we've loaded the format-checked file back in. */
allow_pending_sigwinch(FALSE);
#endif
/* Wait for the formatter to finish. */
wait(&format_status);
/* Reenter curses mode. */
doupdate();
/* Restore the terminal to its previous state. */
terminal_init();
/* Turn the cursor back on for sure. */
curs_set(1);
/* The screen might have been resized. If it has, reinitialize all
* the windows based on the new screen dimensions. */
window_init();
if (!WIFEXITED(format_status) ||
WEXITSTATUS(format_status) != 0) {
char *format_error;
char *invoke_error = _("Error invoking \"%s\"");
format_error =
charalloc(strlen(invoke_error) +
strlen(openfile->syntax->formatter) + 1);
sprintf(format_error, invoke_error, openfile->syntax->formatter);
finalstatus = format_error;
} else {
/* Replace the text of the current buffer with the format-checked
* text. */
replace_buffer(temp);
/* Go back to the old position, and mark the file as modified. */
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
set_modified();
#ifndef NANO_TINY
/* Handle a pending SIGWINCH again. */
allow_pending_sigwinch(TRUE);
#endif
finalstatus = _("Finished formatting");
}
unlink(temp);
free(temp);
currmenu = MMAIN;
/* If the spell-checker printed any error messages onscreen, make
* sure that they're cleared off. */
total_refresh();
statusbar(finalstatus);
}
#endif /* !DISABLE_COLOR */
#ifndef NANO_TINY

View File

@@ -3323,8 +3323,9 @@ void total_refresh(void)
void display_main_list(void)
{
#ifndef DISABLE_COLOR
if (openfile->syntax && openfile->syntax->linter)
set_lint_shortcuts();
if (openfile->syntax
&& (openfile->syntax->formatter || openfile->syntax->linter))
set_lint_or_format_shortcuts();
else
set_spell_shortcuts();
#endif
@@ -3435,7 +3436,7 @@ void do_replace_highlight(bool highlight, const char *word)
}
#ifndef DISABLE_EXTRA
#define CREDIT_LEN 57
#define CREDIT_LEN 53
#define XLCREDIT_LEN 8
/* Easter egg: Display credits. Assume nodelay(edit) and scrollok(edit)
@@ -3458,15 +3459,11 @@ void do_credits(void)
"Rocco Corsi",
"David Lawrence Ramsey",
"David Benbennick",
"Mark Majeres",
"Mike Frysinger",
"Benno Schulenberg",
"Ken Tyler",
"Sven Guckes",
NULL, /* credits[16], handled below. */
"Pauli Virtanen",
"Daniele Medri",
"Clement Laforet",
"Tedi Heriyanto",
"Bill Soudan",
"Christian Weisgerber",
"Erik Andersen",
@@ -3516,15 +3513,6 @@ void do_credits(void)
N_("Thank you for using nano!")
};
/* credits[16]: Make sure this name is displayed properly, since we
* can't dynamically assign it above, using Unicode 00F6 (Latin
* Small Letter O with Diaresis) if applicable. */
credits[16] =
#ifdef ENABLE_UTF8
using_utf8() ? "Florian K\xC3\xB6nig" :
#endif
"Florian K\xF6nig";
if (!old_more_space || !old_no_help) {
SET(MORE_SPACE);
SET(NO_HELP);