1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-14 16:52:29 +00:00
dotfiles/emacs.d/config/config-evil.el

68 lines
2.2 KiB
EmacsLisp
Raw Normal View History

2015-04-06 21:35:55 +00:00
;;; config-evil.el --- Configuration for evil and its keybindings
;;; Commentary:
;;; Code:
2015-03-24 21:58:59 +00:00
(evil-mode)
2015-04-06 21:35:55 +00:00
(require 'evil-leader)
2015-03-24 21:58:59 +00:00
(require 'evil-matchit)
2015-04-06 21:35:55 +00:00
(require 'evil-nerd-commenter)
2015-03-24 21:58:59 +00:00
(require 'evil-surround)
;; Evil global modes config
(evilnc-default-hotkeys)
(setq evil-default-cursor t)
2015-04-06 21:35:55 +00:00
;; Evil global modes
(global-evil-matchit-mode 1)
(global-evil-surround-mode 1)
(global-evil-jumper-mode)
(global-evil-leader-mode)
;; exclude modes from evil mode
2015-03-24 21:58:59 +00:00
(add-to-list 'evil-emacs-state-modes 'git-rebase-mode)
(add-to-list 'evil-emacs-state-modes 'undo-tree-visualizer-mode)
2015-04-06 21:35:55 +00:00
(add-to-list 'evil-emacs-state-modes 'dired-mode)
2015-03-24 21:58:59 +00:00
2015-04-06 21:35:55 +00:00
(defun next-code-buffer ()
;;; Avoid special buffers when cycling through windows
;;; http://stackoverflow.com/questions/14323516/make-emacs-next-buffer-skip-messages-buffer
(interactive)
(let (( bread-crumb (buffer-name) ))
(next-buffer)
(while
(and
(string-match-p "^\*" (buffer-name))
(not ( equal bread-crumb (buffer-name) )) )
(next-buffer))))
(defun previous-code-buffer ()
(interactive)
(let (( bread-crumb (buffer-name) ))
(previous-buffer)
(while
(and
(string-match-p "^\*" (buffer-name))
(not ( equal bread-crumb (buffer-name) )) )
(previous-buffer))))
2015-03-24 21:58:59 +00:00
;;
;; Evil keys
2015-04-06 21:35:55 +00:00
(evil-leader/set-leader "<SPC>")
2015-03-24 21:58:59 +00:00
2015-04-06 21:35:55 +00:00
(define-key evil-normal-state-map (kbd "[b") 'previous-code-buffer)
(define-key evil-normal-state-map (kbd "]b") 'next-code-buffer)
2015-03-24 21:58:59 +00:00
(define-key evil-normal-state-map (kbd "s") 'evil-ace-jump-char-mode)
(define-key evil-normal-state-map (kbd ",d") 'neotree-toggle)
2015-04-06 21:35:55 +00:00
(define-key evil-normal-state-map (kbd ",u") 'undo-tree-visualize)
2015-03-24 21:58:59 +00:00
(define-key evil-normal-state-map (kbd "C-c +") 'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt)
2015-04-06 21:35:55 +00:00
(add-hook 'neotree-mode-hook
(lambda ()
(define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter)
(define-key evil-normal-state-local-map (kbd "SPC") 'neotree-enter)
(define-key evil-normal-state-local-map (kbd "q") 'neotree-hide)
(define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))
2015-03-24 21:58:59 +00:00
(provide 'config-evil)
2015-04-06 21:35:55 +00:00
;;; config-evil.el ends here