Fork me on GitHub
#calva
<
2022-09-03
>
Jared Cone03:09:45

I'm new to clojure and lisps. I don't feel like I am effectively using Calva for navigating and editing code. I've reviewed the shortcuts but I still end up using mouse to click where I want to edit and sometimes I feel like I'm fighting Calva. I know I just dont have the workflow right yet. Anyone have any tutorials on how they primarily use Calva to speed up code editing?

seancorfield03:09:44

Have you read through this? https://calva.io/paredit/ Did it help or not?

Jared Cone03:09:01

I have read through it, and practiced the shortcuts. Maybe I just need more practice but I felt like no matter what shortcut I tried I couldn't get the cursor to navigate where I wanted without resorting to just using mouse or bare arrow keys

seancorfield03:09:59

ctrl+up / ctrl+down let you navigate out / in of expressions; ctrl+left / ctrl+right let you navigate left/right between expressions -- so a lot of the efficiency comes from thinking in forms rather than text...

seancorfield03:09:12

...and that's a huge shift from other languages.

2
Jared Cone03:09:48

Thanks I'll try focusing on those. Sometimes I find myself getting stuck in a leaf expression, I'll try alternating up/down vs left/right next time

seancorfield03:09:54

I've switched editors a lot over the decade-plus I've been doing Clojure and it really does take time to get used to new key bindings.

seancorfield03:09:47

I'm lucky that I do Clojure for a living so I get to use Calva/paredit eight hours a day 🙂

nice 1
skylize19:09:50

don't try to swallow the whole elephant

🐘 1
orestis06:09:24

TBH I haven't used these paredit navigations ever. I mouse and keyboard (although I use a vim emulation that makes a few things easier).

pez12:09:16

Indeed. Don't let the structural navigation stress you and feel you are doing something wrong. Picking one or two (the ones @U04V70XH6 mentioned are good choices) is a good idea. Once those feel comfortable, add one more. I'd also like to mention Grow Selection. On mac it is a convenient ctrl+w. I sometimes use it to navigate, since once you have a selection, left/right will move the cursors to the edges of that selection.

👍 1
Jacob Emcken19:09:14

I have two monitors. At first, I was very happy when I found that I could open a new VS window (using ctrl+K and O (the letter O - not zero) and have output.calva-repl in that window... Until I found that it doesn't auto scroll to the bottom on evaluations 😢 Can I do anything to get the same behavior (auto scroll) in the new window as in the "primary" window?

pez22:09:13

Hmmm... Maybe there is some extension that autoscrolls documents...

surferHalo09:09:37

Yes, there is an extension named AutoScroll exactly doing this. I run fulcro backend and frontend in one project folder but two different workspace in two vscode window (because calva only supports one repl connect in one window), and then open the repl output in the third window. This setup is superb when developing fullstack app, I am used to working in Intellij Idea Cursive, although it supports connect more than two repl, but easily send code into wrong repl and results manually switch the active repl, this is distraction.

🙏 1
pez10:09:30

I run backend and frontend in the same VS Code window. With Calva code mostly go to the right REPL. Only with cljc files it gets to be an issue, but it's easy to direct to the right REPL and most often I work with either the backend or frontend part of a cljc file anyway.

Daniel Jomphe20:09:43

I tried @UKN74DPB9's suggestion. Do you have a way to make sure the repl window that autoscrolls does so immediately when the REPL prints new things? In my case the autoscroll only triggers if I click on the window to e.g. let it know I'm here, please resume watching your file! Might be due to all the layers I use: WSL + a dev container...

Julian15:08:13

@U0ETXRFEW I'm experiencing exactly this issue. I recently started working on MacOS and setup VSCode and (for some reason, I never knew about this before) discovered Control + K and O to open the output.calva-repl (because I code on my main monitor and place the repl in my laptop screen maximised.) . But then I found the same issue as others have mentioned here. Unlike the split-plane repl, the popped-out repl didn't automatically scroll to the bottom. I fixed this by installing the AutoScroll extension and enabling it on the popped-out repl window which works great, however there's still one remaining problem. Not sure if this is a VSCode thing, but the REPL only outputs until the top half of the screen. So unlike the normal repl inside VSCode window where the latest repl output is always at the bottom, this repl output is in the middle. So the bottom half of my repl window is just empty space that it should be using. I'm not sure if this is due to "padding", honestly I have no idea how it works or what options I need to enable. Any ideas on how I could solve this?