Skip to content

Commit 1f43cfc

Browse files
committed
Fix / improve localleader defaulting in the school
1 parent c6d775b commit 1f43cfc

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

fnl/conjure/school.fnl

+12-10
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,19 @@
4545
(nvim.ex.autocmd "BufNewFile,BufRead *.fnl setlocal filetype=clojure")
4646
(nvim.ex.augroup :END))
4747

48-
(let [buf (upsert-buf)]
48+
(let [maplocalleader-was-unset?
49+
(when (and (= "<localleader>" (config.get-in [:mapping :prefix]))
50+
(a.empty? nvim.g.maplocalleader))
51+
(set nvim.g.maplocalleader ",")
52+
true)
53+
54+
buf (upsert-buf)]
4955
(nvim.ex.edit buf-name)
5056
(nvim.buf_set_lines buf 0 -1 false [])
5157
(append
5258
(a.concat
5359
["(module user.conjure-school"
54-
" {require {school conjure.school}})"
60+
" {require {school conjure.school}})"
5561
""
5662
";; Welcome to Conjure school!"
5763
";; Grab yourself a nice beverage and let's get evaluating. I hope you enjoy!"
@@ -66,14 +72,10 @@
6672
";; You can learn how to change these mappings with :help conjure-mappings"
6773
""
6874
(.. ";; Let's begin by evaluating the whole buffer using " (map-str :eval_buf))]
69-
(when (= "<localleader>" (config.get-in [:mapping :prefix]))
70-
(if (a.empty? nvim.g.maplocalleader)
71-
(do
72-
(set nvim.g.maplocalleader ",")
73-
(nvim.ex.edit)
74-
[";; Your <localleader> wasn't configured so I've defaulted it to comma (,) for now."
75-
";; See :help localleader for more information. (let maplocalleader=\",\")"])
76-
[(.. ";; Your <localleader> is currently mapped to \"" nvim.g.maplocalleader "\"")]))
75+
(if maplocalleader-was-unset?
76+
[";; Your <localleader> wasn't configured so I've defaulted it to comma (,) for now."
77+
";; See :help localleader for more information. (let maplocalleader=\",\")"]
78+
[(.. ";; Your <localleader> is currently mapped to \"" nvim.g.maplocalleader "\"")])
7779
["(school.lesson-1)"]))))
7880

7981
(defn lesson-1 []

lua/conjure/school.lua

+12-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)