How do I setup REPL on vim?

后端 未结 11 1663
花落未央
花落未央 2021-02-06 12:14

I have installed vimclojure to make it easier to start learning clojure. But, I haven\'t been able to setup REPL inside vim. This is essentially because I was not able to write

相关标签:
11条回答
  • 2021-02-06 12:31

    Don't you need to press ,sr? LocalLeader is a comma by default I think.

    0 讨论(0)
  • 2021-02-06 12:36

    One can use Conque, a vim plugin that supports running a shell in a vim buffer. I have successfully used it to run a clojure REPL inside vim. It supports split screens, so one can send code from a clojure source code buffer to the clojure REPL.

    0 讨论(0)
  • 2021-02-06 12:36

    I've found that if the NailgunClient cannot be found, VimClojure will fail silently and none of the <LocalLeader> commands will work. I'm basically just repeating Joe Holloway above, but try this to verify that the Nailgun client is actually found:

    :call vimclojure#Repl.New()
    

    In my case I forgot to build the client, so I just returned to the unzipped VimClojure folder and ran make. This creates ng, the nailgun client executable. Make sure this is in your PATH somewhere, or set

    let vimclojure#NailgunClient = "/Users/foo/vimclojure-2.1.0/ng"
    

    as mentioned above.

    0 讨论(0)
  • 2021-02-06 12:39

    I've found vim-fireplace plugin a much easier way to start learning Clojure in Vim. Good introduction can be found in "Unboxing vim-fireplace".

    0 讨论(0)
  • 2021-02-06 12:39

    Have you tried mapping it to something else? It seems like you aren't sure what LocalLeader is mapped to, so I would recommend changing your mapping.

    0 讨论(0)
  • 2021-02-06 12:39

    In addition to using the correct local leader key (ie. "\" -> \sr by default), note that in order for VimClojure to start a repl, a clojure file needs to be loaded in the buffer. If you just start vim and hit \sr nothing will happen because VimClojure is not active yet.

    You can activate VimClojure by editing a file with the clj extension. From inside vim: :e test.clj

    Now when you hit \sr the repl should open. If not, see the other answer regarding checking hidden error messages.

    This tutorial is up-to-date as of time of writing and helped me get VimClojure set up with Leiningen in OSX: https://github.com/daveray/vimclojure-easy

    The more advanced setup linked to in the What's Next section was also helpful.

    0 讨论(0)
提交回复
热议问题