Update nanorcs, handle nano differently on Darwin.

This commit is contained in:
Darren 'Tadgy' Austin 2023-09-30 15:31:26 +01:00
commit 0a1f6927f0
5 changed files with 122 additions and 30 deletions

14
.bashrc
View file

@ -353,13 +353,15 @@ if [[ "$PLATFORM" = "Linux" ]]; then
hash pinfo >/dev/null 2>&1 && alias info='pinfo' hash pinfo >/dev/null 2>&1 && alias info='pinfo'
hash ping >/dev/null 2>&1 && alias ping='ping -b' hash ping >/dev/null 2>&1 && alias ping='ping -b'
elif [[ "$PLATFORM" = "Darwin" ]]; then elif [[ "$PLATFORM" = "Darwin" ]]; then
# Create .nanorc symlink if necessary. # Darwin specific functions.
[[ ! -e "$HOME/.nanorc" ]] && { hash nano >/dev/null 2>&1 && nano() {
NANO_VER="$(command nano --version | awk '/version/ { print $4 }' | cut -d. -f1)" if [[ -f "$HOME/.nanorc-darwin" ]]; then
if [[ -f "$HOME/.nanorc-$NANO_VER" ]]; then ( cd "$HOME" && ln -sf ".nanorc-darwin" ".nanorc" )
( cd "$HOME" && ln -sf ".nanorc-$NANO_VER" .nanorc ) || printf "%s: %s\\n" "${BASH_SOURCE##*/}" "failed to create .nanorc symlink" >&2 command nano "$@"
rm -f "$HOME/.nanorc"
else else
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "no .nanorc for version '$NANO_VER'" >&2 printf "%s: %s\\n" "${FUNCNAME[0]}" "no .nanorc-darwin found" >&2
return 1
fi fi
} }

View file

@ -16,7 +16,10 @@
## ", ', ), >, ], and }. ## ", ', ), >, ], and }.
## Use auto-indentation. ## Use auto-indentation.
# set autoindent set autoindent
## When saving a file, create a backup file by adding a tilde (~).
# set backup
## Do case-sensitive searches by default. ## Do case-sensitive searches by default.
# set casesensitive # set casesensitive
@ -27,12 +30,6 @@ set fill -2
## Remember the used search/replace strings for the next session. ## Remember the used search/replace strings for the next session.
set historylog set historylog
## When justifying text, trailing whitespace will automatically be removed.
set justifytrim
## Enable vim-style lock-files.
set locking
## Use the blank line below the titlebar as extra editing space. ## Use the blank line below the titlebar as extra editing space.
set morespace set morespace
@ -45,9 +42,6 @@ set nohelp
## Don't wrap text at all. ## Don't wrap text at all.
set nowrap set nowrap
## Save the cursor position of files between editing sessions.
# set positionlog
## Do quick statusbar blanking. ## Do quick statusbar blanking.
set quickblank set quickblank
@ -60,9 +54,6 @@ set smarthome
## Use smooth scrolling as the default. ## Use smooth scrolling as the default.
set smooth set smooth
## Enable soft line wrapping (AKA full-line display).
# set softwrap
## Use this spelling checker instead of the internal one. ## Use this spelling checker instead of the internal one.
set speller "aspell -x -c" set speller "aspell -x -c"
@ -70,21 +61,41 @@ set speller "aspell -x -c"
set suspend set suspend
## The two characters used to indicate the presence of tabs and spaces. ## The two characters used to indicate the presence of tabs and spaces.
# set whitespace >. set whitespace »·
## Detect word boundaries more accurately by treating punctuation characters as parts of words. ## Detect word boundaries more accurately by treating punctuation characters as parts of words.
set wordbounds set wordbounds
## Interface colours.
set functioncolor magenta
set keycolor brightwhite
set statuscolor magenta
set titlecolor magenta
## Include all existing syntax highlight definitions. ## Include all existing syntax highlight definitions.
include "/usr/share/nano/*.nanorc" include "/usr/share/nano/asm.nanorc"
include "/usr/share/nano/awk.nanorc"
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/cmake.nanorc"
include "/usr/share/nano/css.nanorc"
include "/usr/share/nano/debian.nanorc"
include "/usr/share/nano/fortran.nanorc"
include "/usr/share/nano/gentoo.nanorc"
include "/usr/share/nano/groff.nanorc"
include "/usr/share/nano/html.nanorc"
include "/usr/share/nano/java.nanorc"
include "/usr/share/nano/makefile.nanorc"
include "/usr/share/nano/man.nanorc"
include "/usr/share/nano/mgp.nanorc"
include "/usr/share/nano/mutt.nanorc"
include "/usr/share/nano/nanorc.nanorc"
include "/usr/share/nano/objc.nanorc"
include "/usr/share/nano/ocaml.nanorc"
include "/usr/share/nano/patch.nanorc"
include "/usr/share/nano/perl.nanorc"
include "/usr/share/nano/php.nanorc"
include "/usr/share/nano/pov.nanorc"
include "/usr/share/nano/python.nanorc"
include "/usr/share/nano/ruby.nanorc"
include "/usr/share/nano/sh.nanorc"
include "/usr/share/nano/tcl.nanorc"
include "/usr/share/nano/tex.nanorc"
include "/usr/share/nano/xml.nanorc"
## Key bindings. ## Key bindings.

