diff --git a/init.el b/init.el index cc433c7b580b48943cd93c4713ee4504f30dc9ae..26b756cae1010faacdf015d151bc1697d0d5af54 100644 --- a/init.el +++ b/init.el @@ -397,6 +397,81 @@ If IS-MAYBE is t then maybe install these packages." ) ;;==================================================================================== + +;;; Keybinding======================================================================== +(let ((key-pack-list + '(evil evil-anzu evil-args evil-cleverparens evil-escape evil-exchange + evil-goggles evil-iedit-state evil-indent-plus evil-lion evil-lisp-state + evil-mc evil-nerd-commenter evil-matchit evil-numbers evil-surround + evil-tutor + evil-leader + ;; (evil-unimpaired :location (recipe :fetcher local)) + evil-visual-mark-mode + evil-visualstar + ;; (hs-minor-mode :location built-in) + ;; (linum-relative :toggle (version< emacs-version "26")) + which-key + ))) + (dolist (pack key-pack-list) + (require-package pack))) + +(use-package which-key + :init + (which-key-mode) + :config + :diminish which-key-mode + ) + +;;; Evil +(require 'evil) +(global-evil-leader-mode) +(evil-leader/set-leader "SPC") +(evil-leader/set-key + ;;helm minibuffers------------------------- + "f f" 'helm-find-files + "f r" 'helm-recentf + "f s" 'save-buffer + "SPC" #'helm-M-x + "s s" 'helm-swoop-without-pre-input + "s r" 'helm-swoop + "h i" 'helm-semantic-or-imenu + "h f" 'helm-flycheck + "h d" 'helm-dash + "h t" 'helm-gtags-find-tag-from-here + "h T" 'helm-gtags-find-tag-other-window + "h r" 'helm-gtags-find-rtag + ;; buffer + "b d" 'kill-current-buffer + "b k" 'kill-buffer + "b b" 'helm-mini + ;; magit----------------------------------- + "g s" 'magit-status + "g d" 'magit-diff-range + "g p" 'magit-push-current + "g P" 'magit-pull-branch + "g c" 'magit-commit + ;; projectile------------------------------ + "p f" 'helm-projectile-find-file + "p h" 'helm-projectile + "p p" 'helm-projectile-switch-project + ;; windows options------------------------- + "w l" 'window-jump-right + "w h" 'window-jump-left + "w k" 'window-jump-up + "w j" 'window-jump-down + "w 2" 'split-window-right + "w 0" 'delete-window + "w 1" 'delete-other-windows + ;;youdao dict------------------------------ + "o y" 'youdao-dictionary-search-at-point+ + ;; todo mode ------------------------------ + "t p" 'hl-todo-previous + "t n" 'hl-todo-next + "t o" 'hl-todo-occur + "t i" 'hl-todo-insert-keyword + ) +(evil-mode 1) + ;;; Program=========================================================================== ;; Flycheck (require-package 'flycheck) @@ -427,27 +502,6 @@ If IS-MAYBE is t then maybe install these packages." ;; ;; because it uses sccope instead of pycscope ;; ))) -;; tags ---------------------------------------------------------------------------- -(let ((tags-pack-list - '(ggtags))) - (install-pack-list tags-pack-list)) -;; ggtags -;; (add-hook 'c-mode-common-hook -;; (lambda () -;; (when (derived-mode-p 'c-mode 'c++-mode 'java-mode) -;; (ggtags-mode 1)))) -;; (add-to-list 'popwin:special-display-config -;; '("*.gtags.*" :regexp t :position bottom)) - -;; (defun init-gtags () -;; ;TODO: -;; "Init." -;; ) - -;; Compile package -(use-package compile - ) - ;; c/cpp mode------------------------------------------------------------------------ (let ((c-cpp-packages '(cc-mode clang-format company company-c-headers company-ycmd disaster @@ -489,17 +543,23 @@ If IS-MAYBE is t then maybe install these packages." (use-package clang-format ) -(use-package disaster - ) +;; (use-package disaster +;; ) ;; emacs-lisp------------------------------------------------------------------------ (let ((elisp-pack-dev '(lispy))) (install-pack-list elisp-pack-dev)) -(use-package eldoc - :config - (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)) +(use-package eldoc-mode + :hook emacs-lisp-mode + :diminish eldoc-mode + :config) + +(use-package lispy-mode + :hook emacs-lisp-mode + :diminish lispy) + ;; python---------------------------------------------------------------------------- (let ((python-dev-pack '(elpy anaconda-mode cython-mode eldoc live-py-mode pip-requirements py-isort @@ -552,88 +612,6 @@ If IS-MAYBE is t then maybe install these packages." ;;==================================================================================== -;;; Keybinding======================================================================== -(let ((key-pack-list - '(evil evil-anzu evil-args evil-cleverparens evil-escape evil-exchange - evil-goggles evil-iedit-state evil-indent-plus evil-lion evil-lisp-state - evil-mc evil-nerd-commenter evil-matchit evil-numbers evil-surround - evil-tutor - evil-leader - ;; (evil-unimpaired :location (recipe :fetcher local)) - evil-visual-mark-mode - evil-visualstar - ;; (hs-minor-mode :location built-in) - ;; (linum-relative :toggle (version< emacs-version "26")) - which-key - ))) - (dolist (pack key-pack-list) - (require-package pack))) - -(use-package which-key - :init - (which-key-mode) - :config - :diminish which-key-mode - ) - -;;; Evil -(require 'evil) -(global-evil-leader-mode) -(evil-leader/set-leader "SPC") -(evil-leader/set-key - ;;helm minibuffers------------------------- - "f f" 'helm-find-files - "f r" 'helm-recentf - "f s" 'save-buffer - "SPC" #'helm-M-x - "s s" 'helm-swoop-without-pre-input - "s r" 'helm-swoop - "h i" 'helm-semantic-or-imenu - "h f" 'helm-flycheck - "h d" 'helm-dash - "h t" 'helm-gtags-find-tag-from-here - "h T" 'helm-gtags-find-tag-other-window - "h r" 'helm-gtags-find-rtag - ;; buffer - "b d" 'kill-current-buffer - "b k" 'kill-buffer - "b b" 'helm-mini - ;; magit----------------------------------- - "g s" 'magit-status - "g d" 'magit-diff-range - ;; projectile------------------------------ - "p f" 'helm-projectile-find-file - "p h" 'helm-projectile - "p p" 'helm-projectile-switch-project - ;; windows options------------------------- - "w l" 'window-jump-right - "w h" 'window-jump-left - "w k" 'window-jump-up - "w j" 'window-jump-down - "w 2" 'split-window-right - "w 0" 'delete-window - "w 1" 'delete-other-windows - ;;youdao dict------------------------------ - "o y" 'youdao-dictionary-search-at-point+ - ;; todo mode ------------------------------ - "t p" 'hl-todo-previous - "t n" 'hl-todo-next - "t o" 'hl-todo-occur - "t i" 'hl-todo-insert-keyword - ) -(evil-mode 1) - -;;; Org mode global keys -;; (global-set-key "\C-cl" 'org-store-link) -;; (global-set-key "\C-ca" 'org-agenda) -;; (global-set-key "\C-cc" 'org-capture) -;; (global-set-key "\C-cb" 'org-iswitchb) - - -;;==================================================================================== - - - ;;TODO-------------------------------------------------------------------------------- ;; (require 'smex) ;; (smex-initialize)