Extensible defun indents

Create issue
Issue #94 resolved
Raynes created an issue

Emacs has a variable that you can change to add more names to the list of things that should be indented like 'defn'. This would be useful (and I imagine possible) for VimClojure. For example, right now, deftest is treated like everything else.

{{{ #!clojure

(deftest example-test foo) }}}

Should be indented as

{{{ #!clojure

(deftest example-test foo) }}}

You could, of course, bake this in, but you can't bake in every var that anyone will ever define. Emacs automatically indents names that begin with 'def' like this, which I think is a decent approach. I believe it does the same for things that start with 'with'.


Comments (2)

  1. Meikel Brandmeyer repo owner

    This is already implemented. It's called “fuzzy indent”.

        let vimclojure#FuzzyIndent = 1

    This will turn on defn indentation for symbols (even if fully qualified or with namespace alias) starting in def or with.

    In general VimClojure supports the lispwords option. There you can add symbols the fuzzy option does not cover. Eg. – when you work a lot with core.logic – in after/ftplugin/clojure.vim:

        setlocal lispwords+=fresh

    VimClojure also provides <LocalLeader>aw to add the word under the cursor to lispwords. However this is sometimes “forgotten” by vim. Eg. when reloading the buffer from the source file because Vim thinks it has changed on the hard drive.

  2. Log in to comment