Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme with current info #26

Merged
merged 6 commits into from
Oct 24, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 49 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,62 @@ VSCode extension for replicating Grant Sanderson's `manim` workflow for Sublime

## Example usage

After installing:
1. [Install manimgl](https://3b1b.github.io/manim/getting_started/installation.html), make sure that the command `manimgl` works in your terminal
2. Open your manim file (e.g. `scene.py`) in VSCode
3. Place your cursor where you want to start the scene, on a line of code within the `construct` method in a scene class
4. Run the VSCode command: `cmd+shift+p` -> `Manim Notebook: Start scene at cursor`
(This command runs `manimgl scene.py NAME_OF_SCENE -se <lineNumber>` in your terminal)
In the upper-right of your screen - the manim interactive video will appear.

1. Open your manim `scene.py` in VSCode (replace `scene.py` with your manim file)
2. In the attached terminal, run `manimgl scene.py NAME_OF_SCENE -se 155` (replace 155 with line number to start debugging). In the upper-right of your screen the manim interactive video should pop up
3. Highlight the "section" you want to run (In manim, a section is a comment (`id`) followed by a block of code )
4. Type `cmd+shift+p` "Checkpoint paste from manim-notebook" ( or default binding `cmd+' cmd+r` ). This will copy the selected code to the clipboard and send the `checkpoint_paste()` command from manim into the interactive window.
<br />

Then you can do either:

- Write some comments which start with: `##`.
The clickable "Preview Manim Cell" buttons will appear above each such comment.
Clicking on one will run it.
It is equivalent to: `cmd+shift+p` -> `Manim Notebook: Preview active Manim Cell`

<br />

- Place your cursor on some line (or highlight several lines),
`cmd+shift+p` -> `Manim Notebook: Preview selected Manim code`
This will run the selected lines.


<br /><br />

The resulting workflow looks like Grant's 🥳
You can use the default keyboard shortcuts for these commands, or assign your own.

- the default shortcuts all start with `cmd+'`
- use `cmd` or `ctrl` depending on your OS

All current commands are:

- `Manim Notebook: Start scene at cursor`.
Shortcut: `cmd+' cmd+s`
- `Manim Notebook: Preview active Manim Cell`.
Shortcut: `cmd+' cmd+e`
- `Manim Notebook: Preview selected Manim code`.
Shortcut: `cmd+' cmd+r`
- `Manim Notebook: Remove all objects from scene`.
Shortcut: `cmd+' cmd+c`
- `Manim Notebook: Quit preview`.
Shortcut: `cmd+' cmd+w`



<br /><br />

The resulting workflow can look like Grant's 🥳

[(see demo on youtube)](https://www.youtube.com/watch?v=VaNHlFh0r5E)

<iframe width="560" height="315" src="https://www.youtube.com/embed/VaNHlFh0r5E?si=ClVdBSI1k_-mzKFr" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>


**Default keyboard bindings**:
- `cmd+' cmd+r` :: Run the `checkpoint_paste()` command from 3b1b's manim library on the highlighted code lines (`manim-notebook.previewSelection`)
- `cmd+' cmd+e` :: Execute all lines of the active manim cell interactively (`manim-notebook.previewManimCell`)

<br /><br />

## Local Development

Expand All @@ -34,7 +73,7 @@ After making changes:

1. Bump the version in `package.json`
2. `vsce package` (select `y`; a `.vsix` file will be created)
3. `cmd+shift+p` > "Extensions: Install from VSIX" > select the `.vsix` file
3. `cmd+shift+p` -> "Extensions: Install from VSIX" > select the `.vsix` file
4. reload window

<br />
Expand Down