dotfiles
1Installing
2==========
3
4Windows
5-------
6
7In the ttf folder, double-click each font file, click “Install font”; to install all at once, select all files, right-click, and choose “Install”
8
9OR
10
11Use https://chocolatey.org:
12
13 choco install firacode
14
15
16macOS
17-----
18
19In the downloaded TTF folder:
20
211. Select all font files
222. Right click and select `Open` (alternatively `Open With Font Book`)
233. Select "Install Font"
24
25OR
26
27Use http://brew.sh:
28
29 `brew tap homebrew/cask-fonts`
30 `brew install font-fira-code`
31
32
33Ubuntu Zesty (17.04), Debian Stretch (9) or newer
34-------------------------------------------------
35
361. Make sure that the `universe` (for Ubuntu) or `contrib` (for Debian) repository is enabled (see https://askubuntu.com/questions/148638/how-do-i-enable-the-universe-repository or https://wiki.debian.org/SourcesList#Component)
372. Install `fonts-firacode` package either by executing `sudo apt install fonts-firacode` in the terminal or via GUI tool (like “Software Center”)
38
39
40Arch Linux
41----------
42
43Fira Code package is available in the official repository: https://www.archlinux.org/packages/community/any/ttf-fira-code/.
44
45Variant of Fira Code package is available in the AUR: https://aur.archlinux.org/packages/otf-fira-code-git/.
46
47
48Gentoo
49------
50
51 emerge -av media-fonts/fira-code
52
53
54Fedora
55------
56
57To install, perform the following commands:
58
59 dnf install fira-code-fonts
60
61
62Solus
63-----
64
65Fira Code package is available in the official repository: `font-firacode-ttf` and `font-firacode-otf`.
66They can be installed by running:
67
68 sudo eopkg install font-firacode-ttf font-firacode-otf
69
70
71Void linux
72----------
73
74 xbps-install font-firacode
75
76
77Linux Manual Installation
78-------------------------
79
80With most desktop-oriented distributions, double-clicking each font file in the ttf folder and selecting “Install font” should be enough. If it isn’t, create and run `download_and_install.sh` script:
81
82 #!/usr/bin/env bash
83
84 fonts_dir="${HOME}/.local/share/fonts"
85 if [ ! -d "${fonts_dir}" ]; then
86 echo "mkdir -p $fonts_dir"
87 mkdir -p "${fonts_dir}"
88 else
89 echo "Found fonts dir $fonts_dir"
90 fi
91
92 for type in Bold Light Medium Regular Retina; do
93 file_path="${HOME}/.local/share/fonts/FiraCode-${type}.ttf"
94 file_url="https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-${type}.ttf?raw=true"
95 if [ ! -e "${file_path}" ]; then
96 echo "wget -O $file_path $file_url"
97 wget -O "${file_path}" "${file_url}"
98 else
99 echo "Found existing file $file_path"
100 fi;
101 done
102
103 echo "fc-cache -f"
104 fc-cache -f
105
106More details: https://github.com/tonsky/FiraCode/issues/4
107
108
109FreeBSD
110-------
111
112Using pkg(8):
113
114 pkg install firacode
115
116OR
117
118Using ports:
119
120 cd /usr/ports/x11-fonts/firacode && make install clean
121
122
123Enabling ligatures
124==================
125
126Atom
127----
128
129To change your font to Fira Code, open Atom's preferences (`cmd + ,` on a Mac, `ctrl + ,` on PC), make sure the "Settings" tab is selected, or the "Editor" in Atom 1.10+, and scroll down to "Editor Settings". In the "Font Family" field, enter `Fira Code`.
130
131If you wish to specify a font weight, for example, Light, use `Fira Code Light` as a font name (Windows) or `FiraCode-Light` (macOS).
132
133Ligatures are enabled by default in Atom 1.9 and above.
134
135
136VS Code
137-------
138
139To open the settings editor, first from the File menu choose Preferences, Settings or use keyboard shortcut `Ctrl + ,` (Windows) or `Cmd + ,` (macOS).
140
141To enable FiraCode in the settings editor, under "Commonly Used", expand the "Text Editor" settings and then click on "Font". In the "Font Family" input box type `Fira Code`, replacing any content. Tick the check box "Enables/Disables font ligatures" under "Font Ligatures" to enable the special ligatures.
142
143If you wish to specify a font weight, for example, Light, use `Fira Code Light` as a font name (Windows) or `FiraCode-Light` (macOS).
144
145
146IntelliJ products
147-----------------
148
1491. Enable in Settings → Editor → Font → Enable Font Ligatures
1502. Select `Fira Code` as "Primary font" under Settings → Editor → Font
151
152Additionally, if a Color Scheme is selected:
153
1543. Enable in Settings → Editor → Color Scheme → Color Scheme Font → Enable Font Ligatures
1554. Select Fira Code as "Primary font" under Settings → Editor → Color Scheme → Color Scheme Font
156
157
158BBEdit, TextWrangler
159--------------------
160
161Run in your terminal:
162
163 defaults write com.barebones.bbedit "EnableFontLigatures_Fira Code" -bool YES
164
165Source: https://www.barebones.com/support/bbedit/ExpertPreferences.html
166
167
168Brackets
169--------
170
1711. From the `View` menu choose `Themes....`
1722. Paste `'Fira Code'`, at the beginning of `Font Family`
173
174
175Emacs
176-----
177
178There are a few options when it comes down to using ligatures in
179Emacs. They are listed in order of preferred to less-preferred. Pick one!
180
1811. Using composition mode in Emacs Mac port
182
183If you're using the latest Mac port of Emacs (https://bitbucket.org/mituharu/emacs-mac by Mitsuharu Yamamoto) for macOS, you can use:
184
185 (mac-auto-operator-composition-mode)
186
187This is generally the easiest solution, but can only be used on macOS.
188
1892. Using prettify-symbols
190
191These instructions are pieced together by https://github.com/Triavanicus, taking some pieces from https://github.com/minad/hasklig-mode.
192
193This method requires you to install the Fira Code Symbol font, made by https://github.com/siegebell:
194https://github.com/tonsky/FiraCode/issues/211#issuecomment-239058632
195
196 (defun fira-code-mode--make-alist (list)
197 "Generate prettify-symbols alist from LIST."
198 (let ((idx -1))
199 (mapcar
200 (lambda (s)
201 (setq idx (1+ idx))
202 (let* ((code (+ #Xe100 idx))
203 (width (string-width s))
204 (prefix ())
205 (suffix '(?\s (Br . Br)))
206 (n 1))
207 (while (< n width)
208 (setq prefix (append prefix '(?\s (Br . Bl))))
209 (setq n (1+ n)))
210 (cons s (append prefix suffix (list (decode-char 'ucs code))))))
211 list)))
212
213 (defconst fira-code-mode--ligatures
214 '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\"
215 "{-" "[]" "::" ":::" ":=" "!!" "!=" "!==" "-}"
216 "--" "---" "-->" "->" "->>" "-<" "-<<" "-~"
217 "#{" "#[" "##" "###" "####" "#(" "#?" "#_" "#_("
218 ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*"
219 "/**" "/=" "/==" "/>" "//" "///" "&&" "||" "||="
220 "|=" "|>" "^=" "$>" "++" "+++" "+>" "=:=" "=="
221 "===" "==>" "=>" "=>>" "<=" "=<<" "=/=" ">-" ">="
222 ">=>" ">>" ">>-" ">>=" ">>>" "<*" "<*>" "<|" "<|>"
223 "<$" "<$>" "<!--" "<-" "<--" "<->" "<+" "<+>" "<="
224 "<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<" "<~"
225 "<~~" "</" "</>" "~@" "~-" "~=" "~>" "~~" "~~>" "%%"
226 "x" ":" "+" "+" "*"))
227
228 (defvar fira-code-mode--old-prettify-alist)
229
230 (defun fira-code-mode--enable ()
231 "Enable Fira Code ligatures in current buffer."
232 (setq-local fira-code-mode--old-prettify-alist prettify-symbols-alist)
233 (setq-local prettify-symbols-alist (append (fira-code-mode--make-alist fira-code-mode--ligatures) fira-code-mode--old-prettify-alist))
234 (prettify-symbols-mode t))
235
236 (defun fira-code-mode--disable ()
237 "Disable Fira Code ligatures in current buffer."
238 (setq-local prettify-symbols-alist fira-code-mode--old-prettify-alist)
239 (prettify-symbols-mode -1))
240
241 (define-minor-mode fira-code-mode
242 "Fira Code ligatures minor mode"
243 :lighter " Fira Code"
244 (setq-local prettify-symbols-unprettify-at-point 'right-edge)
245 (if fira-code-mode
246 (fira-code-mode--enable)
247 (fira-code-mode--disable)))
248
249 (defun fira-code-mode--setup ()
250 "Setup Fira Code Symbols"
251 (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))
252
253 (provide 'fira-code-mode)
254
255Alternative instructions: https://github.com/Profpatsch/blog/blob/master/posts/ligature-emulation-in-emacs/post.md#appendix-b-update-1-firacode-integration
256
2573. Using composition char table
258
259Thanks to https://github.com/seanfarley for putting this together; extended by https://github.com/jrblevin.
260
261Put this lisp in your .emacs:
262
263 (when (window-system)
264 (set-frame-font "Fira Code"))
265 (let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
266 (35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
267 (36 . ".\\(?:>\\)")
268 (37 . ".\\(?:\\(?:%%\\)\\|%\\)")
269 (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
270 (42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
271 (43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
272 (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
273 (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
274 (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
275 (48 . ".\\(?:x[a-zA-Z]\\)")
276 (58 . ".\\(?:::\\|[:=]\\)")
277 (59 . ".\\(?:;;\\|;\\)")
278 (60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
279 (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
280 (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
281 (63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
282 (91 . ".\\(?:]\\)")
283 (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
284 (94 . ".\\(?:=\\)")
285 (119 . ".\\(?:ww\\)")
286 (123 . ".\\(?:-\\)")
287 (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
288 (126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
289 )
290 ))
291 (dolist (char-regexp alist)
292 (set-char-table-range composition-function-table (car char-regexp)
293 `([,(cdr char-regexp) 0 font-shape-gstring]))))
294
295**Note!** If you get `error in process filter: Attempt to shape unibyte text`, check out https://github.com/tonsky/FiraCode/issues/42. Emacs Cider users may avoid this issue by commenting the following line from the above config:
296
297 ;; (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
298
299Char `45` is also known to have issues in macOS Mojave.
300
301If you are having problems with helm you can disable ligatures in helm:
302
303 (add-hook 'helm-major-mode-hook
304 (lambda ()
305 (setq auto-composition-mode nil)))
306
3074. Using font-lock keywords
308
309If none of the above worked, you can try this method.
310
311This method requires you to install the Fira Code Symbol font, made by https://github.com/siegebell:
312https://github.com/tonsky/FiraCode/issues/211#issuecomment-239058632
313
314 ;;; Fira code
315 ;; This works when using emacs --daemon + emacsclient
316 (add-hook 'after-make-frame-functions (lambda (frame) (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol")))
317 ;; This works when using emacs without server/client
318 (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol")
319 ;; I haven't found one statement that makes both of the above situations work, so I use both for now
320
321 (defconst fira-code-font-lock-keywords-alist
322 (mapcar (lambda (regex-char-pair)
323 `(,(car regex-char-pair)
324 (0 (prog1 ()
325 (compose-region (match-beginning 1)
326 (match-end 1)
327 ;; The first argument to concat is a string containing a literal tab
328 ,(concat " " (list (decode-char 'ucs (cadr regex-char-pair)))))))))
329 '(("\\(www\\)" #Xe100)
330 ("[^/]\\(\\*\\*\\)[^/]" #Xe101)
331 ("\\(\\*\\*\\*\\)" #Xe102)
332 ("\\(\\*\\*/\\)" #Xe103)
333 ("\\(\\*>\\)" #Xe104)
334 ("[^*]\\(\\*/\\)" #Xe105)
335 ("\\(\\\\\\\\\\)" #Xe106)
336 ("\\(\\\\\\\\\\\\\\)" #Xe107)
337 ("\\({-\\)" #Xe108)
338 ("\\(\\[\\]\\)" #Xe109)
339 ("\\(::\\)" #Xe10a)
340 ("\\(:::\\)" #Xe10b)
341 ("[^=]\\(:=\\)" #Xe10c)
342 ("\\(!!\\)" #Xe10d)
343 ("\\(!=\\)" #Xe10e)
344 ("\\(!==\\)" #Xe10f)
345 ("\\(-}\\)" #Xe110)
346 ("\\(--\\)" #Xe111)
347 ("\\(---\\)" #Xe112)
348 ("\\(-->\\)" #Xe113)
349 ("[^-]\\(->\\)" #Xe114)
350 ("\\(->>\\)" #Xe115)
351 ("\\(-<\\)" #Xe116)
352 ("\\(-<<\\)" #Xe117)
353 ("\\(-~\\)" #Xe118)
354 ("\\(#{\\)" #Xe119)
355 ("\\(#\\[\\)" #Xe11a)
356 ("\\(##\\)" #Xe11b)
357 ("\\(###\\)" #Xe11c)
358 ("\\(####\\)" #Xe11d)
359 ("\\(#(\\)" #Xe11e)
360 ("\\(#\\?\\)" #Xe11f)
361 ("\\(#_\\)" #Xe120)
362 ("\\(#_(\\)" #Xe121)
363 ("\\(\\.-\\)" #Xe122)
364 ("\\(\\.=\\)" #Xe123)
365 ("\\(\\.\\.\\)" #Xe124)
366 ("\\(\\.\\.<\\)" #Xe125)
367 ("\\(\\.\\.\\.\\)" #Xe126)
368 ("\\(\\?=\\)" #Xe127)
369 ("\\(\\?\\?\\)" #Xe128)
370 ("\\(;;\\)" #Xe129)
371 ("\\(/\\*\\)" #Xe12a)
372 ("\\(/\\*\\*\\)" #Xe12b)
373 ("\\(/=\\)" #Xe12c)
374 ("\\(/==\\)" #Xe12d)
375 ("\\(/>\\)" #Xe12e)
376 ("\\(//\\)" #Xe12f)
377 ("\\(///\\)" #Xe130)
378 ("\\(&&\\)" #Xe131)
379 ("\\(||\\)" #Xe132)
380 ("\\(||=\\)" #Xe133)
381 ("[^|]\\(|=\\)" #Xe134)
382 ("\\(|>\\)" #Xe135)
383 ("\\(\\^=\\)" #Xe136)
384 ("\\(\\$>\\)" #Xe137)
385 ("\\(\\+\\+\\)" #Xe138)
386 ("\\(\\+\\+\\+\\)" #Xe139)
387 ("\\(\\+>\\)" #Xe13a)
388 ("\\(=:=\\)" #Xe13b)
389 ("[^!/]\\(==\\)[^>]" #Xe13c)
390 ("\\(===\\)" #Xe13d)
391 ("\\(==>\\)" #Xe13e)
392 ("[^=]\\(=>\\)" #Xe13f)
393 ("\\(=>>\\)" #Xe140)
394 ("\\(<=\\)" #Xe141)
395 ("\\(=<<\\)" #Xe142)
396 ("\\(=/=\\)" #Xe143)
397 ("\\(>-\\)" #Xe144)
398 ("\\(>=\\)" #Xe145)
399 ("\\(>=>\\)" #Xe146)
400 ("[^-=]\\(>>\\)" #Xe147)
401 ("\\(>>-\\)" #Xe148)
402 ("\\(>>=\\)" #Xe149)
403 ("\\(>>>\\)" #Xe14a)
404 ("\\(<\\*\\)" #Xe14b)
405 ("\\(<\\*>\\)" #Xe14c)
406 ("\\(<|\\)" #Xe14d)
407 ("\\(<|>\\)" #Xe14e)
408 ("\\(<\\$\\)" #Xe14f)
409 ("\\(<\\$>\\)" #Xe150)
410 ("\\(<!--\\)" #Xe151)
411 ("\\(<-\\)" #Xe152)
412 ("\\(<--\\)" #Xe153)
413 ("\\(<->\\)" #Xe154)
414 ("\\(<\\+\\)" #Xe155)
415 ("\\(<\\+>\\)" #Xe156)
416 ("\\(<=\\)" #Xe157)
417 ("\\(<==\\)" #Xe158)
418 ("\\(<=>\\)" #Xe159)
419 ("\\(<=<\\)" #Xe15a)
420 ("\\(<>\\)" #Xe15b)
421 ("[^-=]\\(<<\\)" #Xe15c)
422 ("\\(<<-\\)" #Xe15d)
423 ("\\(<<=\\)" #Xe15e)
424 ("\\(<<<\\)" #Xe15f)
425 ("\\(<~\\)" #Xe160)
426 ("\\(<~~\\)" #Xe161)
427 ("\\(</\\)" #Xe162)
428 ("\\(</>\\)" #Xe163)
429 ("\\(~@\\)" #Xe164)
430 ("\\(~-\\)" #Xe165)
431 ("\\(~=\\)" #Xe166)
432 ("\\(~>\\)" #Xe167)
433 ("[^<]\\(~~\\)" #Xe168)
434 ("\\(~~>\\)" #Xe169)
435 ("\\(%%\\)" #Xe16a)
436 ("[0\[]\\(x\\)" #Xe16b)
437 ("[^:=]\\(:\\)[^:=]" #Xe16c)
438 ("[^\\+<>]\\(\\+\\)[^\\+<>]" #Xe16d)
439 ("[^\\*/<>]\\(\\*\\)[^\\*/<>]" #Xe16f))))
440
441 (defun add-fira-code-symbol-keywords ()
442 (font-lock-add-keywords nil fira-code-font-lock-keywords-alist))
443
444 (add-hook 'prog-mode-hook
445 #'add-fira-code-symbol-keywords)
446
447On some systems, `==` will appear incorrectly as a blank space in certain modes unless you add the following lines to your init file:
448
449 (set-language-environment "UTF-8")
450 (set-default-coding-systems 'utf-8)
451
452
453GoormIDE
454--------
455
456In a workspace:
457
4581. Click goormIDE, then Preferences.
4592. Go to Theme, then focus Custom Theme CSS.
4603. Copy & paste the following:
461
462 @font-face{
463 font-family: 'Fira Code';
464 src: url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/eot/FiraCode-Regular.eot') format('embedded-opentype'),
465 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff2/FiraCode-Regular.woff2') format('woff2'),
466 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff/FiraCode-Regular.woff') format('woff'),
467 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/ttf/FiraCode-Regular.ttf') format('truetype');
468 font-weight: normal;
469 font-style: normal;
470 }
471
472 .editor_container pre {
473 -webkit-font-feature-settings: "liga" on, "calt" on;
474 -webkit-font-smoothing: antialiased;
475 text-rendering: optimizeLegibility;
476 font-family: 'Fira Code';
477 }
478
4794. Click Aplly or OK
4805. Happy coding!
481
482
483Cloud9
484------
485
486In a workspace:
487
4881. Click Cloud9, then Preferences (or use keyboard shortcut CTRL + ,)
4892. Go to Themes, then click on You can also style Cloud9 by editing your stylesheet (this will open a blank styles.css file in the C9 editor)
4903. Copy & paste the following:
491
492 @font-face{
493 font-family: 'Fira Code';
494 src: url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/eot/FiraCode-Regular.eot') format('embedded-opentype'),
495 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff2/FiraCode-Regular.woff2') format('woff2'),
496 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff/FiraCode-Regular.woff') format('woff'),
497 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/ttf/FiraCode-Regular.ttf') format('truetype');
498 font-weight: normal;
499 font-style: normal;
500 }
501
502 .ace_editor{
503 -webkit-font-feature-settings: "liga" on, "calt" on;
504 -webkit-font-smoothing: antialiased;
505 text-rendering: optimizeLegibility;
506 font-family: 'Fira Code';
507 }
508
5094. Back in Preferences tab, click on User Settings, then click on Code Editor (Ace)
5105. In Font Family field, enter Fira Code
5116. Optionally, repeat step 5 for Preferences > User Settings > Terminal, if you want Fira Code font in C9 terminal.
512
513
514MacVim
515------
516
517Add this to ~/.gvimrc:
518
519 set macligatures
520 set guifont=Fira\ Code:h12
521
522MacVim supports ligatures starting from version 7.4.
523
524
525RStudio
526-------
527
528In RStudio:
529
5301. Go to Tools > Global Options > Appearance
5312. Select "Fira Code" as Editor Font. In older versions of RStudio, check "Use Ligatures".
5323. Hit "OK" and enjoy
533
534
535Sublime Text
536------------
537
538Preferences --> Settings
539
540Add before "ignored_packages":
541
542 "font_face": "Fira Code",
543 "font_options": ["subpixel_antialias"],
544
545If you want enable antialias, add in font_options: "gray_antialias"
546
547
548Visual Studio
549-------------
550
5511. Launch Visual Studio (2015 or later).
5522. Launch the Options dialog by opening the "Tools" menu and selecting "Options".
5533. In the Options dialog, under the "Environment" category, you'll find "Fonts and Colors". Click on that. You'll see a combo-box on the right hand side of the dialog labelled "Font". Select "Fira Code" from that combo-box.
5544. Click "OK" to dismiss.
5555. Restart Visual Studio.
556
557Now, most FiraCode ligatures will work. A notable exception is the hyphen-based ligatures (e.g. the C++ dereference '->'). See https://github.com/tonsky/FiraCode/issues/422 for details.
558
559
560Troubleshooting
561===============
562
563See https://github.com/tonsky/FiraCode/wiki/Troubleshooting