代码拉取完成,页面将自动刷新
同步操作将从 latpaw/emacs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
(evil-mode 1)
; @see https://github.com/timcharper/evil-surround
(global-surround-mode 1)
;; (evil-set-initial-state 'org-mode 'emacs)
;; Remap org-mode meta keys for convenience
(evil-declare-key 'normal org-mode-map
"gh" 'outline-up-heading
"gl" 'outline-next-visible-heading
"H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
"L" 'org-end-of-line ; smarter behaviour on headlines etc.
"t" 'org-todo ; mark a TODO item as DONE
",c" 'org-cycle
",e" 'org-export-dispatch
",n" 'outline-next-visible-heading
",p" 'outline-previous-visible-heading
",t" 'org-set-tags-command
"$" 'org-end-of-line ; smarter behaviour on headlines etc.
"^" 'org-beginning-of-line ; ditto
"-" 'org-ctrl-c-minus ; change bullet style
"<" 'org-metaleft ; out-dent
">" 'org-metaright ; indent
)
(mapc (lambda (state)
(evil-declare-key state org-mode-map
(kbd "TAB") 'org-cycle
(kbd "M-l") 'org-metaright
(kbd "M-h") 'org-metaleft
(kbd "M-k") 'org-metaup
(kbd "M-j") 'org-metadown
(kbd "M-L") 'org-shiftmetaright
(kbd "M-H") 'org-shiftmetaleft
(kbd "M-K") 'org-shiftmetaup
(kbd "M-J") 'org-shiftmetadown))
'(normal insert))
(loop for (mode . state) in
'(
(Info-mode . emacs)
(term-mode . emacs)
(log-edit-mode . emacs)
(inf-ruby-mode . emacs)
(yari-mode . emacs)
(erc-mode . emacs)
(gud-mode . emacs)
(help-mode . emacs)
(eshell-mode . emacs)
(shell-mode . emacs)
(message-mode . emacs)
(magit-log-edit-mode . emacs)
(fundamental-mode . emacs)
(gtags-select-mode . emacs)
(weibo-timeline-mode . emacs)
(weibo-post-mode . emacs)
(diff-mode . emacs)
(sr-mode . emacs)
(dired-mode . emacs)
(compilation-mode . emacs)
(speedbar-mode . emacs)
(magit-commit-mode . normal)
)
do (evil-set-initial-state mode state))
(define-key evil-ex-completion-map (kbd "M-p") 'previous-complete-history-element)
(define-key evil-ex-completion-map (kbd "M-n") 'next-complete-history-element)
(define-key evil-normal-state-map "Y" (kbd "y$"))
(define-key evil-normal-state-map "+" 'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map "-" 'evil-numbers/dec-at-pt)
(define-key evil-normal-state-map "go" 'goto-char)
;; @see http://stackoverflow.com/questions/10569165/how-to-map-jj-to-esc-in-emacs-evil-mode
;; @see http://zuttobenkyou.wordpress.com/2011/02/15/some-thoughts-on-emacs-and-vim/
(define-key evil-insert-state-map "k" #'cofi/maybe-exit)
(evil-define-command cofi/maybe-exit ()
:repeat change
(interactive)
(let ((modified (buffer-modified-p)))
(insert "k")
(let ((evt (read-event (format "Insert %c to exit insert state" ?j)
nil 0.5)))
(cond
((null evt) (message ""))
((and (integerp evt) (char-equal evt ?j))
(delete-char -1)
(set-buffer-modified-p modified)
(push 'escape unread-command-events))
(t (setq unread-command-events (append unread-command-events
(list evt))))))))
(define-key evil-insert-state-map (kbd "C-e") 'move-end-of-line)
(define-key evil-insert-state-map (kbd "C-k") 'kill-line)
(defun evilcvn-change-symbol-in-defun ()
"mark the region in defun (definition of function) and use string replacing UI in evil-mode
to replace the symbol under cursor"
(interactive)
(let ((old (thing-at-point 'symbol)))
(mark-defun)
(unless (evil-visual-state-p)
(evil-visual-state))
(evil-ex (concat "'<,'>s/" (if (= 0 (length old)) "" "\\<\\(") old (if (= 0 (length old)) "" "\\)\\>/"))))
)
(global-set-key (kbd "C-c ; s") 'evilcvn-change-symbol-in-defun)
;; {{ evil-leader config
(setq evil-leader/leader "," evil-leader/in-all-states t)
(require 'evil-leader)
(evil-leader/set-key
"cx" 'copy-to-x-clipboard
"px" 'paste-from-x-clipboard
"ci" 'evilnc-comment-or-uncomment-lines
"cl" 'evilnc-comment-or-uncomment-to-the-line
"cc" 'evilnc-copy-and-comment-lines
"ct" 'ctags-create-or-update-tags-table
"cs" 'evilcvn-change-symbol-in-defun
"t" 'ido-goto-symbol ;; same as my vim hotkey
"w" 'save-buffer
"cp" 'compile
"ud" '(lambda ()(interactive) (gud-gdb (concat "gdb --fullname " (cppcm-get-exe-path-current-buffer))))
"W" 'save-some-buffers
"K" 'kill-buffer-and-window
"it" 'issue-tracker-increment-issue-id-under-cursor
"bm" 'pomodoro-start ;; beat myself
"." 'evil-ex
;; toggle overview, @see http://emacs.wordpress.com/2007/01/16/quick-and-dirty-code-folding/
"ov" '(lambda () (interactive) (set-selective-display (if selective-display nil 1)))
"mq" '(lambda () (interactive) (man (concat "-k " (thing-at-point 'symbol))))
"gg" '(lambda () (interactive) (w3m-search "g" (thing-at-point 'symbol)))
"q" '(lambda () (interactive) (w3m-search "q" (thing-at-point 'symbol)))
"s1" 'delete-other-windows
"s2" 'split-window-below
"s3" 'split-window-right
"su" 'winner-undo
"hs" 'w3mext-hacker-search
"gf" 'gtags-find-tag-from-here
"gp" 'gtags-pop-stack
"gr" 'gtags-find-rtag
"gy" 'gtags-find-symbol
"cg" 'djcb-gtags-create-or-update
"bc" '(lambda () (interactive) (wxhelp-browse-class-or-api (thing-at-point 'symbol)))
"ma" 'mc/mark-all-like-this-in-defun
"mw" 'mc/mark-all-words-like-this-in-defun
"ms" 'mc/mark-all-symbols-like-this-in-defun
;; recommended in html
"md" 'mc/mark-all-like-this-dwim
"rw" 'rotate-windows
"l" 'align-regexp
"x" 'er/expand-region
"vd" 'scroll-other-window
"vu" '(lambda () (interactive) (scroll-other-window-down nil))
)
;; }}
;; change mode-line color by evil state
(lexical-let ((default-color (cons (face-background 'mode-line)
(face-foreground 'mode-line))))
(add-hook 'post-command-hook
(lambda ()
(let ((color (cond ((minibufferp) default-color)
((evil-insert-state-p) '("#e80000" . "#ffffff"))
((evil-emacs-state-p) '("#444488" . "#ffffff"))
((buffer-modified-p) '("#006fa0" . "#ffffff"))
(t default-color))))
(set-face-background 'mode-line (car color))
(set-face-foreground 'mode-line (cdr color))))))
;; comment/uncomment lines
(evilnc-default-hotkeys)
(provide 'init-evil)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。