Fork me on GitHub
#calva
<
2022-12-16
>
Brett Rowberry14:12:00

How do people manage windows/panes/tabs in VS Code? I like to have an implementation ns on the top left, its test na on the top right, and the REPL on the bottom. It takes a lot of mousing to set that up and switch between them.

pez14:12:32

That's basically what I do. Mouse a lot. 😃 You can drag terminals in among the editors too, btw.

👍 1
skylize14:12:36

There are commands for moving panels and groups, and for moving between them. Some of these commands lack hotkeys by default. Searching the Command Palette for "move editor" and "focus editor" covers most of the relevant commands. Use the panel opened by Preferences: Open Keyboard Shortcuts to set shortcuts, but search for command names in the Command Palette to view cleaner search results.

👍 1
Brett Rowberry14:12:57

Cool. I was secretly hoping some ex-emacs or tmux wizard would say, “here’s what you wanna do…” 😆

orestis16:12:13

Here’s what I did, installed the neovim extension and use the vim commands for splits and editor navigation. I think since those are implemented in the vscode extension there’s definitely enough API to do it. A joyride script might help too :)

seancorfield17:12:38

I have a hotkey for Move Editor Into Right Group and I use the keyboard for switching groups (`ctrl+0` for explorer/git etc, ctrl+1, ctrl+2 -- on Windows at least). I'm working on a setup with Joyride to automate opening Portal, moving it to the right group, and switching focus back into the left group (amongst other things). Blog post on this to follow (it's been in draft state for two weeks so far). I almost never touch the mouse when I'm in VS Code -- even when working with the Atlassian extension for Jira and BitBucket: I create and work on tickets, branches, and pull requests all within VS Code with the keyboard. Also, I no longer have my REPL visible at all -- I use Portal to show results (with its nREPL middleware). But I also typically only have one code editor visible, as I have a hotkey to run tests for the current implementation ns without needing to switch back and forth (not sure if Calva has a built-in test runner for that -- but I use my own test running code, wired into Portal).

👍 1
dumrat11:12:57

@U04V70XH6 portal is great and I use it all the time but I can't quite get rid of the REPL. Sometimes I miss some error in source that's easily visible in REPL if I save the file (eval on save - Perhaps I shouldnt do it). And sometimes I just want to type something into the repl just to see how a function works.

mathpunk20:12:31

I can’t remember if I asked about this: practicalli mentions https://practical.li/clojure/clojure-editors/editor-user-guides/vspacecode-calva.html#structural-editing---paredit, but I would like to be able to enter a structural editing mode, so I can do a few of these commands without hitting the two leader keys first for every one. Is that possible? I don’t know if VSCode can really do “modal style”

skylize20:12:48

Structural editing in Calva doesn't use a leader key (unless you remap the hotkeys as "key chords", where the first of 2 hotkeys acts like a leader). https://calva.io/paredit/

skylize20:12:44

I'm pretty sure https://marketplace.visualstudio.com/items?itemName=vscodevim.vim provides edit/insert modes. So there must be a way to do modal editing. I imagine most of the magic happens in when conditions on shortcuts; and it probably get pretty complicated to do ad hoc.

mathpunk20:12:44

I did the thing where as soon as I started the editor I tried adding things to make it like the last one... I better figure out, was it VSSpaceCode that vimified me, or another plugin I forgot..

mathpunk20:12:23

The page I linked shows the commands remapped to use leaders

mathpunk20:12:57

So maybe I'll need to combine a condition with wherever those mappings are defined

mathpunk20:12:21

(or decide this is folly, and just learn the chords)

skylize21:12:52

Does your vim mode provide for an edit mode command altering shortcuts? You could have a command that toggles on/off a leaderless variant of the relevant shortcuts. If not, you could do the same with a Joyride script to add/remove a set of hotkeys.

mathpunk21:12:19

i would love to learn joyride but figured i better get editing straight first

mathpunk21:12:22

that's an idea

pez22:12:46

I don’t know anything about leader keys so I’m probably not understanding the question. Anyway, you can give yourself modes without #C03DPCLCV9N by using kennings to set extension context via the vscode command for this and then use that context in other keybindings. With Joyride you can go more sophisticated.

pez22:12:57

I’ve tried to edit kennings to keybindings there, but it won’t let me. 😀

mathpunk23:12:38

kennings! what an amazing word to use. I'll look into em

metal 1
skylize23:12:05

A leader key is roughly equivalent to what VS Code does with key chords, except with only a single leading key, instead of a handful of leading keys. So for Calva, Ctrl-Alt-C acts like a leader that makes Ctrl-Alt-J available as a shortcut to run Jack in. In Vim-like environments, you have a separate Edit Mode where the entire keyboard becomes available for single-key shortcuts, instead of inserting text. You can assign one key to the name "leader" in your config, but like with Code's chords, the leader behavior is not limited to that one key. @U0E9KE222 is using VSpaceCode to get Vim-like modes in VS Code, and by following the Practicalli guide, has set up Paredit to be done using leader-key based shortcuts in Edit Mode.

mathpunk23:12:06

I'm learning I have a bad installation of all this, so I'm repeating that path to Paredit

pez23:12:15

I’m an old vi use for decades so I know about editing modes. The leader key is still unclear to me after that explanation, though. But it’s not important. What I wanted to say is that you can create modes using context.

skylize23:12:30

Hmm. I wonder what is still confusing about it when compared against VS Code's chords. :thinking_face: It is a keyboard shortcut that does not have any effect on its own, but instead directs what the next shortcut will do. Like in vi Edit Mode, you can press J to go down. But if you press a leader key, it says that if the next key you press is J it will do some other assigned thing instead of moving the cursor down. And the request (which I think you answered with "create modes using context") is to instead switch into a mode where J will do that some other thing repeatedly until the mode is exited.

🙏 1
skylize23:12:46

Likely that leader keys aren't a thing in vi. Maybe not introduced until Vim.

pez07:12:44

Or I just missed them. Thanks. Now I think I get it.