Skip to content

Smart keyboard shortcut for inserting block #1594

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

Open
njspix opened this issue Apr 1, 2025 · 0 comments
Open

Smart keyboard shortcut for inserting block #1594

njspix opened this issue Apr 1, 2025 · 0 comments

Comments

@njspix
Copy link

njspix commented Apr 1, 2025

Is your feature request related to a problem? Please describe.
When inserting an R code block in a .rmd notebook using the keyboard shortcut cmd + option + i, the behavior is not 'smart' like it is in Rstudio - it 'nests' blocks rather than 'splitting' them.

```{r}
# some code here

# put cursor here

# more code here
```

For example, if you place your cursor at the location noted in the block above, then press cmd + option + i, you get:

```{r}
# some code here

```{r}
```

# more code here
```

This 'nested' syntax is undefined. Instead, it should produce:

```{r}
# some code here

```

```{r}

# more code here
```

I think this can be accomplished by setting a 'context key' in the extension whenever the cursor is in a block, then creating two keybindings, one for inside a block, another for outside a block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant