Adds packages; removes others; updates keybindings; etc

This commit is contained in:
William Carroll 2017-01-13 22:01:45 -05:00
parent 3286a34d17
commit 461824752c

View file

@ -1,15 +1,22 @@
;; William Carroll's Emacs configuration
;; From `https://github.com/melpa/melpa`
(require 'package) (require 'package)
(add-to-list 'package-archives (add-to-list 'package-archives
'("MELPA Stable" . "https://stable.melpa.org/packages/") t) '("melpa" . "https://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize) (package-initialize)
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(column-number-mode t)
'(command-log-mode-window-size 50) '(command-log-mode-window-size 50)
'(custom-safe-themes '(custom-safe-themes
(quote (quote
@ -20,7 +27,10 @@
'(neo-window-width 35) '(neo-window-width 35)
'(package-selected-packages '(package-selected-packages
(quote (quote
(flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil helm-swoop iedit vimrc-mode helm-ispell transpose-frame helm-projectile helm-ack nyan-mode alchemist helm magit dockerfile-mode elm-mode ack)))) (evil-surround erlang elixir-mode golden-ratio flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil helm-swoop iedit vimrc-mode helm-ispell transpose-frame helm-projectile helm-ack nyan-mode alchemist helm magit dockerfile-mode elm-mode ack)))
'(popwin-mode t)
'(popwin:popup-window-height 25)
'(tool-bar-mode nil))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
@ -33,11 +43,20 @@
(load-theme 'atom-one-dark) (load-theme 'atom-one-dark)
;; Scrolling Settings
(setq scroll-step 1)
(setq scroll-conservatively 10000)
;; Properly configure GUI Emacs to use $PATH values ;; Properly configure GUI Emacs to use $PATH values
(when (memq window-system '(mac ns)) (when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)) (exec-path-from-shell-initialize))
;; Trim trailing whitespace on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Emacs backup / autosave files ;; Emacs backup / autosave files
;; (setq-default make-backup-files nil) ;; (setq-default make-backup-files nil)
(setq backup-directory-alist `(("." . "~/.emacs-tmp"))) (setq backup-directory-alist `(("." . "~/.emacs-tmp")))
@ -57,16 +76,17 @@
(global-command-log-mode) (global-command-log-mode)
;; Commenting / Uncommenting
(global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region)
;; Flycheck Settings ;; Flycheck Settings
(add-hook 'after-init-hook #'global-flycheck-mode) ;; (add-hook 'after-init-hook #'global-flycheck-mode)
;; Elixir (Credo) Settings ;; Elixir (Credo) Settings
(eval-after-load 'flycheck ;; (require 'flycheck-credo)
(lambda () ;; (add-hook 'elixir-mode-hook 'flycheck-credo-setup)
(flycheck-credo-setup)
(setq flycheck-elixir-credo-strict t)))
(add-hook 'elixir-mode-hook 'flycheck-mode)
;; Magit Settings ;; Magit Settings
@ -108,6 +128,29 @@
(helm-mode 1) (helm-mode 1)
;; Global search in projects
(global-set-key (kbd "C-x p") 'helm-projectile-ack)
;; disable popwin-mode in an active Helm session It should be disabled
;; otherwise it will conflict with other window opened by Helm persistent
;; action, such as *Help* window.
(require 'popwin)
(push '("^\*helm.+\*$" :regexp t) popwin:special-display-config)
(add-hook 'helm-after-initialize-hook (lambda ()
(popwin:display-buffer helm-buffer t)
(popwin-mode -1)))
;; Restore popwin-mode after a Helm session finishes.
(add-hook 'helm-cleanup-hook (lambda () (popwin-mode 1)))
;; Popwin Helm-Swoop workaround
(defvar helm-swoop-split-window-function
(lambda ($buf)
(display-buffer $buf)))
;; Add 80 column marker ;; Add 80 column marker
(require 'whitespace) (require 'whitespace)
(setq whitespace-line-column 80) ;; limit line length (setq whitespace-line-column 80) ;; limit line length
@ -115,6 +158,14 @@
(add-hook 'prog-mode-hook 'whitespace-mode) (add-hook 'prog-mode-hook 'whitespace-mode)
;; Allow `C-x C-s` to write to unmodified buffers, allowing the file to be `touch`'d
(set-buffer-modified-p t)
;; Git-Commit prog-mode
;; (add-hook 'git-commit-mode 'prog-mode)
;; Projectile Settings ;; Projectile Settings
(projectile-mode t) (projectile-mode t)
(setq projectile-completion-system 'helm) (setq projectile-completion-system 'helm)
@ -122,18 +173,12 @@
(setq projectile-switch-project-action 'helm-projectile) (setq projectile-switch-project-action 'helm-projectile)
;; Elixir Mode
;; Add support for local function invocation highlighting
;; (font-lock-add-keywords 'elixir-mode
;; '(("[_a-z]+\\.\\(" . font-lock-variable-name-face)))
;; Alchemist Settings ;; Alchemist Settings
(require 'alchemist) (require 'alchemist)
(setq alchemist-mix-env "prod") (setq alchemist-mix-env "prod")
(setq alchemist-goto-erlang-source-dir "/usr/local/bin/source/") (setq alchemist-goto-elixir-source-dir "/Users/wpcarro/source_code/elixir")
(setq alchemist-goto-elixir-source-dir "/usr/local/bin/erl") (setq alchemist-goto-erlang-source-dir "/Users/wpcarro/source_code/otp/")
;; Borrow keybinding from list-mode eval ;; Borrow keybinding from list-mode eval
(define-key global-map (kbd "C-j") nil) (define-key global-map (kbd "C-j") nil)
@ -160,6 +205,11 @@
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)) (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter))
;; Evil Surround
(require 'evil-surround)
(global-evil-surround-mode 1)
;; Display column number alongside row number ;; Display column number alongside row number
(column-number-mode t) (column-number-mode t)
@ -205,13 +255,12 @@
(setq-default indent-tabs-mode nil) (setq-default indent-tabs-mode nil)
;; Change font settings ;; Change font settings
(set-face-attribute 'default nil :height 100) (set-frame-font "Operator Mono 10")
(add-to-list 'default-frame-alist '(font . "Operator Mono"))
;; Personalized Evil-mode settings ;; Personalized Evil-mode settings
(defun bootstrap-evil-mode() (defun bootstrap-evil-mode()
"Custom evil-mode settings. This disables Emacs key-bindings found in "Custom evil-mode settings. This disables Emacs key-bindings found in
`global-map` when inside Vim's `normal` mode. It disables Vim key-bindings `global-map` when inside Vim's `normal` mode. It disables Vim key-bindings
when in Vim's `insert` mode, favoring native Emacs bindings instead." when in Vim's `insert` mode, favoring native Emacs bindings instead."
(interactive) (interactive)
@ -245,7 +294,7 @@ when in Vim's `insert` mode, favoring native Emacs bindings instead."
;; Plugin-specific keybindings ;; Plugin-specific keybindings
(register-evil-keybindings-for-neotree) (register-evil-keybindings-for-neotree)
;; Toggle off Vim bindings when in Vim `insert` mode except: ;; Toggle off Vim bindings when in Vim `insert` mode except:
;; * `<escape>` <ESC> ;; * `<escape>` <ESC>
;; * `j k` <ESC> ;; * `j k` <ESC>
@ -254,7 +303,7 @@ when in Vim's `insert` mode, favoring native Emacs bindings instead."
(define-key evil-insert-state-map (kbd "<escape>") 'evil-force-normal-state) (define-key evil-insert-state-map (kbd "<escape>") 'evil-force-normal-state)
(define-key evil-insert-state-map (kbd "j k") 'evil-force-normal-state) (define-key evil-insert-state-map (kbd "j k") 'evil-force-normal-state)
(define-key evil-insert-state-map (kbd "jj") (lambda () (interactive) (insert "j"))) (define-key evil-insert-state-map (kbd "jj") (lambda () (interactive) (insert "j")))
(define-key evil-normal-state-map (kbd "H") 'evil-first-non-blank) (define-key evil-normal-state-map (kbd "H") 'evil-first-non-blank)
(define-key evil-normal-state-map (kbd "L") 'evil-end-of-line)) (define-key evil-normal-state-map (kbd "L") 'evil-end-of-line))