30

GitHub - jming422/fira-code-mode: Emacs minor mode for Fira Code ligatures using...

 4 years ago
source link: https://github.com/jming422/fira-code-mode
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

fira-code-mode

Minor mode for Fira Code ligatures using prettify-symbols.

screenshot1

This is a simple minor mode for Fira Code ligatures, built from these instructions on the FiraCode repo.

You don't need to use Fira Code as your main font in Emacs for this to work! Using this minor mode will give you just the ligatures from the Fira Code font; it won't alter your fonts or faces in any other way. (Of course, you're free to use Fira Code as your main font alongside this package - that's what I do!)

Getting Started

  1. Install the Fira Code Symbol font to your system (Download) (Original post).

    • If you don't know how to install a font to your system, check out Fira Code's main repo. They have some good instructions here.
    • Thanks to @siegebell for creating this font.
  2. Clone this repo. I keep mine in ~/.emacs.d/git-lisp/fira-code-mode, but you can put it wherever you like.

  3. Enable fira-code-mode in your config. Here are some examples:

With use-package (this is the config that I use personally):

(use-package fira-code-mode
  :load-path "git-lisp/fira-code-mode"
  :custom (fira-code-mode-disabled-ligatures '("[]" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off
  :hook prog-mode) ;; Enables fira-code-mode automatically for programming major modes

Feel free to remove or change the :custom and :hook values of course, but those are the ones I've found useful. Most of the ligatures I've disabled are purely preferential; some of them conflicted with other syntax styling for e.g. Clojure reader macros.

Without use-package:

(add-to-list 'load-path "~/.emacs.d/git-lisp/fira-code-mode")
(require 'fira-code-mode)
(custom-set-variable 'fira-code-mode-disabled-ligatures '("[]" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off
(add-hook 'prog-mode-hook 'fira-code-mode) ;; Enables fira-code-mode automatically for modes descended from prog-mode

Again, the last two lines are optional, but they're a reasonable starting point.

  1. Done, enjoy the ligatures!

Customization

As of now, fira-code-mode-disabled-ligatures is the only customizable option. Add a string to this list to prevent that string from being displayed with a ligature.

Contributing

This is the first Emacs package that I've made, and I'm making it available in hopes that it will make your lives easier as it did mine. I welcome suggestions and contributions, but here are a couple things to be aware of:

  • I'm quite new to writing Emacs Lisp, so please be nice! I know I have a lot to learn.
  • I don't have a ton of time to spend on this, but I'll do my best to respond to issues and PRs quickly!
  • If you've read this far, thank you! I'm very grateful for the chance to make something useful/interesting.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK