nmurthy
nmurthy

Reputation: 1577

What is the keyboard shortcut for ⇒ in your Scala editor of choice?

The Unicode operator \u21D2 "" (sometimes writtten as =>) is a common lexical identifier prevalent in the Scala programming language used in functional combinators, function definitions, case-match statements, etc. I normally have to copy-and-paste this operator into my code from someplace else, but that can get really annoying.

Does anyone know of shortcuts to produce this symbol in your IDE of choice? I typically use programs like JetBrains IntelliJ, SublimeText, and VIM.

Upvotes: 5

Views: 2252

Answers (3)

Reactormonk
Reactormonk

Reputation: 21730

For emacs, there's (global-prettify-symbols-mode), which just displays over =>. It still writes => to the file in the end.

Upvotes: 0

Sascha Kolberg
Sascha Kolberg

Reputation: 7162

In IntelliJ IDEA under

Preferences -> Editor -> CodeStyle -> Scala

In the Tab 'Other' are options to automatically insert several unicode characters.

enter image description here

Upvotes: 11

Till Rohrmann
Till Rohrmann

Reputation: 13346

In IntelliJ, I've created a live template of the form $PARAMS$ ⇒ $BODY$. This lets you easily insert the character.

Upvotes: 0

Related Questions