View file

@ -60,7 +60,7 @@ set nohelp
## Don't add newlines to the ends of files. ## Don't add newlines to the ends of files.
# set nonewlines # set nonewlines
# Save the cursor position of files between editing sessions. ## Save the cursor position of files between editing sessions.
# set positionlog # set positionlog
## Do quick statusbar blanking. ## Do quick statusbar blanking.

View file

@ -60,7 +60,7 @@ set nohelp
## Don't add newlines to the ends of files. ## Don't add newlines to the ends of files.
# set nonewlines # set nonewlines
# Save the cursor position of files between editing sessions. ## Save the cursor position of files between editing sessions.
# set positionlog # set positionlog
## Do quick statusbar blanking. ## Do quick statusbar blanking.

79
.nanorc-darwin Normal file
View file

@ -0,0 +1,79 @@
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
##
## To make sure an option is disabled, use "unset <option>".
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
##
## Quotes inside 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 "brackets" option, ""')>]}" will match
## ", ', ), >, ], and }.
## Use auto-indentation.
set autoindent
## When saving a file, create a backup file by adding a tilde (~).
# set backup
## Do case-sensitive searches by default.
# set casesensitive
## Set the line length for wrapping text and justifying paragraphs.
set fill -2
## Remember the used search/replace strings for the next session.
set historylog
## Use the blank line below the titlebar as extra editing space.
set morespace
## Don't display the helpful shortcut lists at the bottom of the screen.
set nohelp
## Don't add newlines to the ends of files.
# set nonewlines
## Don't wrap text at all.
set nowrap
## Do quick statusbar blanking.
set quickblank
## Do extended regular expression searches by default.
# set regexp
## Make the Home key smarter.
set smarthome
## Use smooth scrolling as the default.
set smooth
## Use this spelling checker instead of the internal one.
set speller "aspell -x -c"
## Allow nano to be suspended.
set suspend
## The two characters used to indicate the presence of tabs and spaces.
set whitespace »·
## Detect word boundaries more accurately by treating punctuation characters as parts of words.
set wordbounds
## Key bindings.
## The following five functions are not bound to any key by default.
## You may wish to choose different keys than the ones suggested here.
# bind ^S savefile main
# bind M-Q findprevious main
# bind M-W findnext main
# bind M-B cutwordleft main
# bind M-N cutwordright main
## Set this if your Backspace key sends Del most of the time.
# bind Del backspace all