Doom emacs updates
This commit is contained in:
parent
143d381c4d
commit
2ee4bde4e3
3 changed files with 313 additions and 94 deletions
|
@ -1,97 +1,32 @@
|
|||
;;; $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
|
||||
;; -*- lexical-binding: t -*-
|
||||
(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)
|
||||
(setq org-directory "~/org/")
|
||||
(setq sh-symbols
|
||||
'(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 dash xdotool xprop 7z p7z zsh fish expr command disown pv
|
||||
))
|
||||
|
||||
|
||||
;; 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
|
||||
(setq path-to-ctags "/usr/bin/ctags")
|
||||
(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 script highlighting
|
||||
(defun highlight-words-on-mode (mode words)
|
||||
"Makes given commands be highlighted on sh-mode"
|
||||
(defun highlight-words-on-mode (mode symbols)
|
||||
"Makes given symbols be highlighted on given mode"
|
||||
(setq strings (mapcar 'symbol-name symbols))
|
||||
(setq formatted-words
|
||||
(concat "\\\\<\\\\(" (mapconcat 'identity
|
||||
words "\\\\|") "\\\\)\\\\>"))
|
||||
strings "\\\\|") "\\\\)\\\\>"))
|
||||
(eval-string (format "(font-lock-add-keywords 'sh-mode '((\"%s\" .
|
||||
font-lock-builtin-face)))" formatted-words))
|
||||
|
||||
|
@ -108,13 +43,66 @@ font-lock-builtin-face)))" formatted-words))
|
|||
. font-lock-constant-face)))
|
||||
)
|
||||
|
||||
(setq words
|
||||
'("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"
|
||||
))
|
||||
(defun create-tags (dir-name)
|
||||
"Create tags file."
|
||||
(interactive "DDirectory: ")
|
||||
(shell-command
|
||||
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name)))
|
||||
)
|
||||
(map! :n "g r" #'evil-replace-with-register)
|
||||
(map! :n "SPC w D" #'delete-other-windows)
|
||||
(setq min-char 35)
|
||||
(setq max-char 250)
|
||||
|
||||
(highlight-words-on-mode 'sh-mode words)
|
||||
(setq i-keys (mapcar
|
||||
(lambda (number) (setq command (format "i%c" number)))
|
||||
(number-sequence min-char 91)))
|
||||
(nconc i-keys (mapcar
|
||||
(lambda (number) (setq command (format "i%c" number)))
|
||||
(number-sequence 93 max-char)))
|
||||
(mapcar
|
||||
(lambda (command) (eval-string
|
||||
(format "(map! :i \"%s\" (lambda() (interactive) (insert \"%s\")))"
|
||||
command command)))
|
||||
i-keys)
|
||||
;; (mapcar
|
||||
;; (lambda (command) (eval-string
|
||||
;; (format "(map! :i \"%s\" (lambda() (interactive) (insert \"%s\")))"
|
||||
;; command command)))
|
||||
;; i-keys)
|
||||
|
||||
;; Exceptions
|
||||
(map! :i "i !" (lambda() (interactive) (insert "i!")))
|
||||
(map! :i "i \"" (lambda() (interactive) (insert (format "i%c" 34))))
|
||||
(map! :i "i SPC" (lambda() (interactive) (insert "i ")))
|
||||
(map! :i "i \\" (lambda() (interactive) (insert "i\\")))
|
||||
|
||||
;; i i
|
||||
(map! :i "i i" #'evil-normal-state)
|
||||
(show-paren-mode 1)
|
||||
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
||||
(setq-default auto-fill-function 'do-auto-fill)
|
||||
(global-visual-line-mode)
|
||||
(global-evil-surround-mode t)
|
||||
(vimish-fold-global-mode 1)
|
||||
;; Default user.
|
||||
(setq rcirc-default-nick "initega")
|
||||
(setq rcirc-default-user-name "initega")
|
||||
(setq rcirc-default-full-name "initega")
|
||||
(add-hook! 'haskell-mode-hook #'hindent-mode (lambda() (add-hook!
|
||||
'before-save-hook
|
||||
(progn
|
||||
(hindent-reformat-buffer)
|
||||
(recenter-top-bottom)
|
||||
) nil 'local)))
|
||||
|
||||
(add-hook 'haskell-mode-hook (lambda () (interactive) (haskell-indentation-mode) (interactive-haskell-mode) (yas-minor-mode)))
|
||||
(elpy-enable)
|
||||
|
||||
;;; 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")
|
||||
(highlight-words-on-mode 'sh-mode sh-symbols)
|
||||
|
|
231
.doom.d/config.org
Normal file
231
.doom.d/config.org
Normal file
|
@ -0,0 +1,231 @@
|
|||
#+TITLE: My Doom Emacs config
|
||||
#+AUTHOR: Iñigo Ortega
|
||||
#+EMAIL: inigoortega@tutanota.com
|
||||
#+LANGUAGE: en
|
||||
#+STARTUP: inlineimages
|
||||
#+PROPERTY: header-args :tangle yes :cache yes :results silent :padline no :config literate
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: README
|
||||
|
||||
* Lexical binding
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; -*- lexical-binding: t -*-
|
||||
#+END_SRC
|
||||
* User configs
|
||||
These are used for a number of things, particularly for GPG configuration,
|
||||
some email clients, file templates and snippets.
|
||||
#+BEGIN_SRC elisp
|
||||
(setq user-full-name "inigoortega"
|
||||
user-mail-address "inigoortega@tutanota.com")
|
||||
#+END_SRC
|
||||
|
||||
* Style
|
||||
** Fonts
|
||||
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
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq doom-font (font-spec :family "monospace" :width 'normal :size 17)
|
||||
doom-variable-pitch-font (font-spec :family "monospace"))
|
||||
#+END_SRC
|
||||
|
||||
** Theme
|
||||
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.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq doom-theme 'doom-gruvbox)
|
||||
#+END_SRC
|
||||
|
||||
** Line numbers
|
||||
If you want to change the style of line numbers, change this to `relative' or
|
||||
`nil' to disable it:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq display-line-numbers-type 'relative)
|
||||
#+END_SRC
|
||||
|
||||
* Org
|
||||
If you intend to use org, it is recommended you change this!
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-directory "~/org/")
|
||||
#+END_SRC
|
||||
|
||||
* Custom variables
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq sh-symbols
|
||||
'(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 dash xdotool xprop 7z p7z zsh fish expr command disown pv
|
||||
))
|
||||
|
||||
(setq path-to-ctags "/usr/bin/ctags")
|
||||
#+END_SRC
|
||||
* Custom functions
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun eval-string (string)
|
||||
"Evals all the commands inside the string"
|
||||
(eval (car (read-from-string (format "(progn %s)" string)))))
|
||||
|
||||
;;; Shell script highlighting
|
||||
(defun highlight-words-on-mode (mode symbols)
|
||||
"Makes given symbols be highlighted on given mode"
|
||||
(setq strings (mapcar 'symbol-name symbols))
|
||||
(setq formatted-words
|
||||
(concat "\\\\<\\\\(" (mapconcat 'identity
|
||||
strings "\\\\|") "\\\\)\\\\>"))
|
||||
(eval-string (format "(font-lock-add-keywords 'sh-mode '((\"%s\" .
|
||||
font-lock-builtin-face)))" formatted-words))
|
||||
|
||||
;; highlight options
|
||||
(font-lock-add-keywords
|
||||
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)))
|
||||
)
|
||||
|
||||
(defun create-tags (dir-name)
|
||||
"Create tags file."
|
||||
(interactive "DDirectory: ")
|
||||
(shell-command
|
||||
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name)))
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
* Custom keybindings
|
||||
Replace with Regiser:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :n "g r" #'evil-replace-with-register)
|
||||
#+END_SRC
|
||||
|
||||
Delete other windows:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :n "SPC w D" #'delete-other-windows)
|
||||
#+END_SRC
|
||||
|
||||
'ii' in INSERT mode to escape to NORMAL mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq min-char 35)
|
||||
(setq max-char 250)
|
||||
|
||||
(setq i-keys (mapcar
|
||||
(lambda (number) (setq command (format "i%c" number)))
|
||||
(number-sequence min-char 91)))
|
||||
(nconc i-keys (mapcar
|
||||
(lambda (number) (setq command (format "i%c" number)))
|
||||
(number-sequence 93 max-char)))
|
||||
(mapcar
|
||||
(lambda (command) (eval-string
|
||||
(format "(map! :i \"%s\" (lambda() (interactive) (insert \"%s\")))"
|
||||
command command)))
|
||||
i-keys)
|
||||
;; (mapcar
|
||||
;; (lambda (command) (eval-string
|
||||
;; (format "(map! :i \"%s\" (lambda() (interactive) (insert \"%s\")))"
|
||||
;; command command)))
|
||||
;; i-keys)
|
||||
|
||||
;; Exceptions
|
||||
(map! :i "i !" (lambda() (interactive) (insert "i!")))
|
||||
(map! :i "i \"" (lambda() (interactive) (insert (format "i%c" 34))))
|
||||
(map! :i "i SPC" (lambda() (interactive) (insert "i ")))
|
||||
(map! :i "i \\" (lambda() (interactive) (insert "i\\")))
|
||||
|
||||
;; i i
|
||||
(map! :i "i i" #'evil-normal-state)
|
||||
#+END_SRC
|
||||
|
||||
* Custom configuration
|
||||
** General
|
||||
Paren mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(show-paren-mode 1)
|
||||
#+END_SRC
|
||||
|
||||
Cutting lines at 80th character:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
||||
(setq-default auto-fill-function 'do-auto-fill)
|
||||
#+END_SRC
|
||||
|
||||
Wrap lines if there is no more space in the window:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(global-visual-line-mode)
|
||||
#+END_SRC
|
||||
|
||||
Evil-surround work everywhere:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(global-evil-surround-mode t)
|
||||
#+END_SRC
|
||||
|
||||
Folding
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(vimish-fold-global-mode 1)
|
||||
#+END_SRC
|
||||
|
||||
IRC (not working):
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; Default user.
|
||||
(setq rcirc-default-nick "initega")
|
||||
(setq rcirc-default-user-name "initega")
|
||||
(setq rcirc-default-full-name "initega")
|
||||
#+END_SRC
|
||||
** Haskell
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook! 'haskell-mode-hook #'hindent-mode (lambda() (add-hook!
|
||||
'before-save-hook
|
||||
(progn
|
||||
(hindent-reformat-buffer)
|
||||
(recenter-top-bottom)
|
||||
) nil 'local)))
|
||||
|
||||
(add-hook 'haskell-mode-hook (lambda () (interactive) (haskell-indentation-mode) (interactive-haskell-mode) (yas-minor-mode)))
|
||||
#+END_SRC
|
||||
** Python
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(elpy-enable)
|
||||
|
||||
;;; 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")
|
||||
#+END_SRC
|
||||
** Shell script
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(highlight-words-on-mode 'sh-mode sh-symbols)
|
||||
#+END_SRC
|
||||
|
||||
* Doom info
|
||||
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.
|
|
@ -65,8 +65,8 @@
|
|||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
:term
|
||||
;;eshell ; a consistent, cross-platform shell (WIP)
|
||||
;;shell ; a terminal REPL for Emacs
|
||||
eshell ; a consistent, cross-platform shell (WIP)
|
||||
shell ; a terminal REPL for Emacs
|
||||
;;term ; terminals in Emacs
|
||||
;;vterm ; another terminals in Emacs
|
||||
|
||||
|
@ -156,19 +156,19 @@
|
|||
;;web ; the tubes
|
||||
|
||||
:email
|
||||
(mu4e +gmail)
|
||||
;;(mu4e +gmail)
|
||||
;;notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
calendar
|
||||
;;irc ; how neckbeards socialize
|
||||
irc ; how neckbeards socialize
|
||||
;;(rss +org) ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
;;write ; emacs for writers (fiction, notes, papers, etc.)
|
||||
|
||||
:config
|
||||
;;literate
|
||||
literate
|
||||
(default +bindings +smartparens))
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
|
|
Loading…
Reference in a new issue