I'm new in clojure programming. I'm using vim editor. I have installed vim-clojure-static plugin to write better code. But It's not working as I expected. I want two spaces indentation for every special keyword.
For example, Here is core.clj file.
(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)))))
This is defualt indentation. I don't like this. I want my code should look like:
(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)))))
It means, I want two spaces indentation for every special keyword i.e try in given example.
Meanwhile I'm not sure, Whether I have installed *plugin in correct way. Here is my .vim directory structure:
$ 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
Here is my vimrc file:
$ cat ~/.vimrc
set autoindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
execute pathogen#infect()
syntax on
filetype plugin indent on
can anyone tell me, Where I'm wrong? How can I make autoindent with spaces *two? Thanks.
according to the documentation here: https://github.com/guns/vim-clojure-static,
you need to add the try
keyword to the list with a command like
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let', '^try']
I hope it will help, I didn't try it