我是clojure编程的新手。我正在使用vim编辑器。我已经安装了vim-clojure-static插件来编写更好的代码。但它没有像我预期的那样工作。我希望每个特殊关键字都有两个空格缩进。
例如,这里是core.clj文件。
(ns hello.core
(:gen-class)
(:import
(java.io FileNotFoundException)))
(defn -main
[& args]
(println "Hello, World!")
(try (slurp (first args))
(catch FileNotFoundException e (println (.getMessage e)))))
这是默认缩进。我不喜欢这个。我希望我的代码看起来像:
(ns hello.core
(:gen-class)
(:import
(java.io FileNotFoundException)))
(defn -main
[& args]
(println "Hello, World!")
(try (slurp (first args))
(catch FileNotFoundException e (println (.getMessage e)))))
这意味着,我希望每个特殊关键字都有两个空格缩进,即在给定的示例中 尝试。
同时我不确定,我是否以正确的方式安装了*plugin。这是我的.vim目录结构:
$ tree ~/.vim/
/home/james/.vim/
|-- autoload
| `-- pathogen.vim
`-- bundle
`-- vim-clojure-static
|-- autoload
| `-- clojurecomplete.vim
|-- clj
| |-- dev-resources
| | |-- test-basic-sexp-indent.txt
| | |-- test-inherit-indent.in
| | |-- test-inherit-indent.out
| | |-- test-multibyte-indent.txt
| | |-- test-reader-conditional-indent.in
| | |-- test-reader-conditional-indent.out
| | |-- test-side-effects-in-indentexpr.in
| | `-- test-side-effects-in-indentexpr.out
| |-- project.clj
| |-- src
| | `-- vim_clojure_static
| | |-- generate.clj
| | `-- test.clj
| |-- test
| | `-- vim_clojure_static
| | |-- indent_test.clj
| | `-- syntax_test.clj
| `-- vim
| `-- test-runtime.vim
|-- doc
| `-- clojure.txt
|-- ftdetect
| `-- clojure.vim
|-- ftplugin
| `-- clojure.vim
|-- indent
| `-- clojure.vim
|-- LICENSE.txt
|-- README.markdown
`-- syntax
`-- clojure.vim
16 directories, 23 files
这是我的vimrc文件:
$ cat ~/.vimrc
set autoindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
execute pathogen#infect()
syntax on
filetype plugin indent on
谁能告诉我,我错在哪里?如何使用空格*two进行自动缩进?谢谢。