From 2be058b4c61ea73424820ffdc420bf6637dfeb9d Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 25 Jan 2019 17:49:04 +0100 Subject: emacs: added lots of improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From ruby IRB, to better beginning-of-line function, etc. Signed-off-by: Miquel Sabaté Solà --- emacs/custom.el | 2 +- emacs/init.org | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/emacs/custom.el b/emacs/custom.el index 5f5a1e6..1d62472 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -15,7 +15,7 @@ '(markdown-command "/usr/bin/markdown-calibre") '(package-selected-packages (quote - (move-text git-timemachine debbugs async-await request emojify auctex diminish bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) + (inf-ruby move-text git-timemachine debbugs async-await request emojify auctex diminish bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs/init.org b/emacs/init.org index d26ffbf..0a152b6 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -837,7 +837,7 @@ First of all, let's define a function that will be called whenever Evil is loade (dolist (map '(evil-motion-state-map evil-insert-state-map evil-emacs-state-map)) - (define-key (eval map) "\C-a" 'beginning-of-line) + (define-key (eval map) "\C-a" 'crux-move-beginning-of-line) (define-key (eval map) "\C-e" 'end-of-line))) ; I store macros on the register for convenience, so I used to use the @@ -1793,6 +1793,15 @@ confusing. Moreover, I'm also enabling =eldoc-mode= and the aforementioned (setq mode-name "ξ"))) #+END_SRC +Configure =ielm= with the proper ELisp utilities: + +#+BEGIN_SRC elisp +(use-package ielm + :config + (add-hook 'ielm-mode-hook #'eldoc-mode) + (add-hook 'ielm-mode-hook #'rainbow-delimiters-mode)) +#+END_SRC + ** C and C++ C and C++ only require the =warnings-mode-hook= function, spell checking for the @@ -1835,16 +1844,24 @@ CMake for y'all. ** Ruby -Include warning keywords in Ruby. +Include warning keywords in Ruby and do not automatically include the encoding +magic comment: #+BEGIN_SRC elisp - (add-hook 'ruby-mode-hook 'warnings-mode-hook) +(use-package ruby-mode + :config + (setq ruby-insert-encoding-magic-comment nil) + (add-hook 'ruby-mode-hook #'subword-mode) + (add-hook 'ruby-mode-hook 'warnings-mode-hook)) #+END_SRC -Do not automatically include the encoding magic comment: +And give me an IRB instance: #+BEGIN_SRC elisp -(setq ruby-insert-encoding-magic-comment nil) +(use-package inf-ruby + :ensure t + :config + (add-hook 'ruby-mode-hook #'inf-ruby-minor-mode)) #+END_SRC ** Go @@ -2114,6 +2131,12 @@ Finally, I want man pages to fill all the frame: (setq woman-fill-frame t) #+END_SRC +Start =WoMan= as a subcommand of the help command: + +#+BEGIN_SRC elisp +(define-key 'help-command (kbd "M-m") #'woman) +#+END_SRC + * Misc Install a set of useful functions from [[https://github.com/bbatsov][@bbatsov]]. The bindings are following @@ -2127,6 +2150,9 @@ too many things into my leader and these shortcuts look sensible to me). (global-set-key (kbd "C-c d") 'crux-delete-file-and-buffer) (global-set-key (kbd "C-c r") 'crux-rename-file-and-buffer) + (global-set-key (kbd "C-c n") 'crux-cleanup-buffer-or-region) + (global-set-key (kbd "C-") 'crux-kill-line-backwards) + (global-set-key [remap move-beginning-of-line] 'crux-move-beginning-of-line) (global-set-key (kbd "C-c o") 'crux-open-with)) #+END_SRC -- cgit v1.2.3