Ian.T
Ian.T

Reputation: 1166

Add the pipe operator (%>%) in Databricks as a shortcut

Is there a way to incorporate the R pipe operator (%>%) as a shortcut in Databricks?

Upvotes: 3

Views: 423

Answers (2)

Michael
Michael

Reputation: 326

Would it be helpful if I suggested an "outside the box" alternative? What about using https://www.autohotkey.com/ to define a macro, so that a keystroke (or a mouse right-click) pastes the desired text?

From the website:

AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.

Define hotkeys for the mouse and keyboard, remap keys or buttons and autocorrect-like replacements.

Upvotes: 0

proffarnsworth
proffarnsworth

Reputation: 76

If databricks workspace runs in your browser you may look into adding shortcuts to your browser directly. I have no way to test this with databricks, but if you are running on Google Chrome you may try this extension

https://chromewebstore.google.com/detail/autocontrol-keyboard-shor/lkaihdpfpifdlgoapbfocpmekbokmcfd

It looks like from there you should be able to run a bit of javascript. I am not super familiar with Javascript and this bit of code was generated by ChatGPT:

document.execCommand('insertText', false, '%>%');

This works for me. It looks like the extension offers some pretty advanced interactions. Nice to learn something new too!

enter image description here

Upvotes: 1

Related Questions