Skip to content

Instantly share code, notes, and snippets.

@SlyDen
Created February 16, 2017 14:01
Show Gist options
  • Save SlyDen/2833f8a28423e76aa1f859440e50b3f4 to your computer and use it in GitHub Desktop.
Save SlyDen/2833f8a28423e76aa1f859440e50b3f4 to your computer and use it in GitHub Desktop.
(define-key dired-mode-map (kbd "<M-return>") 'shell-instead-dired)
(define-key dired-mode-map (kbd «K») 'dired-do-kill-lines)
(define-key dired-mode-map (kbd «k») 'dired-previous-line)
(define-key dired-mode-map (kbd «J») 'dired-goto-file)
(define-key dired-mode-map (kbd «j») 'dired-next-line)
(define-key dired-mode-map (kbd «M-p») 'ace-window)
(define-key dired-mode-map (kbd «M-q») 'ace-window)
(define-key dired-mode-map (kbd "/") 'helm-occur)
;; в любом режиме Alt+hjkl ведут себя как обычный vim
(global-set-key (kbd «M-h») 'backward-char)
(global-set-key (kbd «M-j») 'evil-next-line)
(global-set-key (kbd «M-k») 'evil-previous-line)
(global-set-key (kbd «M-l») 'forward-char)
(define-key evil-insert-state-map (kbd «M-h») 'backward-char)
(define-key evil-insert-state-map (kbd «M-j») 'evil-next-line)
(define-key evil-insert-state-map (kbd «M-k») 'evil-previous-line)
(define-key evil-insert-state-map (kbd «M-l») 'forward-char)
(loop for (mode. state) in '((inferior-emacs-lisp-mode. emacs)
(nrepl-mode. insert)
(pylookup-mode. emacs)
(chronos-mode. emacs)
(comint-mode. normal)
(shell-mode. insert)
(eshell-mode. emacs)
(git-commit-mode. insert)
(git-rebase-mode. emacs)
(term-mode. emacs)
(help-mode. motion)
(helm-grep-mode. emacs)
(grep-mode. emacs)
(bc-menu-mode. emacs)
(elfeed-show-mode. emacs)
(elfeed-search-mode. emacs)
(rdictcc-buffer-mode. emacs)
(dired-mode. emacs)
(image-dired-thumbnail-mode. emacs)
(ztree-mode. emacs)
(diff-mode. emacs)
(vc-svn-log-view-mode. emacs)
(wdired-mode. normal))
do (evil-set-initial-state mode state))
(push '("\\*CAPTURE-\\*". insert) evil-buffer-regexps)
(push '("\\*help\\*". motion) evil-buffer-regexps)
(push '("\\*chronos\\*". emacs) evil-buffer-regexps)
(push '("\\*eshell\\*". emacs) evil-buffer-regexps)
(push '("\\*backtrace\\*". emacs) evil-buffer-regexps)
(push '("\\*vc-\\*". insert) evil-buffer-regexps)
(evil-define-key 'normal magit-mode-map
«j» 'magit-goto-next-section
«k» 'magit-goto-previous-section)
(evil-define-key 'normal magit-log-mode-map
«j» 'magit-goto-next-section
«k» 'magit-goto-previous-section)
(evil-define-key 'normal magit-diff-mode-map
«j» 'magit-goto-next-section
«k» 'magit-goto-previous-section)
;; Make HJKL keys work in special buffers
(evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs
«K» 'magit-discard
«L» 'magit-key-mode-popup-logging)
(evil-add-hjkl-bindings magit-status-mode-map 'emacs
(kbd «DEL») 'magit-discard
«K» 'magit-discard
;; «l» 'magit-key-mode-popup-logging
«l» 'magit-log-popup
«h» 'magit-toggle-diff-refine-hunk)
(evil-add-hjkl-bindings ztree-mode-map 'emacs)
(evil-add-hjkl-bindings magit-log-mode-map 'emacs)
(evil-add-hjkl-bindings magit-commit-mode-map 'emacs)
(evil-add-hjkl-bindings occur-mode 'emacs)
(evil-define-key 'motion compilation-mode-map
«h» 'evil-backward-char
)
(define-key compilation-mode-map
(kbd «C-u») 'evil-scroll-up
)
;;;; Evil-leader
(require 'evil-leader) ;; https://github.com/cofi/evil-leader
(evil-leader/set-leader «SPC»)
(global-evil-leader-mode)
(evil-leader/set-key
«0» 'select-window-0
«1» 'select-window-1
«2» 'select-window-2
«3» 'select-window-3
«4» 'select-window-4
«5» 'select-window-5
«6» 'select-window-6
«7» 'select-window-7
«8» 'select-window-8
«9» 'select-window-9
"" 'evil-buffer
«b» 'ido-switch-buffer
;; «t» 'helm-chronos-add-timer
«t» 'chronos-add-timers-from-string
«T» '(lambda() (interactive)(switch-to-buffer "*chronos*"))
«c» 'org-ctrl-c-ctrl-c
«e» 'eshell
«f» 'helm-find-files
«w» 'avy-goto-word-or-subword-1
«W» 'evil-ace-jump-char-mode
«l» 'evil-ace-jump-line-mode
;; «l» 'avy-goto-line
«SPC» 'evil-ace-jump-word-mode
«d» 'kill-this-buffer
«D» 'other-window-kill-buffer
«o» 'helm-occur
;; «i» 'helm-imenu
«i» 'helm-semantic-or-imenu
«p» 'projectile-find-file
«g» 'magit-status
;; «j» 'ranger
«j» 'dired-jump
«k» 'kill-buffer
«u» 'undo-tree-visualize
«y» 'helm-show-kill-ring
«s» 'save-buffer
"|" '(lambda () (interactive) (split-window-horizontally) (other-window 1))
«m» 'folding-toggle-show-hide
«nh» 'org-habit-toggle-habits
«nb» 'bss/org-toggle-budgets-and-habits
«nn» 'bss/org-todo
«nd» 'org-deadline
«na» 'org-archive-subtree-default
«nr» 'bss/org-refile
«nm» 'bss/org-refile
«nf» 'org-narrow-to-subtree ;; focus
«ns» 'bss/org-schedule
«nw» 'widen ;;unfocus
«ny» 'org-cut-special
«nc» 'org-capture
«nt» 'org-ctrl-c-ctrl-c
«v» 'org-capture
«x» 'nlinum-mode
"-" (lambda () (interactive) (split-window-vertically) (other-window 1))
"/" 'helm-occur
;; «gg» '(lambda () (interactive) (w3m-search «g» (thing-at-point 'symbol)))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment