1. Meikel Brandmeyer
  2. vimclojure
  3. Issues
Issue #88 resolved

Noticable delay when opening new line

Dave Ray
created an issue

To reproduce:

  • Open a new, empty Clojure buffer
  • Hit o to open a new line

There's about a one second delay before the operation completes. The same thing happens with opening a line above (shift-o). The delay seems independent of the size of content of the file. It's the same in an empty file or a 3000 line file.

I did some basic diagnosis. First note that clearing indentexpr remove the delay, and, of course, proper indenting. It's interesting that indenting by hitting enter at the end of a line has no delay.

Here's one thing I noticed: in indent/clojure.vim, add a "return 0" at the start of CheckForString(). The delay goes away. Now move the return statement to immediately after the definition of the closure function, but before the call to WithSavedPosition(). The delay returns. It's as if the definition of the closure function is the slowdown. I'm guessing there will be a similar problem with IsMethodSpecialCase().

Thoughts? I've chatted on Twitter with someone who has the same problem and I've seen it on both OSX and Linux.

Comments (4)

  1. Meikel Brandmeyer repo owner
    • changed status to open

    Wah. This issue is so old. It was reported one hundred times. And I never found this reason, because I looked for code which actually did something. *geez*

    Thanks a thousand times for tracking down the problem, Dave!

  2. Dave Ray reporter

    No problem. Just remember me when you hit it big with vimclojure :)

    ah, function("NameOfFunction") is the trick. I actually tried extracting the anonymous funcs myself, but my vimscript was weak and I couldn't get it to work.

  3. Log in to comment