|
|
@ -98,6 +98,9 @@ Install and configure packages. |
|
|
|
(use-package which-key |
|
|
|
(use-package which-key |
|
|
|
:config (which-key-mode)) |
|
|
|
:config (which-key-mode)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package general |
|
|
|
|
|
|
|
:after which-key) |
|
|
|
|
|
|
|
|
|
|
|
(use-package ido-vertical-mode |
|
|
|
(use-package ido-vertical-mode |
|
|
|
:config (ido-vertical-mode)) |
|
|
|
:config (ido-vertical-mode)) |
|
|
|
|
|
|
|
|
|
|
@ -142,9 +145,6 @@ Install and configure packages. |
|
|
|
;; Needed by evil-collection |
|
|
|
;; Needed by evil-collection |
|
|
|
(evil-want-integration t) |
|
|
|
(evil-want-integration t) |
|
|
|
(evil-want-keybinding nil) |
|
|
|
(evil-want-keybinding nil) |
|
|
|
:init |
|
|
|
|
|
|
|
;; Enable before evil-mode to work in all buffers |
|
|
|
|
|
|
|
(global-evil-leader-mode) |
|
|
|
|
|
|
|
:config (evil-mode)) |
|
|
|
:config (evil-mode)) |
|
|
|
|
|
|
|
|
|
|
|
(use-package evil-collection |
|
|
|
(use-package evil-collection |
|
|
@ -155,10 +155,6 @@ Install and configure packages. |
|
|
|
(evil-collection-setup-minibuffer t) |
|
|
|
(evil-collection-setup-minibuffer t) |
|
|
|
:config (evil-collection-init)) |
|
|
|
:config (evil-collection-init)) |
|
|
|
|
|
|
|
|
|
|
|
(use-package evil-leader |
|
|
|
|
|
|
|
:after evil |
|
|
|
|
|
|
|
:custom (evil-leader/in-all-states t)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package evil-nerd-commenter |
|
|
|
(use-package evil-nerd-commenter |
|
|
|
:after evil) |
|
|
|
:after evil) |
|
|
|
#+END_SRC |
|
|
|
#+END_SRC |
|
|
@ -218,8 +214,6 @@ Provides Emacs with a file tree. |
|
|
|
(kbd "q") 'neotree-hide)) |
|
|
|
(kbd "q") 'neotree-hide)) |
|
|
|
#+END_SRC |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
|
|
|
|
https://github.com/CoreyKaylor/dotfiles/blob/master/_emacs.d/config/neotree.el |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*** Centaur Tabs |
|
|
|
*** Centaur Tabs |
|
|
|
|
|
|
|
|
|
|
|
Places buffers as tabs in a bar at the top. |
|
|
|
Places buffers as tabs in a bar at the top. |
|
|
@ -510,6 +504,22 @@ Functions that only use built-in Emacs functionality. |
|
|
|
(let ((default-directory (find-project-root))) |
|
|
|
(let ((default-directory (find-project-root))) |
|
|
|
(call-interactively 'find-file))) |
|
|
|
(call-interactively 'find-file))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; https://emacsredux.com/blog/2013/05/04/rename-file-and-buffer/ |
|
|
|
|
|
|
|
(defun rename-file-and-buffer () |
|
|
|
|
|
|
|
"Rename the current buffer and file it is visiting." |
|
|
|
|
|
|
|
(interactive) |
|
|
|
|
|
|
|
(let ((filename (buffer-file-name))) |
|
|
|
|
|
|
|
(if (not (and filename (file-exists-p filename))) |
|
|
|
|
|
|
|
(message "Buffer is not visiting a file!") |
|
|
|
|
|
|
|
(let ((new-name (read-file-name "New name: " filename))) |
|
|
|
|
|
|
|
(cond |
|
|
|
|
|
|
|
((vc-backend filename) (vc-rename-file filename new-name)) |
|
|
|
|
|
|
|
(t |
|
|
|
|
|
|
|
(rename-file filename new-name t) |
|
|
|
|
|
|
|
(set-visited-file-name new-name t t))))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; https://emacsredux.com/blog/2013/04/21/edit-files-as-root/ |
|
|
|
(defun sudo-edit (&optional arg) |
|
|
|
(defun sudo-edit (&optional arg) |
|
|
|
"Edit currently visited file as root. |
|
|
|
"Edit currently visited file as root. |
|
|
|
|
|
|
|
|
|
|
@ -682,7 +692,7 @@ Disable spacebar in evil motion. |
|
|
|
|
|
|
|
|
|
|
|
;; Neotree |
|
|
|
;; Neotree |
|
|
|
(with-eval-after-load 'evil-states |
|
|
|
(with-eval-after-load 'evil-states |
|
|
|
(define-key evil-normal-state-map (kbd "C-t") 'neotree-toggle-in-project-root)) |
|
|
|
(define-key evil-normal-state-map (kbd "C-n") 'neotree-toggle-in-project-root)) |
|
|
|
|
|
|
|
|
|
|
|
;; Smex |
|
|
|
;; Smex |
|
|
|
(global-set-key (kbd "M-x") 'smex) |
|
|
|
(global-set-key (kbd "M-x") 'smex) |
|
|
@ -691,27 +701,33 @@ Disable spacebar in evil motion. |
|
|
|
|
|
|
|
|
|
|
|
** Leader |
|
|
|
** Leader |
|
|
|
|
|
|
|
|
|
|
|
Evil leader key binds. |
|
|
|
General.el leader key binds. |
|
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(with-eval-after-load 'evil-leader |
|
|
|
(with-eval-after-load 'general |
|
|
|
(evil-leader/set-leader "<SPC>") |
|
|
|
(general-create-definer space-leader |
|
|
|
(evil-leader/set-key |
|
|
|
:prefix "SPC" |
|
|
|
"<SPC>" 'smex |
|
|
|
:non-normal-prefix "M-SPC" |
|
|
|
|
|
|
|
:states '(normal visual insert motion emacs)) |
|
|
|
|
|
|
|
|
|
|
|
;; Window |
|
|
|
(general-create-definer comma-leader |
|
|
|
"0" 'delete-window |
|
|
|
:prefix "," |
|
|
|
"1" 'delete-other-windows |
|
|
|
:states '(normal visual)) |
|
|
|
"2" 'split-follow-horizontally |
|
|
|
|
|
|
|
"3" 'split-follow-vertically |
|
|
|
(space-leader |
|
|
|
"5 0" 'delete-frame |
|
|
|
"SPC" 'smex |
|
|
|
"5 1" 'delete-other-frames |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Buffer |
|
|
|
;; Buffer |
|
|
|
"b" 'ido-switch-buffer |
|
|
|
"b" '(:ignore t :which-key "buffer") |
|
|
|
"C-b" 'ibuffer |
|
|
|
"b B" 'ibuffer |
|
|
|
|
|
|
|
"b b" 'ido-switch-buffer |
|
|
|
|
|
|
|
"b d" 'kill-this-buffer |
|
|
|
|
|
|
|
"b h" 'previous-buffer |
|
|
|
|
|
|
|
"b l" 'next-buffer |
|
|
|
|
|
|
|
"b r" 'revert-buffer |
|
|
|
|
|
|
|
|
|
|
|
;; Comments / config |
|
|
|
;; Comments / config |
|
|
|
|
|
|
|
"c" '(:ignore t :which-key "comments/config") |
|
|
|
"c c" 'evilnc-comment-or-uncomment-lines |
|
|
|
"c c" 'evilnc-comment-or-uncomment-lines |
|
|
|
"c p" 'evilnc-comment-or-uncomment-paragraphs |
|
|
|
"c p" 'evilnc-comment-or-uncomment-paragraphs |
|
|
|
"c r" 'config-reload |
|
|
|
"c r" 'config-reload |
|
|
@ -719,7 +735,10 @@ Evil leader key binds. |
|
|
|
"c y" 'evilnc-comment-and-kill-ring-save |
|
|
|
"c y" 'evilnc-comment-and-kill-ring-save |
|
|
|
|
|
|
|
|
|
|
|
;; Find file |
|
|
|
;; Find file |
|
|
|
"f" 'find-file-in-project-root |
|
|
|
"f" '(:ignore t :which-key "file") |
|
|
|
|
|
|
|
"f f" 'find-file-in-project-root |
|
|
|
|
|
|
|
"f r" 'rename-file-and-buffer |
|
|
|
|
|
|
|
"f s" 'save-buffer |
|
|
|
|
|
|
|
|
|
|
|
;; Tabs |
|
|
|
;; Tabs |
|
|
|
"h" 'centaur-tabs-backward-group |
|
|
|
"h" 'centaur-tabs-backward-group |
|
|
@ -728,17 +747,38 @@ Evil leader key binds. |
|
|
|
"l" 'centaur-tabs-forward-group |
|
|
|
"l" 'centaur-tabs-forward-group |
|
|
|
|
|
|
|
|
|
|
|
;; Neotree |
|
|
|
;; Neotree |
|
|
|
"t" 'neotree-toggle-in-project-root |
|
|
|
"n" 'neotree-toggle-in-project-root |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Quit |
|
|
|
|
|
|
|
"q" '(:ignore t :which-key "quit") |
|
|
|
|
|
|
|
"q q" 'kill-emacs |
|
|
|
|
|
|
|
"q d" 'delete-frame |
|
|
|
|
|
|
|
"q o" 'delete-other-frame |
|
|
|
|
|
|
|
|
|
|
|
;; Avy |
|
|
|
;; Avy |
|
|
|
"s" 'avy-goto-char-timer |
|
|
|
"s" 'avy-goto-char-timer |
|
|
|
|
|
|
|
|
|
|
|
"w" 'kill-this-buffer |
|
|
|
;; Window |
|
|
|
|
|
|
|
"w" '(:ignore t :which-key "window") |
|
|
|
|
|
|
|
"w d" 'delete-window |
|
|
|
|
|
|
|
"w h" 'evil-window-left |
|
|
|
|
|
|
|
"w j" 'evil-window-down |
|
|
|
|
|
|
|
"w k" 'evil-window-up |
|
|
|
|
|
|
|
"w l" 'evil-window-right |
|
|
|
|
|
|
|
"w o" 'delete-other-windows |
|
|
|
|
|
|
|
"w s" '(:ignore t :which-key "split") |
|
|
|
|
|
|
|
"w s h" 'split-follow-horizontally |
|
|
|
|
|
|
|
"w s v" 'split-follow-vertically |
|
|
|
|
|
|
|
"w w" 'other-window |
|
|
|
|
|
|
|
|
|
|
|
"x" 'smex-major-mode-commands |
|
|
|
"x" 'smex-major-mode-commands |
|
|
|
)) |
|
|
|
)) |
|
|
|
#+END_SRC |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Source: |
|
|
|
|
|
|
|
https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-evil.el#L712 |
|
|
|
|
|
|
|
https://github.com/suyashbire1/emacs.d/blob/master/init.el |
|
|
|
|
|
|
|
|
|
|
|
* Notes |
|
|
|
* Notes |
|
|
|
|
|
|
|
|
|
|
|
Org mode keybinds |
|
|
|
Org mode keybinds |
|
|
|