Shortcut to type |>?

The piping operator |> is very useful, especially when working in the REPL. However I do not find it convenient to type, it requires some finger gymnastic and it’s not very fast. Maybe it is the case because I have a french keyboard.

Does anyone knows a VSCode plugin that creates a shortcut to insert it ?

Thanks <3

1 Like

I map it to ctrl-shift-m which is how RStudio maps %>%

Ha sweet, how do you do that ?

Hard to describe but google how to map keyboard shortcuts vscode

For future reference:

Adding the following in the keybindings.json file works in editor but does not in the REPL.
Tutorial:

[{
    "key": "ctrl+shift+m",
    "command": "type",  
    "args": { "text": "|>" },
    "when": "editorTextFocus && editorLangId == 'julia'"
},{
    "key": "ctrl+shift+m",
    "command": "type",
    "args": { "text": "|>" },
    "when": "terminalFocus && terminalProcessSupported"
}
]
9 Likes

Works perfectly. Also, I made one that inserts the @pipe operator as well.

@HenriDeh, do you have know if now the shortcut command for the pipe will work in the REPL? I have been trying to make it work, but it’s been to no avail. Please let me know if you know a way — thank you.

I quickly gave up on using this. As far as I can remember it did not work reliably and ended up being more time consuming than typing the symbols normally.

2 Likes

Thanks, HenriDeh.