Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9007c58bdd | ||
|
|
2456dd2a85 | ||
|
|
a44cf41d37 | ||
|
|
76e7aaf514 | ||
|
|
cb776fad88 | ||
|
|
a4f28694c8 | ||
|
|
82d737ee6d | ||
|
|
138add24c8 | ||
|
|
532d55c8bd | ||
|
|
3345e3407d | ||
|
|
52d1c20973 | ||
|
|
6898c60ba6 | ||
|
|
69d26c35fb | ||
|
|
4d9b5e92b3 | ||
|
|
18a2edfb84 | ||
|
|
4e95ee9f6e | ||
|
|
79ff393dc2 | ||
|
|
03bcaf6067 | ||
|
|
5891c4a542 | ||
|
|
3131d0c48a | ||
|
|
336b0ecbca | ||
|
|
32e76c4386 | ||
|
|
7d77521794 | ||
|
|
7f61fa1b55 | ||
|
|
98485c96d8 | ||
|
|
184cf609c0 | ||
|
|
e73e02fe10 | ||
|
|
ed2f0b349f | ||
|
|
d4e1d31ea4 | ||
|
|
bb4edd0136 | ||
|
|
c9b3a71d02 | ||
|
|
1b65b19abd | ||
|
|
35cd49ec50 | ||
|
|
6c7764862b | ||
|
|
9c88cab78c | ||
|
|
651bb5009f | ||
|
|
86c6cd1725 | ||
|
|
bd98ff02f6 | ||
|
|
057ef182cd | ||
|
|
67cdd5ee1e | ||
|
|
92896a708d | ||
|
|
57fa775f25 | ||
|
|
8d53aa3ad2 | ||
|
|
5b1fb56a8f | ||
|
|
6948d2e779 | ||
|
|
69429ce274 | ||
|
|
170679294b | ||
|
|
4b3f2771b5 | ||
|
|
a44def03a0 | ||
|
|
9f1b1e2b14 | ||
|
|
e99f0b609b | ||
|
|
5bb10d25ef | ||
|
|
edabd27cd8 | ||
|
|
97a5d1270a | ||
|
|
f729c6dae5 | ||
|
|
a3cc4e6ecd | ||
|
|
2a9536c4e8 | ||
|
|
1f960f7e34 | ||
|
|
3f4389b968 | ||
|
|
700c43bd42 | ||
|
|
2ec70b6466 | ||
|
|
cf9f32b009 | ||
|
|
fcd4468f90 | ||
|
|
7239fda971 | ||
|
|
47dffa483f | ||
|
|
266e0496ab | ||
|
|
dbb5e7cd8e | ||
|
|
80750632d0 | ||
|
|
d23283e249 | ||
|
|
7ffc7b0438 | ||
|
|
1a8c90eec7 | ||
|
|
ea40ebb648 | ||
|
|
1c8cdfd174 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,6 +14,7 @@ core
|
||||
/INSTALL
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/compile
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
|
||||
189
ChangeLog
189
ChangeLog
@@ -1,3 +1,192 @@
|
||||
GNU nano 2.4.0 - 2015.03.22
|
||||
2015-03-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/chars.c (move_mbleft): Start looking for a multibyte char
|
||||
not at the start of the string, but only as far back as such a
|
||||
char can possibly be. Change suggested by Mark Majeres.
|
||||
* src/search.c (findnextstr): Step backward or forward not simply
|
||||
one byte but one character (possibly multibyte). Fixes Savannah
|
||||
bug #42175, reported by myself, and the finding of ghosts seen in
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html.
|
||||
* src/winio.c (edit_redraw): Do not center the current line when
|
||||
smooth scrolling is used. This fixes Savannah bug #42654.
|
||||
|
||||
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Remove some leftovers.
|
||||
* src/search.c: Place some comments better and unwrap some lines.
|
||||
|
||||
2015-03-21 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Restore the positions of the mark
|
||||
and the cursor in a better way: to the columns where they were.
|
||||
This fixes Savannah bug #44542, reported by Benno Schulenberg.
|
||||
|
||||
2015-03-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (finish_stdin_pager, cancel_stdin_pager, stdin_pager):
|
||||
Normalize the whitespace, remove an old comment, and place another
|
||||
one better.
|
||||
* src/text.c (do_undo): Make a message equal to another one. It
|
||||
was mistakenly changed in r4950. (This is translation-neutral.)
|
||||
* src/global.c (shortcut_init): Keep related items together in the
|
||||
^G help screen.
|
||||
|
||||
2015-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Do not set the modified flag when
|
||||
an external spell checker didn't make any changes. This fixes
|
||||
Savannah bug #44320, reported by Cody A. Taylor.
|
||||
|
||||
2015-03-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Fix a message plus a few comments.
|
||||
|
||||
2015-03-14 Mark Majeres <mark@engine12.com>
|
||||
* src/nano.c (renumber): Get out if there is nothing to renumber,
|
||||
to prevent do_undo() from falling over trying to renumber emptiness.
|
||||
This fixes Savannah bug #44488, reported by Dennis Decker Jensen.
|
||||
|
||||
2015-03-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
|
||||
--enable-nanorc.
|
||||
* src/rcfile.c (parse_binding): Fix the rebinding of toggles.
|
||||
* doc/man/{nano.1,rnano.1,nanorc.5}, doc/texinfo/nano.texi: Update
|
||||
years and version numbers in the docs in anticipation of a release.
|
||||
* src/nano.c (version): Drop compile time from version information
|
||||
to enable a reproducible build. Proposed by Jérémy Bobbio and Jordi
|
||||
Mallach (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774388).
|
||||
|
||||
2015-03-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Add a note about the
|
||||
inherent imperfection of using regular expressions for syntax
|
||||
highlighting, as suggested by Mike Frysinger in bug #30962.
|
||||
* doc/man/nanorc.5: Improve the indentation of some lists.
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Remove the mistaken
|
||||
square brackets around the arguments of "header" and "magic" --
|
||||
those arguments are not optional. Also add "formatter" to the
|
||||
texinfo document, and slightly improve its punctuation.
|
||||
|
||||
GNU nano 2.3.99pre2 - 2015.02.27
|
||||
2015-02-25 Chris Allegretta <chrisa@asty.org>
|
||||
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
|
||||
rebinding toggles broke with r5022. (Fixed in r5134.)
|
||||
|
||||
2015-02-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Fix the explanation of how to subscribe to a mailing list.
|
||||
* doc/syntax/{java,lua,python,ruby}.nanorc: Wrap some overlong lines.
|
||||
|
||||
2015-02-18 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/sh.nanorc: Recognize also dash, openrc and runscript.
|
||||
|
||||
2015-02-16 Mike Frysinger <vapier@gentoo.org>
|
||||
* .gitignore: Ignore the autotools 'compile' file.
|
||||
|
||||
2015-02-15 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/file.c (do_lockfile): Also show the name of the affected file
|
||||
when finding a lock file, for when many files are opened at once.
|
||||
* src/file.c (do_lockfile): The user does the editing, not the editor.
|
||||
|
||||
2015-02-09 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.spec.in: Add dependency on texinfo, docdir files for
|
||||
RPM file creation.
|
||||
|
||||
GNU nano 2.3.99pre2 - 2015.02.06
|
||||
2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
|
||||
* src/cut.c (do_cut_text): Make sure to set modified even when
|
||||
using --enable-tiny.
|
||||
|
||||
2015-02-01 Kamil Dudka <kdudka@redhat.com>
|
||||
* src/files.c (write_lockfile): Avoid writing uninitialized bytes to
|
||||
the lock file -- a simple null_at() would not initialize the buffer.
|
||||
* src/files.c (do_lockfile): Make sure that 'lockprog' and 'lockuser'
|
||||
are terminated -- strncpy() does not guarantee that on its own.
|
||||
* src/files.c (do_lockfile): Avoid printing a wrong PID on the status
|
||||
bar due to treating serialized PID bytes as signed integers. This
|
||||
addresses https://bugzilla.redhat.com/1186384 reported by Don Swaner.
|
||||
* src/files.c (write_lockfile): Do not trim the nano version number
|
||||
-- snprintf() counts the trailing zero into the size limit.
|
||||
|
||||
2015-02-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (do_credits): Add a general entry for all translators.
|
||||
* src/nano.c (version), src/winio.c (do_credits): Update the copyright
|
||||
years to include 2015.
|
||||
|
||||
2015-01-13 Chris Allegretta <chrisa@asty.org>
|
||||
* src/files.c (open_buffer): Check here for locking and properly
|
||||
handle choosing to not open a file when locked instead of in
|
||||
open_file(). Fixes Savannah bug 42373 reported by Benno Schulenberg.
|
||||
|
||||
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.
|
||||
|
||||
42
NEWS
42
NEWS
@@ -1,3 +1,43 @@
|
||||
2015.03.22 - GNU nano 2.4.0 "lizf" is released. This is the first
|
||||
stable release in many years, and brinds together many
|
||||
new features from the 2.3 series: including:
|
||||
a fully functional undo system (now enabled by default),
|
||||
vim-compatible file locking, linter support, formatter
|
||||
support, syntax highlighting flexibility, and many fixes
|
||||
for issues reported since 2.2. Many sincere thanks
|
||||
to all of the bug reports, patches, well wishes and
|
||||
contributions from everyone who has continued to
|
||||
support us. Thank you for using nano!
|
||||
|
||||
|
||||
2015.02.27 - GNU nano 2.3.99pre3 "Ashley" is released. This is likely
|
||||
to be the last release before the next major (2.4.0)
|
||||
release. Please test it out and send us any feedback
|
||||
via the Savannah bug page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). This
|
||||
release includes fixes for rebinding toggles via
|
||||
nanorc, several memory alignment fixes, and documentation
|
||||
and build updates. As always thank you for using
|
||||
nano - Share and Enjoy!
|
||||
|
||||
2015.02.06 - GNU nano 2.3.99pre2 "Snowblind" is released. This release
|
||||
contains only fixes, including: a long-standing problem
|
||||
with cutting in nano-tiny, several memory alignment
|
||||
improvements, and issues with leftover file locks. Please
|
||||
keep reporting bugs so we can get a happy and healthy
|
||||
2.4.0 soon. Thanks for using nano!
|
||||
|
||||
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
|
||||
@@ -326,7 +366,7 @@
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
the editor. Please see the nanorc(5) page for
|
||||
more information on configuring key bindings. Please
|
||||
also report all keybinding bugs (crashes, missing
|
||||
menu functions) using the Savannah bug tracker URL,
|
||||
|
||||
32
README
32
README
@@ -24,6 +24,7 @@ Overview
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
|
||||
tar zxvf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
./configure
|
||||
@@ -32,31 +33,30 @@ How to compile and install nano
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you configured with the "--enable-nanorc" option, after
|
||||
installation you might copy the doc/nanorc.sample to your home
|
||||
directory, rename it to ".nanorc", and then edit it according to
|
||||
your taste.
|
||||
|
||||
If you haven't configured with the "--disable-nanorc" option, after
|
||||
installation you may want to copy the doc/nanorc.sample to your
|
||||
home directory, rename it to ".nanorc", and then edit it according
|
||||
to your taste.
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.nano-editor.org/
|
||||
|
||||
Mailing List and Bug Reports
|
||||
Mailing Lists and Bug Reports
|
||||
|
||||
Savannah hosts all the nano-related mailing-lists.
|
||||
|
||||
+ info-nano@gnu.org is a very low traffic list
|
||||
used to announce new nano versions or other important
|
||||
information about the project.
|
||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
||||
new nano versions or other important information about the
|
||||
project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its
|
||||
development.
|
||||
+ nano-devel@gnu.org is the list used by the people
|
||||
that make nano and a general development discussion list, with
|
||||
moderate traffic.
|
||||
wanting to hear about the technical details of its development.
|
||||
+ nano-devel@gnu.org is the list used by the people that make
|
||||
nano and a general development discussion list, with moderate
|
||||
traffic.
|
||||
|
||||
To subscribe, send email to nano-<name>-request@gnu.org with a
|
||||
To subscribe, send email to <name>-request@gnu.org with a
|
||||
subject of "subscribe", where <name> is the list you want to
|
||||
subscribe to.
|
||||
|
||||
@@ -68,5 +68,3 @@ Current Status
|
||||
GNU nano has reached its fourth stable milestone, 2.2.x.
|
||||
Development of new features continues in the 2.3.x branch, while
|
||||
2.2.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
$Id$
|
||||
|
||||
1
THANKS
1
THANKS
@@ -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
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.6], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.4.0], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
@@ -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.4.0" "March 2015"
|
||||
.\" 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).
|
||||
|
||||
134
doc/man/nanorc.5
134
doc/man/nanorc.5
@@ -2,7 +2,7 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" 2013, 2014, 2015 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:
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.3.5" "June 2014"
|
||||
.TH NANORC 5 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -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,20 +237,27 @@ 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.
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
can be defined via the following commands:
|
||||
is done via regular expressions (see the \fBcolor\fR command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like \fBnano\fR.
|
||||
.sp
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
@@ -266,12 +277,17 @@ For the currently defined syntax, use the given \fIprogram\fR
|
||||
to invoke the linter (this overrides the speller function when
|
||||
defined).
|
||||
.TP
|
||||
.BR header " [""\fIregex\fR"" ...]
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
For the currently defined syntax, use the given \fIprogram\fR
|
||||
to automatically reformat 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,
|
||||
to determine whether this syntax should be used for that file.
|
||||
.TP
|
||||
.BR magic " [""\fIregex\fR"" ...]
|
||||
.BR magic " \fIregex\fR " ...
|
||||
For the currently defined syntax, add one or more regexes which
|
||||
will be compared against the result of querying the \fBmagic\fP
|
||||
database about the file to be edited, to determine whether this
|
||||
@@ -331,7 +347,8 @@ menus where it exists by using \fBall\fP).
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.TP
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
@@ -343,10 +360,11 @@ Example: M-C
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
Example: F10
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fIfunction\fP names to be bound include:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B help
|
||||
Invokes the help viewer.
|
||||
@@ -464,7 +482,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
|
||||
@@ -608,10 +626,11 @@ Toggles automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B suspendenable
|
||||
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fImenu\fP sections are:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B main
|
||||
The main editor window where text is entered and edited.
|
||||
@@ -659,6 +678,7 @@ The 'go to directory' menu in the file browser.
|
||||
A special name that encompasses all menus.
|
||||
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
|
||||
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||
.RE
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
|
||||
@@ -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.4.0" "March 2015"
|
||||
.\" 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).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,7 +5,8 @@ magic "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 cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native)\>"
|
||||
color cyan "\<(package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color red ""[^"]*""
|
||||
color yellow "\<(true|false|null)\>"
|
||||
color blue "//.*"
|
||||
|
||||
@@ -15,18 +15,20 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
|
||||
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
|
||||
|
||||
# Keywords
|
||||
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
|
||||
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
|
||||
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
|
||||
|
||||
# Standard library
|
||||
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
|
||||
color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
|
||||
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
|
||||
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
|
||||
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
|
||||
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
|
||||
color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
|
||||
# File handle methods
|
||||
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
## 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_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from)\>"
|
||||
color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
|
||||
# Strings.
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
## 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)\>"
|
||||
# Reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
|
||||
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# Constants.
|
||||
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
|
||||
# Ruby "symbols".
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
|
||||
syntax "sh" "\.sh$"
|
||||
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
|
||||
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne.*) shell script text"
|
||||
|
||||
icolor brightgreen "^[0-9A-Z_]+\(\)"
|
||||
|
||||
@@ -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)"
|
||||
|
||||
|
||||
@@ -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.4.0
|
||||
@set UPDATED March 2015
|
||||
|
||||
@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.4.0
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -34,7 +34,7 @@ editor.
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp 4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2009, 2014 Free Software Foundation, Inc.
|
||||
2009, 2014, 2015 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:
|
||||
@@ -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.
|
||||
|
||||
@@ -763,7 +812,14 @@ characters as part of a word.
|
||||
@node Syntax Highlighting
|
||||
@section Syntax Highlighting
|
||||
|
||||
Coloring the different syntactic elements of a file can be defined
|
||||
Coloring the different syntactic elements of a file
|
||||
is done via regular expressions (see the @code{color} command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like @code{nano}.
|
||||
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands in a nanorc file:
|
||||
|
||||
@table @code
|
||||
@@ -784,12 +840,16 @@ syntax's "fileregex".
|
||||
For the currently defined syntax, use the given program to invoke the
|
||||
linter (this overrides the speller function when defined).
|
||||
|
||||
@item formatter program [arg @dots{}]
|
||||
For the currently defined syntax, use the given program to automatically
|
||||
reformat text. Useful in certain programming languages (e.g. go).
|
||||
|
||||
@item header "regex" @dots{}
|
||||
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,
|
||||
to determine whether this syntax should be used for that file.
|
||||
|
||||
@item magic ["regex" @dots{}]
|
||||
@item magic "regex" @dots{}
|
||||
For the currently defined syntax, add one or more regexes which will be
|
||||
compared against the result of querying the magic database about the file
|
||||
to be edited, to determine whether this syntax should be used for that
|
||||
@@ -989,7 +1049,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
|
||||
|
||||
@@ -11,7 +11,7 @@ Group : Applications/Editors
|
||||
URL : http://www.nano-editor.org/
|
||||
Source : http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
|
||||
BuildRoot : %{_tmppath}/%{name}-%{version}-root
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
|
||||
|
||||
%description
|
||||
GNU nano is a small and friendly text editor. It aims to emulate the
|
||||
@@ -33,6 +33,7 @@ rm -f %{buildroot}%{_infodir}/dir
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%{_bindir}/*
|
||||
%{_docdir}/nano/*
|
||||
%{_mandir}/man*/*
|
||||
%{_mandir}/fr/man*/*
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
705
po/nano.pot
705
po/nano.pot
File diff suppressed because it is too large
Load Diff
727
po/pt_BR.po
727
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
710
po/zh_CN.po
710
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
710
po/zh_TW.po
710
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
10
src/chars.c
10
src/chars.c
@@ -484,12 +484,18 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t before = 0, char_len = 0;
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
|
||||
@@ -219,10 +219,9 @@ void do_cut_text(
|
||||
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
if (!copy_text) {
|
||||
set_modified();
|
||||
}
|
||||
if (!copy_text)
|
||||
#endif /* !NANO_TINY */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
143
src/files.c
143
src/files.c
@@ -126,6 +126,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
pid_t mypid;
|
||||
uid_t myuid;
|
||||
struct passwd *mypwuid;
|
||||
struct stat fileinfo;
|
||||
char *lockdata = charalloc(1024);
|
||||
char myhostname[32];
|
||||
ssize_t lockdatalen = 1024;
|
||||
@@ -145,8 +146,10 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
/* Check if the lock exists before we try to delete it...*/
|
||||
if (stat(lockfilename, &fileinfo) != -1)
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
|
||||
if (ISSET(INSECURE_BACKUP))
|
||||
cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
@@ -156,11 +159,13 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
fd = open(lockfilename, cflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
|
||||
/* Maybe we just don't have write access. Don't stop us from
|
||||
* opening the file at all, just don't set the lock_filename and
|
||||
* return success. */
|
||||
if (fd < 0 && errno == EACCES)
|
||||
return 1;
|
||||
/* Maybe we just don't have write access. Print an error message
|
||||
and continue. */
|
||||
if (fd < 0) {
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now we've got a safe file stream. If the previous open() call
|
||||
* failed, this will return NULL. */
|
||||
@@ -190,12 +195,12 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
* our lockfile' message in here...
|
||||
*
|
||||
* This is likely very wrong, so this is a WIP. */
|
||||
null_at(&lockdata, lockdatalen);
|
||||
memset(lockdata, 0, lockdatalen);
|
||||
lockdata[0] = 0x62;
|
||||
lockdata[1] = 0x30;
|
||||
lockdata[24] = mypid % 256;
|
||||
lockdata[25] = mypid / 256;
|
||||
snprintf(&lockdata[2], 10, "nano %s", VERSION);
|
||||
snprintf(&lockdata[2], 11, "nano %s", VERSION);
|
||||
strncpy(&lockdata[28], mypwuid->pw_name, 16);
|
||||
strncpy(&lockdata[68], myhostname, 31);
|
||||
strncpy(&lockdata[108], origfilename, 768);
|
||||
@@ -229,8 +234,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
@@ -248,7 +253,7 @@ int do_lockfile(const char *filename)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(lockfilesize);
|
||||
char *lockfiledir = NULL;
|
||||
char lockprog[12], lockuser[16];
|
||||
static char lockprog[11], lockuser[17];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
|
||||
@@ -279,7 +284,7 @@ int do_lockfile(const char *filename)
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = lockbuf[25] * 256 + lockbuf[24];
|
||||
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
@@ -288,8 +293,9 @@ 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?",
|
||||
lockprog, lockpid, lockuser);
|
||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
|
||||
filename, lockuser, lockprog, lockpid);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
@@ -314,6 +320,7 @@ int do_lockfile(const char *filename)
|
||||
* necessary, and then open and read the file, if applicable. */
|
||||
void open_buffer(const char *filename, bool undoable)
|
||||
{
|
||||
bool quiet = FALSE;
|
||||
bool new_buffer = (openfile == NULL
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
|| ISSET(MULTIBUFFER)
|
||||
@@ -337,13 +344,31 @@ void open_buffer(const char *filename, bool undoable)
|
||||
|
||||
/* If we're loading into a new buffer, add a new entry to
|
||||
* openfile. */
|
||||
if (new_buffer)
|
||||
if (new_buffer) {
|
||||
make_new_buffer();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
int lockstatus = do_lockfile(filename);
|
||||
if (lockstatus < 0) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (openfile->next) {
|
||||
close_buffer(TRUE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else if (lockstatus == 0) {
|
||||
quiet = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||
* open the file. Otherwise, treat it as a new file. */
|
||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||
open_file(filename, new_buffer, &f) : -2;
|
||||
open_file(filename, new_buffer, quiet, &f) : -2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
@@ -395,7 +420,7 @@ void replace_buffer(const char *filename)
|
||||
|
||||
/* If the filename isn't blank, open the file. Otherwise, treat it
|
||||
* as a new file. */
|
||||
rc = (filename[0] != '\0') ? open_file(filename, TRUE, &f) : -2;
|
||||
rc = (filename[0] != '\0') ? open_file(filename, TRUE, FALSE, &f) : -2;
|
||||
|
||||
/* Reinitialize the text of the current buffer. */
|
||||
free_filestruct(openfile->fileage);
|
||||
@@ -431,14 +456,15 @@ void display_buffer(void)
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Switch to the next file buffer if next_buf is TRUE. Otherwise,
|
||||
* switch to the previous file buffer. */
|
||||
void switch_to_prevnext_buffer(bool next_buf)
|
||||
void switch_to_prevnext_buffer(bool next_buf, bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If only one file buffer is open, indicate it on the statusbar and
|
||||
* get out. */
|
||||
if (openfile == openfile->next) {
|
||||
statusbar(_("No more open file buffers"));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("No more open file buffers"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,9 +480,10 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
display_buffer();
|
||||
|
||||
/* Indicate the switch on the statusbar. */
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ? _("New Buffer") :
|
||||
openfile->filename));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ? _("New Buffer") :
|
||||
openfile->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(openfile->current);
|
||||
@@ -467,19 +494,21 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
/* Switch to the previous entry in the openfile filebuffer. */
|
||||
void switch_to_prev_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(FALSE);
|
||||
switch_to_prevnext_buffer(FALSE, FALSE);
|
||||
}
|
||||
|
||||
/* Switch to the next entry in the openfile filebuffer. */
|
||||
void switch_to_next_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(TRUE);
|
||||
switch_to_prevnext_buffer(TRUE, FALSE);
|
||||
}
|
||||
|
||||
/* Delete an entry from the openfile filebuffer, and switch to the one
|
||||
* after it. Return TRUE on success, or FALSE if there are no more open
|
||||
* file buffers. */
|
||||
bool close_buffer(void)
|
||||
* file buffers.
|
||||
* quiet - should we print messages switching bufers
|
||||
*/
|
||||
bool close_buffer(bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
@@ -492,7 +521,7 @@ bool close_buffer(void)
|
||||
#endif
|
||||
|
||||
/* Switch to the next file buffer. */
|
||||
switch_to_next_buffer_void();
|
||||
switch_to_prevnext_buffer(TRUE, quiet);
|
||||
|
||||
/* Close the file buffer we had open before. */
|
||||
unlink_opennode(openfile->prev);
|
||||
@@ -888,10 +917,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and the
|
||||
* fd opened otherwise. The file might still have an error while reading
|
||||
* with a 0 return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
{
|
||||
struct stat fileinfo, fileinfo2;
|
||||
int fd, quiet = 0;
|
||||
int fd;
|
||||
char *full_filename;
|
||||
|
||||
assert(filename != NULL && f != NULL);
|
||||
@@ -906,16 +935,6 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
int lockstatus = do_lockfile(full_filename);
|
||||
if (lockstatus < 0)
|
||||
return -1;
|
||||
else if (lockstatus == 0)
|
||||
quiet = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stat(full_filename, &fileinfo) == -1) {
|
||||
/* Well, maybe we can open the file even if the OS says it's
|
||||
* not there. */
|
||||
@@ -1026,7 +1045,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 +1102,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 +1117,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 +1148,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 +2251,6 @@ bool do_writeout(bool exiting)
|
||||
static bool did_credits = FALSE;
|
||||
#endif
|
||||
bool retval = FALSE;
|
||||
const sc *s;
|
||||
|
||||
currmenu = MWRITEFILE;
|
||||
|
||||
@@ -2306,11 +2322,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 +2339,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;
|
||||
}
|
||||
|
||||
|
||||
122
src/global.c
122
src/global.c
@@ -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 */
|
||||
|
||||
@@ -746,7 +735,9 @@ void shortcut_init(void)
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_formatter, MMAIN,
|
||||
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, 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"))
|
||||
|
||||
26
src/nano.c
26
src/nano.c
@@ -178,7 +178,8 @@ void renumber(filestruct *fileptr)
|
||||
{
|
||||
ssize_t line;
|
||||
|
||||
assert(fileptr != NULL);
|
||||
if (fileptr == NULL)
|
||||
return;
|
||||
|
||||
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
|
||||
|
||||
@@ -365,8 +366,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
|
||||
/* Renumber starting with the line after the original
|
||||
* file_bot. */
|
||||
if (file_bot_save->next != NULL)
|
||||
renumber(file_bot_save->next);
|
||||
renumber(file_bot_save->next);
|
||||
}
|
||||
|
||||
/* Since the text has now been saved, remove it from the
|
||||
@@ -960,9 +960,8 @@ void usage(void)
|
||||
* it was compiled with. */
|
||||
void version(void)
|
||||
{
|
||||
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
|
||||
__TIME__, __DATE__);
|
||||
printf(" (C) 1999..2014 Free Software Foundation, Inc.\n");
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
@@ -1152,7 +1151,7 @@ void do_exit(void)
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
if (!close_buffer(FALSE))
|
||||
#endif
|
||||
finish();
|
||||
/* If the user canceled, we go on. */
|
||||
@@ -1181,20 +1180,20 @@ void finish_stdin_pager(void)
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
@@ -1202,7 +1201,6 @@ void finish_stdin_pager(void)
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently. */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
@@ -1214,13 +1212,13 @@ void stdin_pager(void)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
/* Enable interpretation of the special control keys so that
|
||||
* we get SIGINT when Ctrl-C is pressed. */
|
||||
#ifndef NANO_TINY
|
||||
enable_signals();
|
||||
#endif
|
||||
|
||||
/* Set things up so that SIGINT will cancel the new process. */
|
||||
if (sigaction(SIGINT, NULL, &pager_newaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
@@ -1482,13 +1480,13 @@ void do_toggle(int flag)
|
||||
desc = (char *) _(flagtostr(flag));
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled"));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Bleh. */
|
||||
void do_toggle_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Disable extended input and output processing in our terminal
|
||||
* settings. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
32
src/prompt.c
32
src/prompt.c
@@ -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 {
|
||||
|
||||
13
src/proto.h
13
src/proto.h
@@ -283,15 +283,15 @@ void replace_buffer(const char *filename);
|
||||
#endif
|
||||
void display_buffer(void);
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
void switch_to_prevnext_buffer(bool next);
|
||||
void switch_to_prevnext_buffer(bool next, bool quiet);
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
bool close_buffer(bool quiet);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_TINY
|
||||
@@ -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);
|
||||
@@ -480,8 +480,8 @@ RETSIGTYPE do_continue(int signal);
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
#endif
|
||||
void do_toggle_void(void);
|
||||
void disable_extended_io(void);
|
||||
#ifdef USE_SLANG
|
||||
void disable_signals(void);
|
||||
@@ -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);
|
||||
|
||||
32
src/rcfile.c
32
src/rcfile.c
@@ -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);
|
||||
@@ -513,6 +514,10 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (f->scfunc == newsc->scfunc)
|
||||
mask = mask | f->menus;
|
||||
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->scfunc == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
if (is_universal(newsc->scfunc))
|
||||
menu = menu & MMOST;
|
||||
@@ -995,6 +1000,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 +1160,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);
|
||||
|
||||
39
src/search.c
39
src/search.c
@@ -161,8 +161,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the
|
||||
* line. */
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
@@ -287,9 +286,9 @@ bool findnextstr(
|
||||
rev_start +=
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
openfile->current_x - 1 :
|
||||
((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) :
|
||||
#endif
|
||||
openfile->current_x + 1;
|
||||
move_mbright(fileptr->data, openfile->current_x);
|
||||
|
||||
/* Look for needle in the current line we're searching. */
|
||||
enable_nodelay();
|
||||
@@ -347,8 +346,8 @@ bool findnextstr(
|
||||
break;
|
||||
}
|
||||
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
/* We've finished processing the file, so get out. */
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return FALSE;
|
||||
@@ -367,9 +366,8 @@ bool findnextstr(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We've reached the start or end of the buffer, so wrap
|
||||
* around. */
|
||||
if (fileptr == NULL) {
|
||||
/* We've reached the start or end of the buffer, so wrap around. */
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = openfile->filebot;
|
||||
@@ -384,8 +382,8 @@ bool findnextstr(
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting line. */
|
||||
if (fileptr == begin)
|
||||
/* We've reached the original starting line. */
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -445,8 +443,7 @@ void do_search(void)
|
||||
i = search_init(FALSE, FALSE);
|
||||
|
||||
if (i == -1)
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
else if (i == -2)
|
||||
/* Replace. */
|
||||
@@ -740,12 +737,10 @@ ssize_t do_replace_loop(
|
||||
* beginning line already, and we're still on the beginning line
|
||||
* after the search, it means that we've wrapped around, so
|
||||
* we're done. */
|
||||
if (bol_or_eol && begin_line && openfile->current ==
|
||||
real_current)
|
||||
if (bol_or_eol && begin_line && openfile->current == real_current)
|
||||
break;
|
||||
/* Otherwise, set the begin_line flag if we've found a match on
|
||||
* the beginning line, reset the bol_or_eol flag, and
|
||||
* continue. */
|
||||
* the beginning line, reset the bol_or_eol flag, and continue. */
|
||||
else {
|
||||
if (openfile->current == real_current)
|
||||
begin_line = TRUE;
|
||||
@@ -850,7 +845,7 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
openfile->current_x += match_len + length_change - 1;
|
||||
|
||||
/* Cleanup. */
|
||||
/* Clean up. */
|
||||
openfile->totsize += mbstrlen(copy) -
|
||||
mbstrlen(openfile->current->data);
|
||||
free(openfile->current->data);
|
||||
@@ -913,8 +908,7 @@ void do_replace(void)
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) {
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
return;
|
||||
} else if (i == -2) {
|
||||
@@ -951,8 +945,7 @@ void do_replace(void)
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
* means that the string is not "". */
|
||||
/* If the replace string is not "", add it to the replace history list. */
|
||||
if (i == 0)
|
||||
update_history(&replace_history, answer);
|
||||
#endif
|
||||
@@ -1085,7 +1078,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
edit_refresh();
|
||||
|
||||
display_main_list();
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1136,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
/* We've found a potential match. */
|
||||
break;
|
||||
|
||||
if (reverse) {
|
||||
@@ -1156,8 +1148,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
current_y_find++;
|
||||
}
|
||||
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
if (fileptr == NULL)
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
return FALSE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -1373,8 +1365,7 @@ void update_history(filestruct **h, const char *s)
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
if (bar != NULL)
|
||||
renumber(bar);
|
||||
renumber(bar);
|
||||
}
|
||||
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
|
||||
228
src/text.c
228
src/text.c
@@ -442,7 +442,7 @@ void do_undo(void)
|
||||
|
||||
filestruct *f = fsfromline(u->mark_begin_lineno);
|
||||
if (!f) {
|
||||
statusbar(_("Internal error: can't match line %ld. Please save your work."), (long)u->mark_begin_lineno);
|
||||
statusbar(_("Internal error: can't match line %d. Please save your work."), u->mark_begin_lineno);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -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) {
|
||||
@@ -2660,9 +2661,10 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
{
|
||||
int alt_spell_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;
|
||||
struct stat spellfileinfo;
|
||||
__time_t timestamp;
|
||||
pid_t pid_spell;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
@@ -2671,9 +2673,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
bool added_magicline = FALSE;
|
||||
/* Whether we added a magicline after filebot. */
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
ssize_t mb_lineno_save = 0;
|
||||
@@ -2698,6 +2697,10 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the timestamp of the temporary file. */
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
timestamp = spellfileinfo.st_mtime;
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass execvp(). */
|
||||
@@ -2775,7 +2778,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
* added when we're done correcting misspelled words; and
|
||||
* turn the mark off. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
if (!ISSET(NO_NEWLINES))
|
||||
added_magicline = (openfile->filebot->data[0] != '\0');
|
||||
@@ -2799,18 +2802,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
if (!ISSET(NO_NEWLINES) && added_magicline)
|
||||
remove_magicline();
|
||||
|
||||
/* Put the beginning and the end of the mark at the beginning
|
||||
* and the end of the spell-checked text. */
|
||||
if (openfile->fileage == openfile->filebot)
|
||||
bot_x += top_x;
|
||||
if (right_side_up) {
|
||||
openfile->mark_begin_x = top_x;
|
||||
current_x_save = bot_x;
|
||||
} else {
|
||||
current_x_save = top_x;
|
||||
openfile->mark_begin_x = bot_x;
|
||||
}
|
||||
|
||||
/* Unpartition the filestruct so that it contains all the text
|
||||
* again. Note that we've replaced the marked text originally
|
||||
* in the partition with the spell-checked marked text in the
|
||||
@@ -2826,8 +2817,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
openfile->totsize = totsize_save;
|
||||
|
||||
/* Assign mark_begin to the line where the mark began before. */
|
||||
do_gotopos(mb_lineno_save, openfile->mark_begin_x,
|
||||
current_y_save, 0);
|
||||
goto_line_posx(mb_lineno_save, openfile->mark_begin_x);
|
||||
openfile->mark_begin = openfile->current;
|
||||
|
||||
/* Assign mark_begin_x to the location in mark_begin where the
|
||||
@@ -2840,9 +2830,16 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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();
|
||||
/* Go back to the old position. */
|
||||
goto_line_posx(lineno_save, current_x_save);
|
||||
openfile->current_y = current_y_save;
|
||||
edit_update(NONE);
|
||||
|
||||
/* Stat the temporary file again, and mark the buffer as modified only
|
||||
* if this file was changed since it was written. */
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
if (spellfileinfo.st_mtime != timestamp)
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle a pending SIGWINCH again. */
|
||||
@@ -2934,7 +2931,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 +3131,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 +3190,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 +3221,157 @@ 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 mashup 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 the formatter option is set. */
|
||||
if (openfile->syntax == NULL || openfile->syntax->formatter == NULL) {
|
||||
statusbar(_("Error: no formatter 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 the formatting program; we are using $PATH. */
|
||||
execvp(formatargs[0], formatargs);
|
||||
|
||||
/* Should not be reached, if the 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 formatted 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 formatter printed any error messages onscreen, make
|
||||
* sure that they're cleared off. */
|
||||
total_refresh();
|
||||
|
||||
statusbar(finalstatus);
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
||||
40
src/winio.c
40
src/winio.c
@@ -3160,10 +3160,11 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Put edittop in range of current, get the difference in lines
|
||||
* between the original edittop and the current edittop, and
|
||||
* then restore the original edittop. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
if (ISSET(SMOOTH_SCROLL))
|
||||
edit_update(NONE);
|
||||
else
|
||||
edit_update(CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
@@ -3229,8 +3230,7 @@ void edit_refresh(void)
|
||||
(long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows);
|
||||
#endif
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update(CENTER);
|
||||
}
|
||||
|
||||
@@ -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,8 +3436,8 @@ void do_replace_highlight(bool highlight, const char *word)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_EXTRA
|
||||
#define CREDIT_LEN 57
|
||||
#define XLCREDIT_LEN 8
|
||||
#define CREDIT_LEN 54
|
||||
#define XLCREDIT_LEN 9
|
||||
|
||||
/* Easter egg: Display credits. Assume nodelay(edit) and scrollok(edit)
|
||||
* are FALSE. */
|
||||
@@ -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",
|
||||
@@ -3485,6 +3482,7 @@ void do_credits(void)
|
||||
"Richard Kolb II",
|
||||
NULL, /* "The Free Software Foundation" */
|
||||
"Linus Torvalds",
|
||||
NULL, /* "the many translators and the TP" */
|
||||
NULL, /* "For ncurses:" */
|
||||
"Thomas Dickey",
|
||||
"Pavel Curtis",
|
||||
@@ -3496,7 +3494,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"(C) 1999 - 2014",
|
||||
"(C) 1999 - 2015",
|
||||
"Free Software Foundation, Inc.",
|
||||
"",
|
||||
"",
|
||||
@@ -3511,20 +3509,12 @@ void do_credits(void)
|
||||
N_("Brought to you by:"),
|
||||
N_("Special thanks to:"),
|
||||
N_("The Free Software Foundation"),
|
||||
N_("the many translators and the TP"),
|
||||
N_("For ncurses:"),
|
||||
N_("and anyone else we forgot..."),
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user