Fork me on GitHub
#vim
<
2018-11-12
>
dominicm11:11:12

Hi Sapo, saw your message on Clojureverse. I'm not sure where you asked before, but you're more likely to get a response here than anywhere else 🙂

sapo11:11:59

Hi @dominicm thank you very much! I asked on the genera #clojure channel

dominicm11:11:24

So fwiw, I don't use vim-classpath. As long as you start a repl, things tend to be faster that way. I never want to pay the 4s cost of waiting for clojure to start. Second, I think you need to lein repl from the same directory as project.clj, instead of the test directory.

dominicm11:11:57

Oh, you named your project "test" 😄

sapo11:11:49

oh yes, sorry for the bad name

sapo11:11:13

The same happens with other names, such as "tutorial"

sapo11:11:29

And removing "vim-classpath" doesn't change anything

dominicm11:11:44

When you do vim src/test/core.clj, are you creating the test directory for the first time then?

dominicm11:11:57

or rather, does src/test exist when you open vim src/test/core.clj?

sapo11:11:02

no, it is created by lein

dominicm11:11:08

okay, cool, just checking

sapo11:11:25

If you use vim-fireplace, you could just reproduce step-by-step and tell me how you use REPL in Vim...

dominicm11:11:03

@sapo I can't reproduce by following your steps unfortunately.

sapo11:11:30

But I can find a workaround. I just want to use REPL from Vim

dominicm11:11:43

Maybe your connection is being picked up wrong

dominicm11:11:10

After doing vim src/test/core.clj try doing :Connect where 11111 is in the output of lein repl

sapo11:11:22

Already tried the :Connect command and it doesn't output any errors

dominicm11:11:49

is your problem only with cljfmt?

dominicm11:11:21

or rather, what causes this error to happen?

dominicm11:11:29

Opening the file shouldn't cause it

sapo11:11:03

Just says "connected to [etc]"

sapo11:11:21

Both cljfmt and vim-fireplace

sapo11:11:32

The errors appears when I do :Require

dominicm11:11:47

What about if you do :Eval 1?

sapo11:11:16

Same error

dominicm11:11:53

Change (ns tutorial.core) to (ns user), then try :Eval 1. Just for curiosity sake.

sapo11:11:27

it works

sapo11:11:37

but... why?

dominicm11:11:22

For some reason, your classpath is wrong. I'm not entirely sure why yet.

dominicm11:11:31

But now you can :Eval, you can start to debug.

dominicm11:11:55

Eval (System/getProperty "user.dir") does this match the directory you did lein repl in?

sapo11:11:46

No, it's in src/tutorial

sapo11:11:18

But :pwd returns the root of the project

dominicm11:11:32

that explains the problem then

dominicm11:11:44

Kill the repl, then do cd ../.. and run your repl again

dominicm11:11:03

then :Require should work if you change back to (ns tutorial.core)

dominicm11:11:31

lein repl must be run from the same directory as project.clj, else it's relative to the wrong stuff.

sapo11:11:46

I had already launched lein repl from the root directory

sapo11:11:16

I don't understand why vim-replace thinks to be in the same directory of the editing file

sapo11:11:28

Maybe some setting is wrong in vim?

sapo11:11:36

I'm using neovim

dominicm11:11:34

I use neovim too

dominicm11:11:57

vim doesn't think it is. Your repl definitely thinks it's not in the root. It's a bit odd really :thinking_face:

dominicm11:11:02

Have you maybe got 2 repls running?

sapo11:11:51

Ok, wait

sapo11:11:12

From the REPL in the terminal Eval (System/getProperty "user.dir") returns the correct directory

sapo11:11:21

But from vim the wrong one

sapo11:11:02

Not sure about how many repl are running:

dominicm11:11:46

Looks like 2 or 3 to me.

dominicm11:11:53

pkill java and start again? 😄

sapo11:11:14

yep, I'm doing 😛

dominicm11:11:43

fwiw, a java process can only have 1 result for "user.dir". So you're definitely connected to the wrong repl.

sapo12:11:59

Yeah, maybe it's some settings in Vim then. It could be that other plugins launch a repl

sapo12:11:08

clojure-lsp, for example

dominicm12:11:12

vim-classpath does

sapo12:11:15

I should check

dominicm12:11:18

oh, and clojure-lsp may well too 🙂

sapo12:11:07

Ok, so I removed everything about clojure in neovim settings. I've just left vim-fireplace

sapo12:11:21

Now it connects as before, but when I try any command (e.g. :Eval 1) I get connection refused (errno 111)

sapo12:11:45

But it just said connected to [etc]

dominicm13:11:28

I imagine closing & opening vim would be useful, as it might have an old connection registered.

sapo13:11:11

Nothing, I turned off the whole PC and removed ~/.cache/vim/*

dominicm13:11:39

So. From the top. You've gone into ~/Develop/overtone/tutorial/, then you did lein repl? Then you started another terminal, did cd ~/Develop/overtone/tutorial, then vim src/tutorial/core.clj?

dominicm13:11:52

Open a terminal and do lein repl :connect localhost [nrepl-port]. Any directory.

dominicm14:11:08

I think that's the syntax, trying to remember rather than check 🙂

sapo14:11:58

Ah I found it!

enforser14:11:07

not sure that there is a space there - I always use: lein repl :connect localhost:[nrepl-port]

sapo14:11:32

The older nrepl server had created a src/test/.nrepl-port

sapo14:11:42

So fireplace looked for the older server

sapo14:11:02

The old server had been created by clojure-lsp, activated by oni

enforser14:11:14

great find!

sapo14:11:36

Unfortunately, it seems that clojure-lsp always run in the file directory...

sapo14:11:00

Thank you very much, by the way!

dominicm14:11:26

Good catch 🙂

snoe15:11:10

Ugh I'll fix that today in LSP.

dave17:11:08

wow, classpath.vim potentially considered harmful! 💡

dave17:11:12

i'm disabling it today 🙂

dave17:11:28

in retrospect, i'm not sure why i ever added it

dave17:11:39

the README says it's to enable stuff like :find and gf, but i've never used those

dominicm17:11:08

I use gf sometimes, but that works with plain clojure

dave17:11:17

what does it do?

dominicm17:11:31

with plain fireplace

dominicm17:11:37

Jumps to the file of a namespace

dave17:11:53

in general, my needs in that area (jumping to definitions) are met by ctags

dominicm17:11:45

ah 🙂 I use the fireplace jump to definition which uses a weird binding - so it's bound to gs

dominicm17:11:03

[<C-D>. It's just inhumane.

4
enforser17:11:21

I don't find that binding bad, but the trick is to remap your cap lock key to be another control key

dominicm17:11:30

My control key is under my thumb on my ergodox, but I've never been able to get used to that binding.

dave17:11:57

amusingly, it's actually not bad on dvorak (which i use) 😄

dave17:11:06

but i tried it the qwerty way and :face_vomiting:

dominicm17:11:03

I need to learn workmans. But moving jk is wrong

dave18:11:37

i learned dvorak well before vim, so it was a different sort of decision to make

dave18:11:01

but i will say that i think dvorak fits together with vim quite nicely

dave18:11:28

even though hjkl are not together, they're still in a configuration that feels good, at least to me

dave18:11:14

h and l still feel about the same (they're where "j" and "p" are on the qwerty keyboard), you just have to nudge your right pinky up one key to get l (bonus: you don't have to shift your hand one to the left like qwerty/vim seems to encourage you to do)

dave18:11:25

and j and k are actually still together, but they're in the left hand

dave18:11:38

(where "c" and "v" are on the qwerty keyboard)

dave18:11:53

not having zxcv on the lower left does take some getting used to, though...

dave18:11:17

i had to make peace with ctrl-c, ctrl-v, and ctrl-z becoming 2-handed operations

dave18:11:31

after a while it became a non-issue