tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

Eval of form runs entire file unless I switch to namespace in repl #373

Closed mpettis closed 4 years ago

mpettis commented 4 years ago

First, thanks for this package.

I am using this, and I think I have some odd behavior. I open a repl at the project root (foons), open a file (ex.clj) file with vim in the project, and then eval the following (both with <,>Eval and cpp inside the form) :

(clojure.core/in-ns 'foons.ex)

When I do this, it seems that the whole file gets evaluated, not just the form I select, which I think is incorrect.

However, if I change to foons.ex in the repl I launched, and do the same in-ns command inside of Vim, I get the expected behavior, and just the form evaluates.

Is this a bug, or do I possibly have something configured wrong?

Specs:

Leiningen 2.9.1 on Java 13.0.1 Java HotSpot(TM) 64-Bit Server VM Clojure: 1.10.0 nrepl: 0.6.0

tpope commented 4 years ago

If I understand correctly it is working as intended. Fireplace's :Eval always happens inside the current file's namespace, which means we need to require it beforehand if it isn't already defined.

mpettis commented 4 years ago

OK, thank you. As I am just learning Clojure, I don't have an informed opinion on what should is. It is a bit confusing that when I do a in-ns from the repl, it does not require the namespace I switch to, but fireplace does.