Atom: Dynamic text substitution for pretty symbols?

Created on 10 Dec 2016  Â·  3Comments  Â·  Source: atom/atom

Hi, a question: can Atom "replace" the presentation (display) of certain text patterns while keeping the underlying char sequences intact?

To be clear, I'm wondering if it would be possible for a package to imitate Spacemacs Clojure layer's fancify-symbols feature. What it does is replace instances of the fn, partial, comp, #(), #{} keywords and literals with the symbols λ, Ƥ, ∘, ƒ, ∈, respectively. The substitutions are done _as you type_.

To illustrate:

;; Insertion
(fn_
(λ _
(λ [] (partial_
(λ [] (Ƥ _
(λ [] (Ƥ (comp_
(λ [] (Ƥ (∘ _
(λ [] (Ƥ (∘ #_
(λ [] (Ƥ (∘ ƒ(_
(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; #_
(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; ∈{_

;; Deletion

(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; ∈{_
(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; ∈_
(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; ∈_{
(λ [] (Ƥ (∘ ƒ(inc %) ƒ(dec %))) ; _{

(λ [] (Ƥ (∘ ƒ(_
(λ [] (Ƥ (∘ ƒ_
(λ [] (Ƥ (∘ ƒ_(
(λ [] (Ƥ (∘ _(

(λ [] (Ƥ (∘_
(λ [] (Ƥ (com_
(λ [] (Ƥ_
(λ [] (partia_
(λ_
(f_

Cheers, and thanks for Atom. :)

question

Most helpful comment

Oops, sorry. :x


I have found a solution, and here is what I learnt:

Following the lead on ligatures, I happened upon this thread. It appears that this effect is best done with a concealer rather than through a font (the more you know). And luckily, there already _is_ a package that does this!

Documenting this here for similar seekers.

Thanks

All 3 comments

Yes, I believe these are called ligatures. The easiest way to achieve this would probably be to use a font that has those ligatures (maybe try FiraCode)?

Also, next time you have a question please ask it on Discuss, the official Atom and Electron message board or the Atom Slack instead. Because we treat our issues list as the Atom team's backlog, we close issues that are questions since they don't represent a task needing to be completed. On Discuss and in the Atom Slack team, there are a bunch of helpful community members that should be willing to point you in the right direction.

Oops, sorry. :x


I have found a solution, and here is what I learnt:

Following the lead on ligatures, I happened upon this thread. It appears that this effect is best done with a concealer rather than through a font (the more you know). And luckily, there already _is_ a package that does this!

Documenting this here for similar seekers.

Thanks

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings