Skip to content

Commit

Permalink
Fix / improve localleader defaulting in the school
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Feb 2, 2024
1 parent 8ba9bb0 commit 8002dfb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
22 changes: 12 additions & 10 deletions fnl/conjure/school.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@
(nvim.ex.autocmd "BufNewFile,BufRead *.fnl setlocal filetype=clojure")
(nvim.ex.augroup :END))

(let [buf (upsert-buf)]
(let [maplocalleader-was-unset?
(when (and (= "<localleader>" (config.get-in [:mapping :prefix]))
(a.empty? nvim.g.maplocalleader))
(set nvim.g.maplocalleader ",")
true)

buf (upsert-buf)]
(nvim.ex.edit buf-name)
(nvim.buf_set_lines buf 0 -1 false [])
(append
(a.concat
["(module user.conjure-school"
" {require {school conjure.school}})"
" {require {school conjure.school}})"
""
";; Welcome to Conjure school!"
";; Grab yourself a nice beverage and let's get evaluating. I hope you enjoy!"
Expand All @@ -66,14 +72,10 @@
";; You can learn how to change these mappings with :help conjure-mappings"
""
(.. ";; Let's begin by evaluating the whole buffer using " (map-str :eval_buf))]
(when (= "<localleader>" (config.get-in [:mapping :prefix]))
(if (a.empty? nvim.g.maplocalleader)
(do
(set nvim.g.maplocalleader ",")
(nvim.ex.edit)
[";; Your <localleader> wasn't configured so I've defaulted it to comma (,) for now."
";; See :help localleader for more information. (let maplocalleader=\",\")"])
[(.. ";; Your <localleader> is currently mapped to \"" nvim.g.maplocalleader "\"")]))
(if maplocalleader-was-unset?
[";; Your <localleader> wasn't configured so I've defaulted it to comma (,) for now."
";; See :help localleader for more information. (let maplocalleader=\",\")"]
[(.. ";; Your <localleader> is currently mapped to \"" nvim.g.maplocalleader "\"")])
["(school.lesson-1)"]))))

(defn lesson-1 []
Expand Down
23 changes: 12 additions & 11 deletions lua/conjure/school.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8002dfb

Please sign in to comment.