繁体   English   中英

在emacs苹果酒/ paredit / clojure-mode中缩进配置

[英]indent configurations in emacs cider/paredit/clojure-mode

在Emacs / Cider设置(基于clojure-mode和paredit-mode的基础上)中,制表位通常被忽略。 或者,说他们只是缩进s表达式的第二个符号。

有时,例如对于较大的配置,最好也缩进以下符号:

这将是默认值:

(def config [:hello 34 :goodbye
             :a 34 :c
             :long-word 0 :a])

如果看起来像这样,该怎么办:

(def config [:hello      34   :goodbye
             :a          34   :c
             :long-word  0    :a])

Emacs不会按照您的意愿对齐vector中的元素,但是,您可以使用Mitab-to-tab-stop )插入制表符(或多个空格取决于您的配置)。 因此,您可以按照自己喜欢的方式手动对齐元素。

如果您可以将配置作为地图而不是向量,那么在clojure-align-forms-automatically打开clojure-align-forms-automatically时,clojure-mode会做对的事情:

(def config {:hello 34
             :goodbye [something else]
             :a [34 :c]
             :long-word 0
             :a 'b})

=>

(def config {:hello     34
             :goodbye   [something else]
             :a         [34 :c]
             :long-word 0
             :a         'b})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM