Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
de2aa4f2
Commit
de2aa4f2
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
rcfile: add an option to customize the color of line numbers
parent
de95ca68
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
doc/man/nanorc.5
+4
-0
doc/man/nanorc.5
doc/syntax/nanorc.nanorc
+2
-2
doc/syntax/nanorc.nanorc
doc/texinfo/nano.texi
+4
-0
doc/texinfo/nano.texi
src/nano.c
+1
-0
src/nano.c
src/nano.h
+1
-0
src/nano.h
src/rcfile.c
+3
-0
src/rcfile.c
src/winio.c
+2
-2
src/winio.c
with
17 additions
and
4 deletions
+17
-4
doc/man/nanorc.5
View file @
de2aa4f2
...
...
@@ -153,6 +153,10 @@ Don't automatically add a newline to the ends of files.
.B set nowrap
Don't hard-wrap text at all.
.TP
.B set numbercolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for line numbers.
See \fBset titlecolor\fR for more details.
.TP
.B set operatingdir "\fIdirectory\fP"
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
subdirectories. Also, the current directory is changed to here, so
...
...
This diff is collapsed.
Click to expand it.
doc/syntax/nanorc.nanorc
View file @
de2aa4f2
...
...
@@ -8,8 +8,8 @@ icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|comment|ma
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cut|fill|historylog|justifytrim|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(function
color|keycolo
r|status
color
|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|wordchars)[[:space:]]+"
icolor yellow "^[[:space:]]*set[[:space:]]+(
(
function
|key|numbe
r|status|title
)
color)[[: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|
numbercolor|
operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|formatter)[[:space:]]+.*$"
...
...
This diff is collapsed.
Click to expand it.
doc/texinfo/nano.texi
View file @
de2aa4f2
...
...
@@ -731,6 +731,10 @@ Don't add newlines to the ends of files.
@item set nowrap
Don't hard-wrap text at all.
@item set numbercolor @var
{
fgcolor
}
,@var
{
bgcolor
}
Specify the color combination to use for line numbers.
See @code
{
set titlecolor
}
for more details.
@item set operatingdir "directory"
@code
{
nano
}
will only read and write files inside "directory" and its
subdirectories. Also, the current directory is changed to here, so
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
de2aa4f2
...
...
@@ -2577,6 +2577,7 @@ int main(int argc, char **argv)
set_colorpairs
();
#else
interface_color_pair
[
TITLE_BAR
]
=
hilite_attribute
;
interface_color_pair
[
LINE_NUMBER
]
=
hilite_attribute
;
interface_color_pair
[
STATUS_BAR
]
=
hilite_attribute
;
interface_color_pair
[
KEY_COMBO
]
=
hilite_attribute
;
interface_color_pair
[
FUNCTION_TAG
]
=
A_NORMAL
;
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
de2aa4f2
...
...
@@ -488,6 +488,7 @@ typedef struct subnfunc {
enum
{
TITLE_BAR
=
0
,
LINE_NUMBER
,
STATUS_BAR
,
KEY_COMBO
,
FUNCTION_TAG
,
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
de2aa4f2
...
...
@@ -111,6 +111,7 @@ static const rcoption rcopts[] = {
#endif
#ifndef DISABLE_COLOR
{
"titlecolor"
,
0
},
{
"numbercolor"
,
0
},
{
"statuscolor"
,
0
},
{
"keycolor"
,
0
},
{
"functioncolor"
,
0
},
...
...
@@ -1121,6 +1122,8 @@ void parse_rcfile(FILE *rcstream
#ifndef DISABLE_COLOR
if
(
strcasecmp
(
rcopts
[
i
].
name
,
"titlecolor"
)
==
0
)
specified_color_combo
[
TITLE_BAR
]
=
option
;
else
if
(
strcasecmp
(
rcopts
[
i
].
name
,
"numbercolor"
)
==
0
)
specified_color_combo
[
LINE_NUMBER
]
=
option
;
else
if
(
strcasecmp
(
rcopts
[
i
].
name
,
"statuscolor"
)
==
0
)
specified_color_combo
[
STATUS_BAR
]
=
option
;
else
if
(
strcasecmp
(
rcopts
[
i
].
name
,
"keycolor"
)
==
0
)
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
de2aa4f2
...
...
@@ -2278,12 +2278,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
}
/* Show the line number only for the non-softwrapped parts. */
wattron
(
edit
,
hilite_attribute
);
wattron
(
edit
,
interface_color_pair
[
LINE_NUMBER
]
);
if
(
last_drawn_line
!=
fileptr
->
lineno
||
last_line_y
>=
line
)
mvwprintw
(
edit
,
line
,
0
,
"%*i"
,
margin
-
1
,
fileptr
->
lineno
);
else
mvwprintw
(
edit
,
line
,
0
,
"%*s"
,
margin
-
1
,
" "
);
wattroff
(
edit
,
hilite_attribute
);
wattroff
(
edit
,
interface_color_pair
[
LINE_NUMBER
]
);
}
else
{
margin
=
0
;
editwincols
=
COLS
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help