Add :ui pretty-code & set-pretty-symbols! autodef
Along with defaults for C/C++, elm, elisp, js, typescript, web-mode, and org-mode. Thanks to @ar1a for inspiration.
This commit is contained in:
parent
b991af552c
commit
ec8ae0bedc
9 changed files with 183 additions and 5 deletions
|
@ -60,6 +60,22 @@ compilation database is present in the project.")
|
|||
:config
|
||||
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\}))
|
||||
|
||||
(set-pretty-symbols! '(c-mode-hook c++-mode-hook)
|
||||
;; Functional
|
||||
;; :def "void "
|
||||
;; Types
|
||||
:null "nullptr"
|
||||
:true "true" :false "false"
|
||||
:int "int" :float "float"
|
||||
:str "std::string"
|
||||
:bool "bool"
|
||||
;; Flow
|
||||
:not "!"
|
||||
:and "&&" :or "||"
|
||||
:for "for"
|
||||
:return "return"
|
||||
:yield "#require")
|
||||
|
||||
;;; Better fontification (also see `modern-cpp-font-lock')
|
||||
(add-hook 'c-mode-common-hook #'rainbow-delimiters-mode)
|
||||
(add-hook! '(c-mode-hook c++-mode-hook)
|
||||
|
|
|
@ -6,7 +6,16 @@
|
|||
(after! elm-mode
|
||||
(add-hook 'elm-mode-hook #'rainbow-delimiters-mode)
|
||||
(set-company-backend! 'elm-mode 'company-elm)
|
||||
(set-repl-handler! 'elm-mode #'run-elm-interactive))
|
||||
(set-repl-handler! 'elm-mode #'run-elm-interactive)
|
||||
(set-pretty-symbols! 'elm-mode
|
||||
:null "null"
|
||||
:true "true" :false "false"
|
||||
:int "Int" :str "String"
|
||||
:float "Float"
|
||||
:bool "Bool"
|
||||
|
||||
:not "not"
|
||||
:and "&&" :or "||"))
|
||||
|
||||
|
||||
(def-package! flycheck-elm
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
(set-lookup-handlers! 'emacs-lisp-mode :documentation 'info-lookup-symbol)
|
||||
(set-docset! '(lisp-mode emacs-lisp-mode) "Emacs Lisp")
|
||||
|
||||
(set-pretty-symbols! 'emacs-lisp-mode
|
||||
:lambda "lambda")
|
||||
|
||||
(set-rotate-patterns! 'emacs-lisp-mode
|
||||
:symbols '(("t" "nil")
|
||||
("let" "let*")
|
||||
|
@ -31,8 +34,6 @@
|
|||
(font-lock-add-keywords
|
||||
nil `(;; Highlight custom Doom cookies
|
||||
("^;;;###\\(autodef\\|if\\)[ \n]" (1 font-lock-warning-face t))
|
||||
;; Display "lambda" as λ
|
||||
("(\\(lambda\\)" (1 (ignore (compose-region (match-beginning 1) (match-end 1) ?λ #'decompose-region))))
|
||||
;; Highlight doom/module functions
|
||||
("\\(^\\|\\s-\\|,\\)(\\(\\(doom\\|\\+\\)[^) ]+\\|[^) ]+!\\)[) \n]" (2 font-lock-keyword-face)))))
|
||||
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
;;; lang/javascript/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(after! (:any js2-mode web-mode)
|
||||
(set-pretty-symbols! '(js2-mode web-mode)
|
||||
'(;; Functional
|
||||
:def "function"
|
||||
:lambda "() =>"
|
||||
:composition "compose"
|
||||
;; Types
|
||||
:null "null"
|
||||
:true "true" :false "false"
|
||||
;; Flow
|
||||
:not "!"
|
||||
:and "&&" :or "||"
|
||||
:for "for"
|
||||
:return "return"
|
||||
;; Other
|
||||
:yield "import")))
|
||||
|
||||
|
||||
;;
|
||||
;; Major modes
|
||||
;;
|
||||
|
@ -66,7 +84,23 @@
|
|||
(after! typescript-mode
|
||||
(add-hook! 'typescript-mode-hook #'(flycheck-mode rainbow-delimiters-mode))
|
||||
(set-electric! 'typescript-mode
|
||||
:chars '(?\} ?\)) :words '("||" "&&")))
|
||||
:chars '(?\} ?\)) :words '("||" "&&"))
|
||||
(set-pretty-symbols! 'typescript-mode
|
||||
;; Functional
|
||||
:def "function"
|
||||
:lambda "() =>"
|
||||
:composition "compose"
|
||||
;; Types
|
||||
:null "null"
|
||||
:true "true" :false "false"
|
||||
:int "number"
|
||||
:str "string"
|
||||
:bool "boolean"
|
||||
;; Flow
|
||||
:not "!"
|
||||
:and "&&" :or "||"
|
||||
:for "for"
|
||||
:return "return" :yield "import"))
|
||||
|
||||
|
||||
;; `coffee-mode'
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
+org|setup-popups-rules
|
||||
+org|setup-agenda
|
||||
+org|setup-keybinds
|
||||
+org|setup-hacks))
|
||||
+org|setup-hacks
|
||||
+org|setup-pretty-code))
|
||||
|
||||
(add-hook! 'org-mode-hook
|
||||
#'(doom|disable-line-numbers ; org doesn't really need em
|
||||
|
@ -151,6 +152,13 @@ unfold to point on startup."
|
|||
((size . 0.2))
|
||||
((quit) (select . t))))))
|
||||
|
||||
(defun +org|setup-pretty-code ()
|
||||
"Setup the default pretty symbols for"
|
||||
(set-pretty-symbols! 'org-mode
|
||||
:name "#+NAME:"
|
||||
:src_block "#+BEGIN_SRC"
|
||||
:src_block_end "#+END_SRC"))
|
||||
|
||||
(defun +org|setup-ui ()
|
||||
"Configures the UI for `org-mode'."
|
||||
(setq-default
|
||||
|
|
|
@ -28,6 +28,24 @@ is loaded.")
|
|||
(set-electric! 'python-mode :chars '(?:))
|
||||
(set-repl-handler! 'python-mode #'+python/repl)
|
||||
|
||||
(set-pretty-symbols! 'python-mode
|
||||
;; Functional
|
||||
:def "def"
|
||||
:lambda "lambda"
|
||||
;; Types
|
||||
:null "None"
|
||||
:true "True" :false "False"
|
||||
:int "int" :str "str"
|
||||
:float "float"
|
||||
:bool "bool"
|
||||
:tuple "tuple"
|
||||
;; Flow
|
||||
:not "not"
|
||||
:in "in" :not-in "not in"
|
||||
:and "and" :or "or"
|
||||
:for "for"
|
||||
:return "return" :yield "yield")
|
||||
|
||||
(when (executable-find "ipython")
|
||||
(setq python-shell-interpreter "ipython"
|
||||
python-shell-interpreter-args "-i --simple-prompt --no-color-info"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue