dotfiles/.doom.d/config.el

124 lines
4.3 KiB
EmacsLisp

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; refresh' after modifying this file!
;; These are used for a number of things, particularly for GPG configuration,
;; some email clients, file templates and snippets.
(setq user-full-name "inigoortega"
user-mail-address "inigoortega@tutanota.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
;; test
(setq doom-font (font-spec :family "monospace" :width 'normal :size 17)
doom-variable-pitch-font (font-spec :family "monospace"))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. These are the defaults.
(setq doom-theme 'doom-gruvbox)
;; If you intend to use org, it is recommended you change this!
(setq org-directory "~/org/")
;; If you want to change the style of line numbers, change this to `relative' or
;; `nil' to disable it:
(setq display-line-numbers-type 'relative)
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', where Emacs
;; looks when you load packages with `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c g k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c g d') to jump to their definition and see how
;; they are implemented.
;;;; Functions
(defun eval-string (string)
"Evals all the commands inside the string"
(eval (car (read-from-string (format "(progn %s)" string)))))
;;;; Configs
(elpy-enable)
;;; Cut lines on 80
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default auto-fill-function 'do-auto-fill)
;;; Replace with Regiser
(map! :n "g r" #'evil-replace-with-register)
;;; Evil surround
(global-evil-surround-mode t)
;;; Haskell
(add-hook! 'haskell-mode-hook #'hindent-mode (lambda() (add-hook!
'before-save-hook
(hindent-reformat-buffer) nil 'local)))
;;; Use IPython for REPL
(setq python-shell-interpreter "jupyter"
python-shell-interpreter-args "console --simple-prompt"
python-shell-prompt-detect-failure-warning nil)
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")
;;; Delete other windows
(map! :n "SPC w D" #'delete-other-windows)
;;; Shell scrit highlighting
;;;;;;;;;;;;;;;;;;;;;;
;; bah! sh-mode beatification. Need a better solution...
(defun highlight-commands-on-sh-mode (sh-commands)
"Makes given commands be highlighted on sh-mode"
(setq formatted-commands
(concat "\\\\<\\\\(" (mapconcat 'identity
sh-commands "\\\\|") "\\\\)\\\\>"))
(eval-string (format "(font-lock-add-keywords 'sh-mode '((\"%s\" .
font-lock-builtin-face)))" formatted-commands))
;; highlight options
(font-lock-add-keywords
'sh-mode
'(("\\<-[-a-zA-Z0-9]+\\>"
. font-lock-constant-face)))
(font-lock-add-keywords
'sh-mode
`((,(concat "[ \t]+"
(regexp-opt
'("!" "!=" "==" "=~") 'paren) "[ \t]+")
. font-lock-constant-face)))
)
(setq sh-commands
'("sed" "tail" "printf" "echo" "pidof" "top" "dmenu" "rofi" "killall"
"sed" "awk" "tee" "basename" "ln" "mkdir" "rm" "ssh" "sleep" "source"
"ps" "bash" "python" "perl" "Rscript" "wget" "bunzip2" "bzip2" "zip"
"unzip" "gzip" "gunzip" "find" "ls" "cat" "egrep" "grep" "mv" "cp"
"chmod" "tar" "stty" "export" "spark-shell" "spark-submit" "hadoop"
"pyspark" "aws"
))
(highlight-commands-on-sh-mode sh-commands)