2018-04-25 19:26:53 +02:00
|
|
|
;;; keybindings.el --- My Evil preferences -*- lexical-binding: t -*-
|
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; This module hosts my Evil preferences
|
2019-01-13 20:33:17 +01:00
|
|
|
;;
|
|
|
|
;; Wish List:
|
|
|
|
;; - drop support for `evil-leader' library in favor of `general.el'
|
|
|
|
;; - restore support for concise (n <kbd> <function>) instead of `general-mmap'
|
|
|
|
;; - restore support for `general-unbind'
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(use-package evil
|
|
|
|
:init
|
|
|
|
(setq evil-want-integration nil)
|
2019-01-13 20:33:17 +01:00
|
|
|
(general-evil-setup)
|
2018-04-25 19:26:53 +02:00
|
|
|
:config
|
2019-01-13 20:33:17 +01:00
|
|
|
(general-mmap
|
|
|
|
:keymaps 'override
|
|
|
|
"RET" #'evil-goto-line
|
|
|
|
"H" #'evil-first-non-blank
|
|
|
|
"L" #'evil-end-of-line
|
|
|
|
"-" #'dired-jump
|
|
|
|
"sl" #'wpc/evil-window-vsplit-right
|
|
|
|
"sh" #'evil-window-vsplit
|
|
|
|
"sk" #'evil-window-split
|
|
|
|
"sj" #'wpc/evil-window-split-down)
|
|
|
|
(general-nmap
|
|
|
|
:keymaps 'override
|
|
|
|
"gd" #'xref-find-definitions)
|
|
|
|
(general-unbind 'motion "M-." "C-p")
|
|
|
|
(general-unbind 'normal "s" "M-.")
|
|
|
|
(general-unbind 'insert "C-d" "C-a" "C-e" "C-n" "C-p" "C-k")
|
2018-04-25 19:26:53 +02:00
|
|
|
(setq evil-symbol-word-search t)
|
|
|
|
(evil-mode 1))
|
|
|
|
|
|
|
|
;; evil keybindings
|
|
|
|
(use-package evil-collection
|
2019-01-13 20:33:17 +01:00
|
|
|
:after (evil)
|
2018-04-25 19:26:53 +02:00
|
|
|
:config
|
|
|
|
(evil-collection-init))
|
|
|
|
|
|
|
|
;; expose a leader key
|
|
|
|
(use-package evil-leader
|
|
|
|
:after (evil counsel)
|
|
|
|
:config
|
|
|
|
(global-evil-leader-mode)
|
|
|
|
(evil-leader/set-leader "<SPC>")
|
|
|
|
;; global
|
|
|
|
(evil-leader/set-key
|
|
|
|
"i" #'counsel-semantic-or-imenu
|
|
|
|
"j" #'jump-to-register
|
|
|
|
"h" #'help
|
|
|
|
"a" #'wpc/toggle-terminal
|
2018-09-04 21:01:07 +02:00
|
|
|
"p" #'flycheck-previous-error
|
2018-04-25 19:26:53 +02:00
|
|
|
"P" #'counsel-git-grep
|
|
|
|
"f" #'wpc/find-file
|
2018-07-17 00:28:19 +02:00
|
|
|
"n" #'flycheck-next-error
|
2018-04-25 19:26:53 +02:00
|
|
|
"N" #'smerge-next
|
|
|
|
"P" #'smerge-prev
|
|
|
|
"b" #'ivy-switch-buffer
|
|
|
|
"gs" #'magit-status
|
2019-03-05 19:26:53 +01:00
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
"es" #'wpc/create-snippet
|
2019-03-05 19:26:53 +01:00
|
|
|
"ev" (lambda () (interactive) (wpc/find-file-split "~/.config/nvim/init.vim"))
|
|
|
|
"ee" (lambda () (interactive) (wpc/find-file-split "~/.emacs.d/init.el"))
|
|
|
|
"ez" (lambda () (interactive) (wpc/find-file-split "~/.zshrc"))
|
|
|
|
"ea" (lambda () (interactive) (wpc/find-file-split "~/aliases.zsh"))
|
|
|
|
"ef" (lambda () (interactive) (wpc/find-file-split "~/functions.zsh"))
|
|
|
|
"el" (lambda () (interactive) (wpc/find-file-split "~/variables.zsh"))
|
2019-03-06 17:59:45 +01:00
|
|
|
"ex" (lambda () (interactive) (wpc/find-file-split "~/.Xresources"))
|
2019-03-05 19:26:53 +01:00
|
|
|
"ei" (lambda () (interactive) (wpc/find-file-split "~/.config/i3/config"))
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
"em" (lambda () (interactive) (wpc/find-file-split "~/.tmux.conf"))
|
2019-03-05 19:26:53 +01:00
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
"B" #'magit-blame
|
|
|
|
"w" #'save-buffer
|
|
|
|
"x" #'evil-save-and-close
|
|
|
|
"W" #'save-all-buffers
|
|
|
|
"r" #'wpc/evil-replace-under-point
|
|
|
|
))
|
|
|
|
|
|
|
|
;; create comments easily
|
|
|
|
(use-package evil-commentary
|
|
|
|
:after (evil)
|
|
|
|
:config
|
|
|
|
(evil-commentary-mode))
|
|
|
|
|
|
|
|
;; evil surround
|
|
|
|
(use-package evil-surround
|
|
|
|
:after (evil)
|
|
|
|
:config
|
|
|
|
(global-evil-surround-mode 1))
|
|
|
|
|
2019-03-20 16:03:03 +01:00
|
|
|
(defun wpc/ensure-kbds (_ignore)
|
2018-04-25 19:26:53 +02:00
|
|
|
"Try to ensure that my keybindings retain priority over other minor modes."
|
|
|
|
(unless (eq (caar minor-mode-map-alist) 'wpc/kbds-minor-mode)
|
|
|
|
(let ((mykbds (assq 'wpc/kbds-minor-mode minor-mode-map-alist)))
|
|
|
|
(assq-delete-all 'wpc/kbds-minor-mode minor-mode-map-alist)
|
|
|
|
(add-to-list 'minor-mode-map-alist mykbds))))
|
|
|
|
|
2019-03-20 16:03:03 +01:00
|
|
|
;; Custom minor mode that ensures that my kbds are available no matter which
|
|
|
|
;; major or minor modes are active.
|
|
|
|
(add-hook 'after-load-functions #'wpc/ensure-kbds)
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
(defvar wpc/kbds
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(bind-keys :map map
|
|
|
|
("M-q" . delete-window)
|
|
|
|
("C-x C-;" . comment-or-uncomment-region)
|
|
|
|
("C-x h" . help)
|
|
|
|
("<s-return>" . toggle-frame-fullscreen)
|
|
|
|
("<down-mouse-1>" . ffap-other-window)
|
|
|
|
("M-h" . wpc/tmux-emacs-windmove-left)
|
|
|
|
("M-l" . wpc/tmux-emacs-windmove-right)
|
|
|
|
("M-k" . wpc/tmux-emacs-windmove-up)
|
|
|
|
("M-j" . wpc/tmux-emacs-windmove-down)
|
2019-03-06 17:59:45 +01:00
|
|
|
("M--" . wpc/evil-window-split-down)
|
|
|
|
("M-\\" . wpc/evil-window-vsplit-right)
|
2018-04-25 19:26:53 +02:00
|
|
|
("M-q" . delete-window))
|
|
|
|
map)
|
|
|
|
"William Carroll's keybindings that should have the highest precedence.")
|
|
|
|
|
|
|
|
(define-minor-mode wpc/kbds-minor-mode
|
|
|
|
"A minor mode so that my key settings override annoying major modes."
|
|
|
|
:init-value t
|
|
|
|
:lighter " wpc/kbds"
|
|
|
|
:keymap wpc/kbds)
|
|
|
|
|
|
|
|
;; allow jk to escape
|
|
|
|
(use-package key-chord
|
|
|
|
:after (evil)
|
|
|
|
:config
|
|
|
|
(key-chord-mode 1)
|
|
|
|
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state))
|
|
|
|
|
|
|
|
(provide 'wpc-keybindings)
|
|
|
|
;;; wpc-keybindings.el ends here
|