122 lines
2.9 KiB
EmacsLisp
122 lines
2.9 KiB
EmacsLisp
;;; earnecore-keybinds.el --- Evil mode and keys -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 2021 earnest ma
|
|
;; SPDX-License-Identifier: MIT
|
|
;; Author: earnest ma <me@earne.link>
|
|
|
|
;;; Code:
|
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
;; Evil
|
|
(use-package evil
|
|
:demand
|
|
:init
|
|
(setq evil-want-integration t)
|
|
(setq evil-want-keybinding nil)
|
|
(setq evil-want-fine-undo t)
|
|
:config
|
|
(evil-mode 1)
|
|
(setq evil-split-window-below t
|
|
evil-vsplit-window-right t)
|
|
(evil-ex-define-cmd "W" 'evil-write-all)
|
|
(evil-ex-define-cmd "Q" 'save-buffers-kill-emacs))
|
|
|
|
;; which-key
|
|
(use-package which-key
|
|
:demand
|
|
:config
|
|
(which-key-mode))
|
|
|
|
;; General
|
|
(use-package general
|
|
:demand
|
|
:config
|
|
(general-create-definer earnemacs-spc-def
|
|
:states '(normal emacs insert visual)
|
|
:prefix "SPC"
|
|
:non-normal-prefix "C-SPC")
|
|
|
|
;; Base SPC keybindings
|
|
(earnemacs-spc-def
|
|
"." 'find-file
|
|
";" 'eval-expression
|
|
":" 'shell-command
|
|
|
|
"b" '(:wk "Buffer")
|
|
"be" 'eval-buffer
|
|
"bk" 'kill-buffer
|
|
"bK" 'kill-current-buffer
|
|
"br" 'revert-buffer
|
|
"bs" 'save-buffer
|
|
"bS" 'save-some-buffers
|
|
"bx" '(:def (lambda () (interactive) (switch-to-buffer "*scratch*"))
|
|
:wk "scratch buffer")
|
|
"bz" 'bury-buffer
|
|
"bZ" 'unbury-buffer
|
|
"b <left>" 'switch-to-next-buffer
|
|
"b <right>" 'switch-to-prev-buffer
|
|
|
|
"c" '(:wk "Code")
|
|
|
|
"f" '(:wk "File")
|
|
"ff" 'find-file
|
|
"fP" '(:def (lambda () (interactive)
|
|
(find-file (concat earnemacs-root-dir "config.el")))
|
|
:wk "open config file")
|
|
"fs" 'save-buffer
|
|
"fS" '(:def (lambda () (interactive) (save-buffer ""))
|
|
:wk "save buffer as")
|
|
"fy" '(:def (lambda () (interactive) (kill-new buffer-file-name))
|
|
:wk "kill path to buffer")
|
|
"fY" '(:def (lambda () (interactive) (kill-new default-directory))
|
|
:wk "kill current dir path")
|
|
|
|
"g" '(:wk "Git")
|
|
|
|
"h" '(:keymap help-map :wk "Help")
|
|
|
|
"i" '(:wk "Insert")
|
|
|
|
"o" '(:wk "Open")
|
|
"oe" 'eshell
|
|
"of" 'make-frame-command
|
|
"oS" 'shell
|
|
|
|
"q" '(:wk "Quit/Reload")
|
|
"qf" 'delete-frame
|
|
"qK" 'save-buffers-kill-emacs
|
|
"qq" 'save-buffers-kill-terminal
|
|
"qQ" 'evil-quit-all-with-error-code
|
|
|
|
"t" '(:wk "Toggle")
|
|
"tf" 'toggle-frame-fullscreen
|
|
"tF" 'flycheck-mode
|
|
"tr" 'read-only-mode
|
|
"to" 'olivetti-mode
|
|
"tv" 'variable-pitch-mode
|
|
"tw" 'visual-line-mode
|
|
|
|
"w" '(:wk "Window")
|
|
"w=" 'balance-windows
|
|
"w-" 'evil-window-decrease-height
|
|
"w+" 'evil-window-increase-height
|
|
"w<" 'evil-window-decrease-width
|
|
"w>" 'evil-window-increase-width
|
|
|
|
"wh" 'evil-window-left
|
|
"wj" 'evil-window-down
|
|
"wk" 'evil-window-top
|
|
"wl" 'evil-window-right
|
|
|
|
"wd" 'evil-window-delete
|
|
"wn" 'evil-window-new
|
|
"wq" 'evil-quit
|
|
"ww" 'evil-window-next
|
|
"wv" 'evil-window-vsplit
|
|
|
|
"wt" 'tear-off-window
|
|
))
|
|
|
|
(provide 'earnecore-keybinds)
|
|
;;; earnecore-keybinds.el ends here
|