Skip to content

Commit 7cd6e17

Browse files
committed
nano: add configuration
1 parent 4ba452f commit 7cd6e17

11 files changed

+441
-12
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[submodule ".dotbot"]
22
path = .dotbot
33
url = https://github.com/anishathalye/dotbot
4+
[submodule "nano/syntax-highlighting"]
5+
path = nano/syntax-highlighting
6+
url = https://github.com/scopatz/nanorc.git
7+
[submodule "scripts/log"]
8+
path = scripts/log
9+
url = https://github.com/bownie/bashlog

.install.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
~/.gitconfig: git/config
99
~/.gitconfig.canonical: git/config.canonical
1010

11-
~/.hushlogin:
11+
~/.hushlogin:
12+
13+
~/.config/nano/nanorc: nano/nanorc
14+
~/.config/nano/syntax-highlighting: nano/syntax-highlighting

.shellcheckrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
external-sources=true

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"files.associations": {
33
"git/config*": "gitconfig",
44
"git/ignore": "ignore"
5-
}
5+
},
6+
"editor.rulers": [80,160],
67
}

install

-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#!/usr/bin/env bash
22
set -e;
3-
pushd . > '/dev/null';
4-
repo_dir="${BASH_SOURCE[0]:-$0}";
5-
while [ -h "${repo_dir}" ]; do
6-
cd "$(dirname -- "${repo_dir}")";
7-
repo_dir="$(readlink -f -- "${repo_dir}")";
8-
done;
9-
10-
cd "$(dirname -- "${repo_dir}")" > '/dev/null';
11-
repo_dir="$(pwd)";
12-
popd > '/dev/null';
133

144
config="${repo_dir}/.install.yaml";
155
dotbot_dir="${repo_dir}/.dotbot";

nano/nanorc

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Nano's ANOther editor configuration
2+
# 📂 ~/.config/nano/nanorc
3+
4+
5+
#################
6+
# Functionality #
7+
#################
8+
# Permit suspending nano with ^Z.
9+
set suspend
10+
11+
# Maintain a log of history for the file using `{filename}~`.
12+
set historylog
13+
14+
# Disable line wrapping.
15+
#set nowrap
16+
17+
# Preserve the XON ^Q and XOFF ^S keys for the terminal.
18+
set preserve
19+
20+
# Disable massive shortcut help block from the bottom of the interface.
21+
set nohelp
22+
23+
###########
24+
# Writing #
25+
###########
26+
# Configure dictionary.
27+
set speller "aspell"
28+
29+
# Configure tabination.
30+
set tabstospaces
31+
set tabsize 4
32+
33+
# Automatically indent newlines based upon the prior line indentation.
34+
set autoindent
35+
36+
# Keep original end-of-line formatting.
37+
set noconvert
38+
39+
# Detect word boundaries more accurately by treating punctuation characters as
40+
# part of a word.
41+
set wordbounds
42+
43+
# [DEL] and [BACKSPACE] zaps marked regions.
44+
set zap
45+
46+
# Configure bracket matching.
47+
set brackets ""')>]}"
48+
set matchbrackets "(<[{)>]}"
49+
50+
# Configure punctuation.
51+
set punct "!.?"
52+
53+
##############
54+
# Navigation #
55+
##############
56+
# Enable mouse support.
57+
set mouse
58+
59+
# Constantly show the position of the cursor in the status bar.
60+
set constantshow
61+
62+
# Display line-numbering.
63+
set linenumbers
64+
65+
# Home key jumps to the first non-whitespace character.
66+
# Second key-press jumps to the start of the line.
67+
set smarthome
68+
69+
# Use regular expressions for searching.
70+
set regexp
71+
72+
#########################
73+
# User interface colors #
74+
#########################
75+
set errorcolor brightwhite,red
76+
set functioncolor green
77+
set keycolor cyan
78+
set numbercolor cyan
79+
set selectedcolor brightwhite,magenta
80+
set statuscolor cyan
81+
set stripecolor ,yellow
82+
set titlecolor brightwhite,blue
83+
84+
# Enable bold characters.
85+
set boldtext
86+
87+
#######################
88+
# Syntax highlighting #
89+
#######################
90+
include "/home/jlettman/.dot/nano/syntax-highlighting/nginx.nanorc"
91+
include "/home/jlettman/.dot/nano/syntax-highlighting/js.nanorc"
92+
include "/home/jlettman/.dot/nano/syntax-highlighting/apacheconf.nanorc"
93+
include "/home/jlettman/.dot/nano/syntax-highlighting/jade.nanorc"
94+
include "/home/jlettman/.dot/nano/syntax-highlighting/keymap.nanorc"
95+
include "/home/jlettman/.dot/nano/syntax-highlighting/scala.nanorc"
96+
include "/home/jlettman/.dot/nano/syntax-highlighting/xml.nanorc"
97+
include "/home/jlettman/.dot/nano/syntax-highlighting/reST.nanorc"
98+
include "/home/jlettman/.dot/nano/syntax-highlighting/csh.nanorc"
99+
include "/home/jlettman/.dot/nano/syntax-highlighting/markdown.nanorc"
100+
include "/home/jlettman/.dot/nano/syntax-highlighting/sparql.nanorc"
101+
include "/home/jlettman/.dot/nano/syntax-highlighting/cython.nanorc"
102+
include "/home/jlettman/.dot/nano/syntax-highlighting/c.nanorc"
103+
include "/home/jlettman/.dot/nano/syntax-highlighting/rego.nanorc"
104+
include "/home/jlettman/.dot/nano/syntax-highlighting/privoxy.nanorc"
105+
include "/home/jlettman/.dot/nano/syntax-highlighting/vi.nanorc"
106+
include "/home/jlettman/.dot/nano/syntax-highlighting/go.nanorc"
107+
include "/home/jlettman/.dot/nano/syntax-highlighting/conky.nanorc"
108+
include "/home/jlettman/.dot/nano/syntax-highlighting/tex.nanorc"
109+
include "/home/jlettman/.dot/nano/syntax-highlighting/systemd.nanorc"
110+
include "/home/jlettman/.dot/nano/syntax-highlighting/conf.nanorc"
111+
include "/home/jlettman/.dot/nano/syntax-highlighting/email.nanorc"
112+
include "/home/jlettman/.dot/nano/syntax-highlighting/glsl.nanorc"
113+
include "/home/jlettman/.dot/nano/syntax-highlighting/batch.nanorc"
114+
include "/home/jlettman/.dot/nano/syntax-highlighting/zsh.nanorc"
115+
include "/home/jlettman/.dot/nano/syntax-highlighting/Dockerfile.nanorc"
116+
include "/home/jlettman/.dot/nano/syntax-highlighting/perl6.nanorc"
117+
include "/home/jlettman/.dot/nano/syntax-highlighting/gentoo.nanorc"
118+
include "/home/jlettman/.dot/nano/syntax-highlighting/haml.nanorc"
119+
include "/home/jlettman/.dot/nano/syntax-highlighting/tcl.nanorc"
120+
include "/home/jlettman/.dot/nano/syntax-highlighting/sls.nanorc"
121+
include "/home/jlettman/.dot/nano/syntax-highlighting/ini.nanorc"
122+
include "/home/jlettman/.dot/nano/syntax-highlighting/json.nanorc"
123+
include "/home/jlettman/.dot/nano/syntax-highlighting/asm.nanorc"
124+
include "/home/jlettman/.dot/nano/syntax-highlighting/php.nanorc"
125+
include "/home/jlettman/.dot/nano/syntax-highlighting/python.nanorc"
126+
include "/home/jlettman/.dot/nano/syntax-highlighting/peg.nanorc"
127+
include "/home/jlettman/.dot/nano/syntax-highlighting/Rnw.nanorc"
128+
include "/home/jlettman/.dot/nano/syntax-highlighting/pkg-config.nanorc"
129+
include "/home/jlettman/.dot/nano/syntax-highlighting/sed.nanorc"
130+
include "/home/jlettman/.dot/nano/syntax-highlighting/pug.nanorc"
131+
include "/home/jlettman/.dot/nano/syntax-highlighting/dot.nanorc"
132+
include "/home/jlettman/.dot/nano/syntax-highlighting/svn.nanorc"
133+
include "/home/jlettman/.dot/nano/syntax-highlighting/verilog.nanorc"
134+
include "/home/jlettman/.dot/nano/syntax-highlighting/awk.nanorc"
135+
include "/home/jlettman/.dot/nano/syntax-highlighting/csv.nanorc"
136+
include "/home/jlettman/.dot/nano/syntax-highlighting/zshrc.nanorc"
137+
include "/home/jlettman/.dot/nano/syntax-highlighting/csharp.nanorc"
138+
include "/home/jlettman/.dot/nano/syntax-highlighting/powershell.nanorc"
139+
include "/home/jlettman/.dot/nano/syntax-highlighting/genie.nanorc"
140+
include "/home/jlettman/.dot/nano/syntax-highlighting/makefile.nanorc"
141+
include "/home/jlettman/.dot/nano/syntax-highlighting/xresources.nanorc"
142+
include "/home/jlettman/.dot/nano/syntax-highlighting/arduino.nanorc"
143+
include "/home/jlettman/.dot/nano/syntax-highlighting/swift.nanorc"
144+
include "/home/jlettman/.dot/nano/syntax-highlighting/git.nanorc"
145+
include "/home/jlettman/.dot/nano/syntax-highlighting/javascript.nanorc"
146+
include "/home/jlettman/.dot/nano/syntax-highlighting/cmake.nanorc"
147+
include "/home/jlettman/.dot/nano/syntax-highlighting/pkgbuild.nanorc"
148+
include "/home/jlettman/.dot/nano/syntax-highlighting/inputrc.nanorc"
149+
include "/home/jlettman/.dot/nano/syntax-highlighting/fortran.nanorc"
150+
include "/home/jlettman/.dot/nano/syntax-highlighting/prolog.nanorc"
151+
include "/home/jlettman/.dot/nano/syntax-highlighting/creole.nanorc"
152+
include "/home/jlettman/.dot/nano/syntax-highlighting/dotenv.nanorc"
153+
include "/home/jlettman/.dot/nano/syntax-highlighting/kickstart.nanorc"
154+
include "/home/jlettman/.dot/nano/syntax-highlighting/lua.nanorc"
155+
include "/home/jlettman/.dot/nano/syntax-highlighting/asciidoc.nanorc"
156+
include "/home/jlettman/.dot/nano/syntax-highlighting/lisp.nanorc"
157+
include "/home/jlettman/.dot/nano/syntax-highlighting/octave.nanorc"
158+
include "/home/jlettman/.dot/nano/syntax-highlighting/colortest.nanorc"
159+
include "/home/jlettman/.dot/nano/syntax-highlighting/twig.nanorc"
160+
include "/home/jlettman/.dot/nano/syntax-highlighting/mpdconf.nanorc"
161+
include "/home/jlettman/.dot/nano/syntax-highlighting/nmap.nanorc"
162+
include "/home/jlettman/.dot/nano/syntax-highlighting/rust.nanorc"
163+
include "/home/jlettman/.dot/nano/syntax-highlighting/java.nanorc"
164+
include "/home/jlettman/.dot/nano/syntax-highlighting/patch.nanorc"
165+
include "/home/jlettman/.dot/nano/syntax-highlighting/yum.nanorc"
166+
include "/home/jlettman/.dot/nano/syntax-highlighting/toml.nanorc"
167+
include "/home/jlettman/.dot/nano/syntax-highlighting/hcl.nanorc"
168+
include "/home/jlettman/.dot/nano/syntax-highlighting/clojure.nanorc"
169+
include "/home/jlettman/.dot/nano/syntax-highlighting/puppet.nanorc"
170+
include "/home/jlettman/.dot/nano/syntax-highlighting/ical.nanorc"
171+
include "/home/jlettman/.dot/nano/syntax-highlighting/kotlin.nanorc"
172+
include "/home/jlettman/.dot/nano/syntax-highlighting/perl.nanorc"
173+
include "/home/jlettman/.dot/nano/syntax-highlighting/x11basic.nanorc"
174+
include "/home/jlettman/.dot/nano/syntax-highlighting/i3.nanorc"
175+
include "/home/jlettman/.dot/nano/syntax-highlighting/yaml.nanorc"
176+
include "/home/jlettman/.dot/nano/syntax-highlighting/properties.nanorc"
177+
include "/home/jlettman/.dot/nano/syntax-highlighting/sh.nanorc"
178+
include "/home/jlettman/.dot/nano/syntax-highlighting/erb.nanorc"
179+
include "/home/jlettman/.dot/nano/syntax-highlighting/ocaml.nanorc"
180+
include "/home/jlettman/.dot/nano/syntax-highlighting/html.j2.nanorc"
181+
include "/home/jlettman/.dot/nano/syntax-highlighting/po.nanorc"
182+
include "/home/jlettman/.dot/nano/syntax-highlighting/rpmspec.nanorc"
183+
include "/home/jlettman/.dot/nano/syntax-highlighting/vala.nanorc"
184+
include "/home/jlettman/.dot/nano/syntax-highlighting/groff.nanorc"
185+
include "/home/jlettman/.dot/nano/syntax-highlighting/css.nanorc"
186+
include "/home/jlettman/.dot/nano/syntax-highlighting/ts.nanorc"
187+
include "/home/jlettman/.dot/nano/syntax-highlighting/zig.nanorc"
188+
include "/home/jlettman/.dot/nano/syntax-highlighting/etc-hosts.nanorc"
189+
include "/home/jlettman/.dot/nano/syntax-highlighting/moonscript.nanorc"
190+
include "/home/jlettman/.dot/nano/syntax-highlighting/m3u.nanorc"
191+
include "/home/jlettman/.dot/nano/syntax-highlighting/haskell.nanorc"
192+
include "/home/jlettman/.dot/nano/syntax-highlighting/gradle.nanorc"
193+
include "/home/jlettman/.dot/nano/syntax-highlighting/fsharp.nanorc"
194+
include "/home/jlettman/.dot/nano/syntax-highlighting/sql.nanorc"
195+
include "/home/jlettman/.dot/nano/syntax-highlighting/coffeescript.nanorc"
196+
include "/home/jlettman/.dot/nano/syntax-highlighting/gitcommit.nanorc"
197+
include "/home/jlettman/.dot/nano/syntax-highlighting/ruby.nanorc"
198+
include "/home/jlettman/.dot/nano/syntax-highlighting/elixir.nanorc"
199+
include "/home/jlettman/.dot/nano/syntax-highlighting/fish.nanorc"
200+
include "/home/jlettman/.dot/nano/syntax-highlighting/html.nanorc"
201+
include "/home/jlettman/.dot/nano/syntax-highlighting/nanorc.nanorc"
202+
include "/home/jlettman/.dot/nano/syntax-highlighting/man.nanorc"
203+
include "/home/jlettman/.dot/nano/syntax-highlighting/ledger.nanorc"
204+
include "/home/jlettman/.dot/nano/syntax-highlighting/pov.nanorc"

