cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Adding customized shortcut keys

Aminsnh
New Contributor

Hi all, I need to add a shortcut key for R's pip operator (%>%) to my Databricks notebook. I want the operator to be written in my code snippet when I hold down the shortcut keys (shift + ctrl + m). Is there a straightforward way to add such shortcuts in Databricks? 

1 REPLY 1

mark_ott
Databricks Employee
Databricks Employee

Databricks notebooks do not natively support defining custom keyboard shortcuts to insert specific code snippets like Rโ€™s pipe operator () within the notebook editor UI. The list of standard shortcuts available is limited to navigation, cell management, and basic editing actionsโ€”there is no built-in facility for mapping a shortcut to paste the pipe operator.โ€‹

Workarounds for Pipe Operator Shortcut

If you need this functionality, the most common approaches suggested by users are:

  • Keyboard Macro Tools: Use third-party tools such as AutoHotkey (Windows) or Automator/Keyboard Maestro (Mac) to define a custom macro that pastes %>% whenever you press Shift + Ctrl + M while editing a notebook. This works at the OS level and will function in the browser, including inside Databricks notebooks.โ€‹

  • Browser Extensions: For Chrome users, extensions like "AutoControl Keyboard Shortcut" can allow you to automate keyboard actions, including inserting snippets in web forms (such as code cells in Databricks).โ€‹

No Native Shortcut Editor

Unlike JupyterLab or RStudio (which both allow easy customization of shortcut keys to insert operators directly), Databricks currently does not offer a built-in way to add custom keybindings that paste text in notebooks or code cells.โ€‹

Recommendations

  • For a quick, reliable solution, create a macro using OS-level tools like AutoHotkey (for Windows) or Karabiner-Elements/Automator (for Mac). There are many guides online for creating macros that paste %>% using your preferred shortcut.โ€‹

  • If using Chrome, try an extension that allows you to set up custom shortcuts globally, configuring it to paste the operator when needed.โ€‹

In summary, you cannot set up a native shortcut for the pipe operator in Databricks notebooks, but using external macro or browser tools is a practical workaround for this limitation.โ€‹