blob: 2fe3a6251dd2ab64b53c97402a82a3a5e3b64d57 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
(in-package #:nyxt-user)
;;;; This is a configuration for the Ace editor Nyxt integration
;;;; (https://github.com/atlas-engineer/nx-ace).
(define-configuration nx-ace:ace-mode
((nx-ace:extensions
(mapcar
(lambda (name)
(quri:merge-uris (quri:uri name)
(quri:uri "https://cdnjs.cloudflare.com/ajax/libs/ace/1.9.6/")))
'("keybinding-emacs.min.js"
;; Themes
"theme-twilight.min.js"
"theme-github.min.js"
;; Language modes
"mode-c_cpp.min.js"
"mode-asciidoc.min.js"
"mode-clojure.min.js"
"mode-csharp.min.js"
"mode-css.min.js"
"mode-diff.min.js"
"mode-dot.min.js"
"mode-forth.min.js"
"mode-fsharp.min.js"
"mode-gitignore.min.js"
"mode-glsl.min.js"
"mode-golang.min.js"
"mode-haskell.min.js"
"mode-html.min.js"
"mode-ini.min.js"
"mode-java.min.js"
"mode-javascript.min.js"
"mode-json.min.js"
"mode-jsx.min.js"
"mode-julia.min.js"
"mode-kotlin.min.js"
"mode-latex.min.js"
"mode-lisp.min.js"
"mode-lua.min.js"
"mode-makefile.min.js"
"mode-markdown.min.js"
"mode-mediawiki.min.js"
"mode-nix.min.js"
"mode-objectivec.min.js"
"mode-perl.min.js"
"mode-plain_text.min.js"
"mode-python.min.js"
"mode-r.min.js"
"mode-robot.min.js"
"mode-ruby.min.js"
"mode-rust.min.js"
"mode-scala.min.js"
"mode-scheme.min.js"
"mode-sh.min.js"
"mode-snippets.min.js"
"mode-sql.min.js"
"mode-svg.min.js"
"mode-tex.min.js"
"mode-text.min.js"
"mode-tsx.min.js"
"mode-typescript.min.js"
"mode-xml.min.js"
"mode-yaml.min.js"
;; Snippets
"snippets/c_cpp.min.js"
"snippets/css.min.js"
"snippets/html.min.js"
"snippets/javascript.min.js"
"snippets/json.min.js"
"snippets/latex.min.js"
"snippets/lisp.min.js"
"snippets/makefile.min.js"
"snippets/markdown.min.js"
"snippets/plain_text.min.js"
"snippets/python.min.js"
"snippets/scheme.min.js"
"snippets/snippets.min.js"
"snippets/tex.min.js"
"snippets/text.min.js"
"snippets/yaml.min.js"
;; Language Workers
"worker-base.min.js"
"worker-css.min.js"
"worker-html.min.js"
"worker-javascript.min.js"
"worker-json.min.js"
"worker-xml.min.js"
"worker-yaml.min.js"
;; Extensions
"ext-language_tools.min.js"
"ext-emmet.min.js"
"ext-keybinding_menu.min.js"
"ext-modelist.min.js"
"ext-searchbox.min.js"
"ext-settings_menu.min.js"
"ext-themelist.min.js"
"ext-beautify.min.js"
"ext-prompt.min.js"
"ext-split.min.js"
"ext-whitespace.min.js"
"ext-statusbar.min.js")))))
(define-configuration nx-ace:ace-mode
((nx-ace::theme "ace/theme/twilight")
(nx-ace::keybindings "ace/keyboard/emacs")))
(define-configuration nx-ace:ace-mode
((nx-ace:epilogue
(str:concat
(ps:ps
(flet ((req (ext)
(ps:chain ace (require ext)))
(bind (key command)
(ps:chain editor commands (bind-key key command))))
(req "ace/ext/searchbox")
(req "ace/ext/split")
(req "ace/ext/themelist")
(req "ace/ext/emmet")
(req "ace/ext/language_tools")
(req "ace/worker/javascript")
(ps:chain editor (set-option "fontSize" 18))
(ps:chain editor (set-option "enableBasicAutocompletion" t))
(ps:chain editor (set-option "enableSnippets" t))
(ps:chain editor session
(set-mode (ps:chain (req "ace/ext/modelist")
(get-mode-for-path (ps:@ window location href)) mode)))
(bind "Shift-space" "setMark")
(bind "Ctrl-\\" "toggleFoldWidget")
(bind "Ctrl-c ;" "toggleComment")
(bind "Ctrl-Alt-b" "jumptomatching")
(bind "Ctrl-Alt-f" "jumptomatching")
(bind "Alt-space" "expandToMatching")
(bind "Alt-%" "replace")
(req "ace/ext/split")
(ps:chain (req "ace/ext/settings_menu") (init editor))
(ps:chain (req "ace/ext/keybinding_menu") (init editor))
(bind "Ctrl-h m" (lambda (editor)
(ps:chain editor (show-keyboard-shortcuts))))
(bind "C-i" "indent")
(ps:chain editor commands
(add-command (ps:chain ace (require "ace/ext/beautify") commands 0)))))))))
(define-configuration nx-ace:ace-mode
((style (str:concat
%slot-value%
(theme:themed-css (theme *browser*)
`("#kbshortcutmenu"
:background-color ,theme:background
:color ,theme:on-background))))
(nx-ace::keybindings "ace/keyboard/emacs")))
(define-configuration :editor-buffer
((default-modes `(nx-ace:ace-mode ,@%slot-value%))))
|