My Avatar

LanternD's Castle

An electronics enthusiast - survive technically

Spacemacs Rocks Note Day 7

2017-11-06

A series of notes that I learn Emacs hacking. Introduction to evil-mode, packages to augment evil, such as evil-leader, eveil-surrond, evil-nerd-commenter, powerline-evil; misc. improvement, such as window-numbering, which-key and powerline packages.

 

Use Evil to enable vim editing

1
2
3
(evil-mode 1)
(setcdr evil-insert-state-map nil)
(define-key evil-insert-state-map [escape] 'evil-normal-state)

C-d to page down, but C-u does not page up. Because C-u is used as “Universal args” in Emacs. We can change this in customize-group

We want to set the evil state when we enter certain mode, use the following code

1
2
3
4
5
6
(dolist (mode '(ag-mode
		flycheck-error-list-mode
		occur-mode
		git-rebase-mode
		))
  (add-to-list 'evil-emacs-state-mode mode))
1
2
3
4
5
6
7
8
9
(add-hook 'occur-mode-hook (lambda ()
			     (evil-add-hjkl-bindings occur-mode-map 'emacs
			      (kbd "/") 'evil-search-forward
			      (kbd "n") 'evil-search-next
			      (kbd "N") 'evil-search-previous
			      (kbd "C-d") 'evil-scroll-down
			      (kbd "C-u") 'evil-scroll-up
			      )))

1
2
(define-key evil-normal-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)
(define-key evil-visual-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)

Miscellaneous improvement

Use C-w to delete a word backward

1
(global-set-key (kbd "C-w") 'backward-kill-word)

window-numbering package

powerline package

which-key package

1
2
(require which-key)
(which-key-mode 1)
1
2
(setq which-key-side-window-max-height 0.25)
(setq which-key-side-window-location 'right)

Search in org agenda



Disqus Comment 0