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

RStudio-like keyboard shortcuts for <- and %>% #22

Closed
jackbrookes opened this issue Feb 12, 2019 · 3 comments
Closed

RStudio-like keyboard shortcuts for <- and %>% #22

jackbrookes opened this issue Feb 12, 2019 · 3 comments

Comments

@jackbrookes
Copy link

I use the following snippets but it would be great if these were added to the package (maybe a bit more clever - i.e. trimming the spaces before and after if not needed)

alt + -: <-
ctrl + shift + m: %>%

My r.json user snippets file:

{
	"Assignment operator": {
		"prefix": "Assignment operator",
		"body": " <- "
	},
	"magrittr pipe": {
		"prefix": "magrittr pipe",
		"body": " %>% "
	}

}

My custom keybindings.json file:

[
    {
        "key": "alt+-",
        "command": "editor.action.insertSnippet",
        "args": { "langId": "r", "name": "Assignment operator" }
    },
    {
        "key": "ctrl+shift+m",
        "command": "editor.action.insertSnippet",
        "args": { "langId": "r", "name": "magrittr pipe" }
    }
]
@MikhailArkhipov
Copy link
Owner

MikhailArkhipov commented Jul 29, 2020

Added shortcuts for <- and %>% as suggested in #22. Also, added completion triggers on % and < which allows using completion list for snippets, as in RTVS.

You can either type < and then TAB to get <- via completion list or use keyboard shortcut alt+-. For pipe %>% either type % and then TAB or use ctrl+shift+m shortcut. Snippets file can be found in snippets/r.json in the extension folder.

Thanks to @jackbrookes for suggestions. 👍

@MikhailArkhipov
Copy link
Owner

0.0.12

@go-bayes
Copy link

go-bayes commented Feb 4, 2024

@MikhailArkhipov, thank you. This is the magrittr pipe. How might we opt for the native R pipe, which would be

body: " |> "

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

No branches or pull requests

3 participants