nano/syntax-highlighting

Submodule syntax-highlighting added at 1aa64a8

scripts/_utils.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import difflib
3+
from pathlib import Path
4+
5+
scripts_dir = Path(os.path.dirname(__file__))
6+
repo_dir = scripts_dir.joinpath('..').resolve()
7+
8+
9+
def diff(string_list: str,
10+
index_a: int = 0,
11+
index_b: int | None = None) -> str:
12+
"""
13+
Return a color-coded diff of two items in a list of strings.
14+
"""
15+
index_b = index_b or len(string_list) - 1
16+
green = '\x1b[38;5;16;48;5;2m'
17+
red = '\x1b[38;5;16;48;5;1m'
18+
end = '\x1b[0m'
19+
output = []
20+
string_a = string_list[index_a]
21+
string_b = string_list[index_b]
22+
matcher = difflib.SequenceMatcher(None, string_a, string_b)
23+
for opcode, a0, a1, b0, b1 in matcher.get_opcodes():
24+
if opcode == "equal":
25+
output += [string_a[a0:a1]]
26+
elif opcode == "insert":
27+
output += [green + string_b[b0:b1] + end]
28+
elif opcode == "delete":
29+
output += [red + string_a[a0:a1] + end]
30+
elif opcode == "replace":
31+
output += [green + string_b[b0:b1] + end]
32+
output += [red + string_a[a0:a1] + end]
33+
34+
return "".join(output)

