16. A complete init.clj example

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

;; Select layers (omitting this enables all).
(configuration-layers!
  [:tree-sitter :lsp :treemacs :git :helm
   :clojure :cider :cpp :java :javascript :html :css :markdown])

;; Editing
(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)

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

;; GUI fonts (ignored by 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"])

;; Completion / 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"}}}}})

;; Project tree
(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)

;; Keys and hooks
(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))
代码

Raw Markdown: coxn manual (Markdown) · Installers: coxn product page