Ligature & Haskell Language Support

- Add gitignore for local files that shouldn't be tracked
- Add ligature.el as a submodule to enable ligature support for Fira Code
- Add haskell org template & language mode
This commit is contained in:
Sravan Balaji
2021-05-04 20:28:39 -04:00
parent 2884cf5c13
commit 45132b934b
5 changed files with 73 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
auto-save-list/*
elpa/*
projectile-bookmarks.eld
transient/*

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "packages/ligature.el"]
path = packages/ligature.el
url = git@github.com:mickeynp/ligature.el.git

View File

@@ -97,6 +97,36 @@ Setup FiraCode and Cantarell fonts with specified size.
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height sb/default-font-size :weight 'regular) (set-face-attribute 'variable-pitch nil :font "Cantarell" :height sb/default-font-size :weight 'regular)
#+end_src #+end_src
** Ligature Support
Add ligature support for Fira Code font.
- https://github.com/tonsky/FiraCode/wiki/Emacs-instructions#using-ligatureel
#+begin_src emacs-lisp
(use-package ligature
:load-path "./packages/ligature.el"
:config
;; Enable the "www" ligature in every possible major mode
(ligature-set-ligatures 't '("www"))
;; Enable traditional ligature support in eww-mode, if the
;; `variable-pitch' face supports it
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
;; Enable ligatures in programming modes (Fira Code)
(ligature-set-ligatures 'prog-mode '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\" "{-" "::"
":::" ":=" "!!" "!=" "!==" "-}" "----" "-->" "->" "->>"
"-<" "-<<" "-~" "#{" "#[" "##" "###" "####" "#(" "#?" "#_"
"#_(" ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*" "/**"
"/=" "/==" "/>" "//" "///" "&&" "||" "||=" "|=" "|>" "^=" "$>"
"++" "+++" "+>" "=:=" "==" "===" "==>" "=>" "=>>" "<="
"=<<" "=/=" ">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>" "<*"
"<*>" "<|" "<|>" "<$" "<$>" "<!--" "<-" "<--" "<->" "<+"
"<+>" "<=" "<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<"
"<~" "<~~" "</" "</>" "~@" "~-" "~>" "~~" "~~>" "%%"))
;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'.
(global-ligature-mode t))
#+end_src
* Keybindings * Keybindings
** General ** General
@@ -478,6 +508,7 @@ Use Hydra to design a transient key binding for quickly adjusting the scale of t
(add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("py" . "src python"))
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
#+end_src #+end_src
** Auto-Tangle Configuration Files ** Auto-Tangle Configuration Files
@@ -507,6 +538,14 @@ Automatically tangle code blocks in file everytime it is saved.
** Languages ** Languages
*** Language Modes
**** Haskell
#+begin_src emacs-lisp
(use-package haskell-mode)
#+end_src
*** Language Servers *** Language Servers
#+begin_src emacs-lisp #+begin_src emacs-lisp

26
init.el
View File

@@ -50,6 +50,29 @@
;; Set the variable pitch face ;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height sb/default-font-size :weight 'regular) (set-face-attribute 'variable-pitch nil :font "Cantarell" :height sb/default-font-size :weight 'regular)
(use-package ligature
:load-path "./packages/ligature.el"
:config
;; Enable the "www" ligature in every possible major mode
(ligature-set-ligatures 't '("www"))
;; Enable traditional ligature support in eww-mode, if the
;; `variable-pitch' face supports it
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
;; Enable ligatures in programming modes (Fira Code)
(ligature-set-ligatures 'prog-mode '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\" "{-" "::"
":::" ":=" "!!" "!=" "!==" "-}" "----" "-->" "->" "->>"
"-<" "-<<" "-~" "#{" "#[" "##" "###" "####" "#(" "#?" "#_"
"#_(" ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*" "/**"
"/=" "/==" "/>" "//" "///" "&&" "||" "||=" "|=" "|>" "^=" "$>"
"++" "+++" "+>" "=:=" "==" "===" "==>" "=>" "=>>" "<="
"=<<" "=/=" ">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>" "<*"
"<*>" "<|" "<|>" "<$" "<$>" "<!--" "<-" "<--" "<->" "<+"
"<+>" "<=" "<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<"
"<~" "<~~" "</" "</>" "~@" "~-" "~>" "~~" "~~>" "%%"))
;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'.
(global-ligature-mode t))
;; Make ESC quit prompts ;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
@@ -363,6 +386,7 @@
(add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("py" . "src python"))
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
;; Automatically tangle our Emacs.org config file when we save it ;; Automatically tangle our Emacs.org config file when we save it
(defun sb/org-babel-tangle-config () (defun sb/org-babel-tangle-config ()
@@ -377,6 +401,8 @@
(use-package evil-nerd-commenter (use-package evil-nerd-commenter
:bind ("M-/" . evilnc-comment-or-uncomment-lines)) :bind ("M-/" . evilnc-comment-or-uncomment-lines))
(use-package haskell-mode)
(defun sb/lsp-mode-setup () (defun sb/lsp-mode-setup ()
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode)) (lsp-headerline-breadcrumb-mode))

1
packages/ligature.el Submodule

Submodule packages/ligature.el added at 5d758491ee