16. 一份完整的 init.clj 示例

clojure
;; ~/.config/coxn/init.clj

;; 选用 layer(不写 = 全开)
(configuration-layers!
  [:tree-sitter :lsp :treemacs :git :helm
   :clojure :cider :cpp :java :javascript :html :css :markdown])

;; 编辑
(set-option! :tab-width 4)
(set-option! :indent-offset 4)
(set-option! :fill-column 80)
(set-option! :electric-pair true)
(set-option! :display-line-numbers true)

;; 界面
(set-theme! :doom-dark)
(set-face! :region {:bg "#3a3a5a"})
(set-option! :minibuffer-display :bottom)
(set-option! :eldoc-display :echo)
(set-language! :zh)

;; GUI 字体(TUI 忽略)
(set-option! :gui-font ["JetBrains Mono" "Fira Code"])
(set-option! :gui-font-size 14)
(set-option! :gui-font-cjk ["Noto Sans Mono CJK SC"])

;; 补全 / LSP
(set-option! :completion-auto-delay-ms 200)
(set-option! :lsp-inlay-hints true)
(set-option! :lsp-servers {:c++ [["clangd" "--background-index" "--clang-tidy"]]})
(set-option! :lsp-settings
  {"jdtls" {:java {:inlayHints {:parameterNames {:enabled "all"}}}}})

;; 项目树
(set-option! :treemacs-width 40)
(set-option! :treemacs-follow-mode true)

;; REPL
(set-option! :cider-clojure-cli-aliases ":dev:test")
(set-option! :inferior-lisp-program "sbcl")
(set-option! :slime-completion :fuzzy)

;; 键位与钩子
(bind-key! "C-c g" 'find-file)
(add-hook! :after-save-hook
  (fn [ed] (ed/message ed "saved %s" (or (:file (ed/cur-buffer ed)) "?")) ed))
代码

原始 Markdown:coxn 使用手册(Markdown) · 安装包:coxn 产品页