diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1ba8e5a..b642f64 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -65,8 +65,8 @@ (use-package compile :commands (compile recompile) - :bind ("C-z" . recompile) - :bind ("C-S-z" . compile) + :bind (("C-z" . recompile) + ("C-S-z" . compile)) :config (add-hook 'compilation-start-hook (lambda (x) (setq-local scroll-up-aggressively 0)))) @@ -140,6 +140,7 @@ (use-package org :defer + :bind (:map org-mode-map ("C-z" . org-latex-export-to-pdf)) :config ;; Make windmove work in org-mode: (add-hook 'org-shiftup-final-hook 'windmove-up) @@ -153,7 +154,6 @@ (setq word-wrap t))) (setq org-confirm-babel-evaluate nil) - (define-key org-mode-map (kbd "C-z") 'org-latex-export-to-pdf) (add-to-list 'org-babel-load-languages '(dot . t)) (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))) @@ -168,7 +168,7 @@ (setq company-idle-delay 0.1 company-dabbrev-downcase nil company-dabbrev-ignore-case nil) - (global-set-key (kbd "") 'company-manual-begin)) + (bind-key "" 'company-manual-begin)) (use-package smart-mode-line :ensure :config @@ -186,41 +186,43 @@ :config (eval-after-load "isearch" '(define-key isearch-mode-map (kbd "C-'") 'avy-isearch)) - :bind ("C-;" . avy-goto-char) - :bind ("C-'" . avy-goto-char-2)) + :bind (("C-;" . avy-goto-char) + ("C-'" . avy-goto-char-2))) (use-package smex :ensure :bind ("M-X" . smex-major-mode-commands)) (use-package swiper :ensure - :bind ("C-s" . swiper) - :bind ("C-r" . swiper) - :bind ("C-c C-r" . ivy-resume) + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-c C-r" . ivy-resume) + :map swiper-map ("C-r" . ivy-previous-line-or-history) + :map ivy-minibuffer-map ("C-'" . ivy-avy)) :init - (global-set-key (kbd "C-S-s") 'isearch-forward) - (global-set-key (kbd "C-S-r") 'isearch-backward) - (ivy-mode 1) + (bind-key "C-S-s" 'isearch-forward) + (bind-key "C-S-r" 'isearch-backward) :config - (define-key swiper-map (kbd "C-r") 'ivy-previous-line-or-history) - (define-key ivy-minibuffer-map (kbd "C-'") 'ivy-avy)) + (ivy-mode 1)) (use-package counsel :ensure - :bind ("M-x" . counsel-M-x) - :bind ("C-M-y" . counsel-yank-pop) + :bind (("M-x" . counsel-M-x) + ("C-M-y" . counsel-yank-pop) + ("C-x C-f" . counsel-find-file)) + :init + (bind-key "C-c C-c M-x" 'execute-extended-command) ;;normal M-x. :config (setq ivy-re-builders-alist '((counsel-M-x . ivy--regex-fuzzy) (t . ivy--regex-plus))) - (assq-delete-all 'counsel-M-x ivy-initial-inputs-alist) - (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)) ;;normal M-x.) + (assq-delete-all 'counsel-M-x ivy-initial-inputs-alist)) (use-package ace-window :ensure :bind ("M-p" . ace-window)) (use-package undo-tree :ensure :config - (global-undo-tree-mode) - (global-set-key (kbd "M-/") 'undo-tree-visualize)) + (bind-key "M-/" 'undo-tree-visualize) + (global-undo-tree-mode)) (use-package hydra :ensure :config @@ -248,9 +250,9 @@ (cat-mode :fetcher github :repo "ad1217/emacs-cat-mode") :config (cat-mode 1) + (bind-key "C-x C-M-C" 'kill-this-cat-kill-terminal) (eval-after-load "ibuffer" - '(define-key ibuffer-mode-map (kbd "c") 'cat-set-ibuffer)) - (global-set-key (kbd "C-x C-M-C") 'kill-this-cat-kill-terminal)) + '(define-key ibuffer-mode-map (kbd "c") 'cat-set-ibuffer))) (use-package dired+ :ensure :init @@ -259,8 +261,8 @@ (toggle-diredp-find-file-reuse-dir 1)) (use-package outline-magic :ensure - :config - (define-key outline-minor-mode-map (kbd "M-") 'outline-cycle)) + :demand + :bind (:map outline-minor-mode-map ("M-" . outline-cycle))) ;;;; optional external packages (use-package arduino-mode @@ -313,8 +315,9 @@ :config (setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x latex -x markdown.extensions.sane_lists -x markdown.extensions.toc -x markdown_checklist.extension -c ~/.emacs.d/markdownConfig.yml" markdown-enable-math t) - (local-set-key (kbd "") 'markdown-demote) - (local-set-key (kbd "S-") 'markdown-promote) + :bind (:map markdown-mode-map + ("" . markdown-demote) + ("S-" . markdown-promote)) :mode "\\.md\\'") (use-package projectile @@ -324,7 +327,7 @@ '(:eval (if (file-remote-p default-directory) " P" (format " P[%s]" (projectile-project-name))))) - (define-key projectile-mode-map (kbd "C-S-z") 'projectile-compile-project)) + :bind (:map projectile-mode-map ("C-S-z" . projectile-compile-project))) (use-package scad-mode :mode "\\.scad$" @@ -333,7 +336,7 @@ "Compile current buffer using 'scad-command' and the extention 'ext'" (interactive (list (completing-read "Extension: " '("stl" "off" "amf" "dxf" "svg" "csg" "png")))) (compile (concat scad-command " -o " (file-name-sans-extension buffer-file-name) "." ext " " buffer-file-name))) - (define-key scad-mode-map (kbd "C-c z") 'scad-compile)) + :bind (:map scad-mode-map ("C-c z" . scad-compile))) (use-package smart-tabs-mode :config @@ -362,14 +365,15 @@ ("^[0-9]+-[0-9]+-[0-9]+" 0 '(:foreground "gray90"))))) (use-package latex + :bind (:map LaTeX-mode-map + ("C-z" . latex-save-and-compile) + ("C-c e" . tex-close-latex-block)) :config (setq-default TeX-command-extra-options "-shell-escape") (defun latex-save-and-compile () (interactive) (save-buffer) (TeX-command "LaTeX" 'TeX-master-file -1)) - (define-key LaTeX-mode-map (kbd "C-z") 'latex-save-and-compile) - (define-key LaTeX-mode-map (kbd "C-c e") 'tex-close-latex-block) (add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode) (defun latex-tsv-to-table () "Converts tab-seperated-values to a LaTeX table." @@ -384,8 +388,8 @@ (use-package fasd :config - (global-set-key (kbd "C-x C-S-f") 'fasd-find-file) (global-fasd-mode 1) + (bind-key "C-x C-S-f" 'fasd-find-file) (setq fasd-enable-initial-prompt nil fasd-completing-read-function 'ivy-completing-read))