scripts/_utils.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
set -e;
3+
set -u;
4+
set -o pipefail;
5+
6+
# shellcheck source=SCRIPTDIR/log/log.sh
7+
scripts_dir="$(dirname "$(realpath "${BASH_SOURCE[0]:-$0}")")";
8+
9+
source "${scripts_dir}/log/log.sh";
10+
11+
prev_dir="$(pwd)";
12+
repo_dir="${scripts_dir}/../";
13+
14+
pushd . >'/dev/null' || \
15+
log debug "Unable to push previous directory. No problem.";
16+
17+
# while the path refers to a symbolic link,
18+
# read the link until we achieve the real path
19+
while [ -h "${repo_dir}" ]; do
20+
cd "$(dirname -- "${repo_dir}")" || {
21+
log error "Unable to change directories; something is wrong!";
22+
exit 1;
23+
};
24+
25+
repo_dir="$(readlink -f -- "${repo_dir}")";
26+
done;
27+
28+
# return to the previous directory prior to these operations
29+
popd >'/dev/null' || cd "${prev_dir}" || {
30+
log error \
31+
"Unable to return to prior directory!" \
32+
"Prior directory: ${prev_dir}";
33+
};
34+
35+
unset prev_dir;
36+
export repo_dir;

scripts/log

Submodule log added at c9f6175

0 commit comments

Comments
 (0)