My Avatar

LanternD's Castle

PhD Student in ECE @ MSU

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

(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

(dolist (mode '(ag-mode
		flycheck-error-list-mode
		occur-mode
		git-rebase-mode
		))
  (add-to-list 'evil-emacs-state-mode mode))
(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
			      )))

(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

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

window-numbering package

powerline package

which-key package

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

Search in org agenda



Disqus Comment 0