Plugins 邪恶的Emacs:有没有办法在«;插入»;模式
我喜欢VIM关于文本对象的想法,所以我安装了(一个Emacs插件来模拟VIM特性)。但是我希望«插入»模式保持Emacs键绑定不变(除了可能切换到«正常»模式的Escape)。有什么办法可以做到这一点 顺便说一下:ATM«插入»模式有一组混合的热键,这两种方式都不是很舒服。例如,«M-b»在Emacs中工作,但«C-o»在VIM中工作。在#Emacs IRC通道中,我被告知。以下是我使用的修改版本:Plugins 邪恶的Emacs:有没有办法在«;插入»;模式,plugins,emacs,configuration,editor,elisp,Plugins,Emacs,Configuration,Editor,Elisp,我喜欢VIM关于文本对象的想法,所以我安装了(一个Emacs插件来模拟VIM特性)。但是我希望«插入»模式保持Emacs键绑定不变(除了可能切换到«正常»模式的Escape)。有什么办法可以做到这一点 顺便说一下:ATM«插入»模式有一组混合的热键,这两种方式都不是很舒服。例如,«M-b»在Emacs中工作,但«C-o»在VIM中工作。在#Emacs IRC通道中,我被告知。以下是我使用的修改版本: (require 'evil) ;; remove all keybindings from i
(require 'evil)
;; remove all keybindings from insert-state keymap
(setcdr evil-insert-state-map nil)
;; but [escape] should switch back to normal state
(define-key evil-insert-state-map [escape] 'evil-normal-state)
(define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up)
(define-key evil-normal-state-map (kbd "[ m") 'beginning-of-defun)
(define-key evil-normal-state-map (kbd "] m") 'end-of-defun)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(evil-mode t)
(setq evil-jumps-cross-buffers nil) ;; for C-o and C-i to not cross buffers
(provide 'emvil)
(提供'emvil)
允许在配置中使用它。我还发现在下一个分割屏幕中跳转到定义非常有用,除非定义在我当前所在的缓冲区中。代码如下:
(defun evil-goto-definition-next-split ()
"If there's a free split, goto definition in this split,
otherwise use current one (except when a definition in the
current split)"
(interactive)
(let ((origin-spl (selected-window))
(origin-buf (current-buffer)))
(evil-goto-definition)
(when (and (eq origin-spl (selected-window)) ;; otherwise it's done
(not (eq origin-buf (current-buffer)))) ;; otherwise either definition not found, or
;; it's in the same buffer
(let ((defin-buf (current-buffer))
(defin-point (point)))
(switch-to-buffer origin-buf)
(other-window 1)
(switch-to-buffer defin-buf)
(goto-char defin-point)
))
))
(define-key evil-normal-state-map (kbd "g d") 'evil-goto-definition-next-split)
嗯,我知道了。有时(我还不知道这取决于什么)变量«global map»中的邪恶变化列表。嗯……啊,我知道了。(define key evil insert state map(kbd“”)“evil normal state)
以某种方式破坏了所有的键绑定,尽管只应触碰退出键。我最终发现……我不知道有什么区别,但唯一有效的方法是(define key evil insert state map[退出]“evil normal state”)
如果有人好奇,目前,我在Emacs中有这样的代码:(邪恶模式)(setq邪恶插入状态映射全局映射)(define key邪恶插入状态映射[escape]“邪恶正常状态”(global set key(kbd“C-S-z”)“undo tree redo”)
有一些新的属性集:邪恶禁用插入状态绑定,但找不到启用它的方法