My personal .emacs.d folder

fira-code.el 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ;;; Fira code
  2. ;; This works when using emacs --daemon + emacsclient
  3. (add-hook 'after-make-frame-functions (lambda (frame) (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol")))
  4. (add-hook 'after-make-frame-functions (lambda (frame) (set-fontset-font t nil (font-spec :size 20 :name "Symbola"))))
  5. ;; This works when using emacs without server/client
  6. (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol")
  7. (set-fontset-font t nil (font-spec :size 20 :name "Symbola"))
  8. (defconst fira-code-font-lock-keywords-alist
  9. (mapcar (lambda (regex-char-pair)
  10. `(,(car regex-char-pair)
  11. (0 (prog1 ()
  12. (compose-region (match-beginning 1)
  13. (match-end 1)
  14. ;; The first argument to concat is a string containing a literal tab
  15. ,(concat " " (list (decode-char 'ucs (cadr regex-char-pair)))))))))
  16. '(("\\(www\\)" #Xe100)
  17. ("[^/]\\(\\*\\*\\)[^/]" #Xe101)
  18. ("\\(\\*\\*\\*\\)" #Xe102)
  19. ("\\(\\*\\*/\\)" #Xe103)
  20. ("\\(\\*>\\)" #Xe104)
  21. ("[^*]\\(\\*/\\)" #Xe105)
  22. ("\\(\\\\\\\\\\)" #Xe106)
  23. ("\\(\\\\\\\\\\\\\\)" #Xe107)
  24. ("\\({-\\)" #Xe108)
  25. ("\\(\\[\\]\\)" #Xe109)
  26. ("\\(::\\)" #Xe10a)
  27. ("\\(:::\\)" #Xe10b)
  28. ("[^=]\\(:=\\)" #Xe10c)
  29. ("\\(!!\\)" #Xe10d)
  30. ("\\(!=\\)" #Xe10e)
  31. ("\\(!==\\)" #Xe10f)
  32. ("\\(-}\\)" #Xe110)
  33. ("\\(--\\)" #Xe111)
  34. ("\\(---\\)" #Xe112)
  35. ("\\(-->\\)" #Xe113)
  36. ("[^-]\\(->\\)" #Xe114)
  37. ("\\(->>\\)" #Xe115)
  38. ("\\(-<\\)" #Xe116)
  39. ("\\(-<<\\)" #Xe117)
  40. ("\\(-~\\)" #Xe118)
  41. ("\\(#{\\)" #Xe119)
  42. ("\\(#\\[\\)" #Xe11a)
  43. ("\\(##\\)" #Xe11b)
  44. ("\\(###\\)" #Xe11c)
  45. ("\\(####\\)" #Xe11d)
  46. ("\\(#(\\)" #Xe11e)
  47. ("\\(#\\?\\)" #Xe11f)
  48. ("\\(#_\\)" #Xe120)
  49. ("\\(#_(\\)" #Xe121)
  50. ("\\(\\.-\\)" #Xe122)
  51. ("\\(\\.=\\)" #Xe123)
  52. ("\\(\\.\\.\\)" #Xe124)
  53. ("\\(\\.\\.<\\)" #Xe125)
  54. ("\\(\\.\\.\\.\\)" #Xe126)
  55. ("\\(\\?=\\)" #Xe127)
  56. ("\\(\\?\\?\\)" #Xe128)
  57. ("\\(;;\\)" #Xe129)
  58. ("\\(/\\*\\)" #Xe12a)
  59. ("\\(/\\*\\*\\)" #Xe12b)
  60. ("\\(/=\\)" #Xe12c)
  61. ("\\(/==\\)" #Xe12d)
  62. ("\\(/>\\)" #Xe12e)
  63. ("\\(//\\)" #Xe12f)
  64. ("\\(///\\)" #Xe130)
  65. ("\\(&&\\)" #Xe131)
  66. ("\\(||\\)" #Xe132)
  67. ("\\(||=\\)" #Xe133)
  68. ("[^|]\\(|=\\)" #Xe134)
  69. ("\\(|>\\)" #Xe135)
  70. ("\\(\\^=\\)" #Xe136)
  71. ("\\(\\$>\\)" #Xe137)
  72. ("\\(\\+\\+\\)" #Xe138)
  73. ("\\(\\+\\+\\+\\)" #Xe139)
  74. ("\\(\\+>\\)" #Xe13a)
  75. ("\\(=:=\\)" #Xe13b)
  76. ("[^!/]\\(==\\)[^>]" #Xe13c)
  77. ("\\(===\\)" #Xe13d)
  78. ("\\(==>\\)" #Xe13e)
  79. ("[^=]\\(=>\\)" #Xe13f)
  80. ("\\(=>>\\)" #Xe140)
  81. ("\\(<=\\)" #Xe141)
  82. ("\\(=<<\\)" #Xe142)
  83. ("\\(=/=\\)" #Xe143)
  84. ("\\(>-\\)" #Xe144)
  85. ("\\(>=\\)" #Xe145)
  86. ("\\(>=>\\)" #Xe146)
  87. ("[^-=]\\(>>\\)" #Xe147)
  88. ("\\(>>-\\)" #Xe148)
  89. ("\\(>>=\\)" #Xe149)
  90. ("\\(>>>\\)" #Xe14a)
  91. ("\\(<\\*\\)" #Xe14b)
  92. ("\\(<\\*>\\)" #Xe14c)
  93. ("\\(<|\\)" #Xe14d)
  94. ("\\(<|>\\)" #Xe14e)
  95. ("\\(<\\$\\)" #Xe14f)
  96. ("\\(<\\$>\\)" #Xe150)
  97. ("\\(<!--\\)" #Xe151)
  98. ("\\(<-\\)" #Xe152)
  99. ("\\(<--\\)" #Xe153)
  100. ("\\(<->\\)" #Xe154)
  101. ("\\(<\\+\\)" #Xe155)
  102. ("\\(<\\+>\\)" #Xe156)
  103. ("\\(<=\\)" #Xe157)
  104. ("\\(<==\\)" #Xe158)
  105. ("\\(<=>\\)" #Xe159)
  106. ("\\(<=<\\)" #Xe15a)
  107. ("\\(<>\\)" #Xe15b)
  108. ("[^-]\\(<<\\)" #Xe15c)
  109. ("\\(<<-\\)" #Xe15d)
  110. ("\\(<<=\\)" #Xe15e)
  111. ("\\(<<<\\)" #Xe15f)
  112. ("\\(<~\\)" #Xe160)
  113. ("\\(<~~\\)" #Xe161)
  114. ("\\(</\\)" #Xe162)
  115. ("\\(</>\\)" #Xe163)
  116. ("\\(~@\\)" #Xe164)
  117. ("\\(~-\\)" #Xe165)
  118. ("\\(~=\\)" #Xe166)
  119. ("\\(~>\\)" #Xe167)
  120. ("[^<]\\(~~\\)" #Xe168)
  121. ("\\(~~>\\)" #Xe169)
  122. ("\\(%%\\)" #Xe16a)
  123. ;; ("\\(x\\)" #Xe16b)
  124. ("[^:=]\\(:\\)[^:=]" #Xe16c)
  125. ("[^\\+<>]\\(\\+\\)[^\\+<>]" #Xe16d)
  126. ("[^\\*/<>]\\(\\*\\)[^\\*/<>]" #Xe16f))))
  127. (defun add-fira-code-symbol-keywords ()
  128. (font-lock-add-keywords nil fira-code-font-lock-keywords-alist))
  129. (when (not (darwin?))
  130. (add-hook 'prog-mode-hook
  131. #'add-fira-code-symbol-keywords))