Fork me on GitHub
#calva
<
2022-10-27
>
seancorfield18:10:12

Not sure if this is a Calva Q or a more general VS Code Q (probably the latter): if I press ctrl+a to select all, is there a way to unselect everything and have the cursor stay where you were before the select? It seems like ctrl+a esc jumps you to the end of the file. Never mind, just answered my own Q (and so I'll post it anyway in case it's useful to anyone else): ctrl+a <do action on everything> alt+left

pez18:10:25

If the <do action on everything> does not edit the the file, Undo Selection should be what you are looking for. If it edits, then you are out of luck, I think. (Even though you seem to have found some way to do it...)

seancorfield18:10:54

I don't see that command. I see Cursor Undo which... doesn't seem to do anything intuitive 👀

seancorfield18:10:29

alt+left works: moves the cursor back where it was and undoes the selection.

pez19:10:29

What is alt+left bound to for you?

seancorfield19:10:46

What's the easiest way to discover that? I can never remember...

pez19:10:24

I meant Cursor Undo, btw. 😃 I use it all the time. To evaluate the ns form and get the cursor back to where it was: cmd+up, ctrl+enter, cmd+u.

pez19:10:33

I open the Keyboard Shortcuts (`cmd+k cmd+s`) to search for commands or shortcuts.

seancorfield19:10:29

Not sure what the Windows equivalent to cmd+up would be (since win+up moves native windows around!

pez19:10:13

Probably something involving the home button. The commandId is cursorTop, so you can search keyboard shortcuts for it.

seancorfield19:10:13

alt+left is Go Back. Although Calva also has it bound but I don't seem to satisfy the "when" for that I guess?

pez19:10:00

Could be a specificity thing with the when condition too...

seancorfield19:10:12

Supposedly ctrl+home should do it... but it doesn't work for me on Windows.

pez19:10:06

I have Go Back on ctrl+- , thought that was the case on Windows too. In any case Cursor Undo is what you want. Go Back has different semantics. There is Go Forward too, which is nice.

seancorfield19:10:31

paredit.openList perhaps? That's also bound ctrl+home for me.

seancorfield19:10:52

ctrl+- shrinks the fonts 🙂

😱 1
😂 1
pez19:10:54

Yeah, I think that is a default binding.

seancorfield19:10:28

What does paredit.openList even do??

pez19:10:18

It goes to the start of the list (the open bracket).

pez19:10:05

I think binding it to ctrl+home is one of those ”works on my mac” things...

seancorfield19:10:22

alt+home => paredit.openList -- and now ctrl+home goes to the top of the file -- thank you!

seancorfield18:10:51

I've taken to using ctrl+a ctrl+enter as a way to re-eval every form in a file instead of ctrl+alt+c enter since it shows me all the Vars as they are def'd along with specific errors for any that fail to re-eval. This is particularly nice with Portal and its middleware so I get output like this (instead of just an error message in the REPL window -- which I have hidden normally):

pez18:10:56

We should add a custom repl command variable for all text in the file.

1
pez19:10:51

Meanwhile you could use Joyride for this:

{
        "command": "joyride.runCode",
        "args": "(promesa.core/do (vscode/commands.executeCommand \"editor.action.selectAll\") (vscode/commands.executeCommand \"calva.evaluateSelection\") (vscode/commands.executeCommand \"cursorUndo\"))",
        "key": "ctrl+alt+c enter",
    }

seancorfield19:10:51

Hmm, good point. If I get tired of mashing those keys, I might. But I find ctrl+a ctrl+enter easier than ctrl+alt+c enter and I don't always need to "undo" my last selection, depending on what I'm up to.

pez19:10:05

Yeah, ctrl+a ctrl+enter ctrl+u is fine too.

seancorfield19:10:27

Hahaha... OK, I bound ctrl+u ctrl+u to UPPERCASE (and ctrl+l ctrl+l to lowercase) so now I can't use ctrl+u on its own 😐 So. Many. Commands!

pez19:10:21

Is upper/lower case that common for you? Interesting, I almost never use it.

seancorfield19:10:42

I use it often enough to want it bound to hot keys 🤷:skin-tone-2: Fixed now. ctrl+c ctrl+u and ctrl+c ctrl+l for that, and now I have ctrl+a ctrl-enter ctrl-u back -- thank you!

🙏 1
seancorfield19:10:22

Doh! ctrl+c is a terrible chord prefix... now I can't copy anything! Avoiding collisions is hard. ctrl+alt+u (twice) and ctrl+alt+l (twice) seem safe... he says, hopefully...

pez20:10:15

You are about to discover why some of Calva's defaults are so complicated. 😃

pez20:10:59

My mnemonic for the ctrl+alt+c prefix is The Calva Key, btw. Haha.