Any other tweaks for making emacs as vim-like as possible would be appreciated as well.
任何其他调整使emacs尽可能像vim一样也将受到赞赏。
Addendum: The main reason I don't just use vim is that I love how emacs lets you open a file in two different frames [ADDED: sorry, this was confusing: I mean separate windows, which emacs calls "frames"]. It's like making a vertical split but I don't have to have one enormous window.
附录:我不仅仅使用vim的主要原因是我喜欢emacs如何让你在两个不同的框架中打开文件[添加:对不起,这很令人困惑:我的意思是单独的窗口,emacs称之为“框架”]。这就像进行垂直分割,但我没有一个巨大的窗口。
9 个解决方案
#1
7
You could run VIM in client server mode, then you could have two windows connecting to one instance, hence removing the need for Emacs.
您可以在客户端服务器模式下运行VIM,然后您可以将两个窗口连接到一个实例,从而无需使用Emacs。
#2
3
I don't know how to make Vim macros work, but since you asked for tweaks for making emacs as vim-like as possible, here's a few additions to vimpulse I use everyday:
我不知道如何使Vim宏工作,但是因为你要求调整使emacs尽可能像vim一样,这里是我每天使用的vimpulse的一些补充:
(define-key viper-vi-global-user-map [(delete)] 'delete-char)
(define-key viper-vi-global-user-map "/" 'isearch-forward-regexp)
(define-key viper-vi-global-user-map "?" 'isearch-backward-regexp)
(define-key viper-vi-global-user-map "\C-wh" 'windmove-left)
(define-key viper-vi-global-user-map "\C-wj" 'windmove-down)
(define-key viper-vi-global-user-map "\C-wk" 'windmove-up)
(define-key viper-vi-global-user-map "\C-wl" 'windmove-right)
(define-key viper-vi-global-user-map "\C-wv" '(lambda () (interactive)
(split-window-horizontally)
(other-window 1)
(switch-to-buffer (other-buffer))))
(define-key viper-visual-mode-map "F" 'viper-find-char-backward)
(define-key viper-visual-mode-map "t" 'viper-goto-char-forward)
(define-key viper-visual-mode-map "T" 'viper-goto-char-backward)
(define-key viper-visual-mode-map "e" '(lambda ()
(interactive)
(viper-end-of-word 1)
(viper-forward-char 1)))
(push '("only" (delete-other-windows)) ex-token-alist)
(push '("close" (delete-window)) ex-token-alist)
Of course, learning Emacs is very important too, but Emacs relies on customization to make it behave exactly like you want it to. And the default Vim key bindings are so comfortable that using Viper simply means that Viper does some Emacs customization for you.
当然,学习Emacs也非常重要,但Emacs依靠自定义使其行为与您想要的完全一样。默认的Vim键绑定非常舒适,使用Viper只是意味着Viper为您做了一些Emacs自定义。
As for using Vim instead of Emacs, I love Vim, but I love the interactiveness of the Lisp system that is Emacs. Nothing feels like typing a line of code anywhere in your editor and instantly evaluating it with a single keystroke, changing or inspecting the state of your editor from your editor (including the live documentation) with a single keystroke (C-M-x
) while it is running.
至于使用Vim代替Emacs,我喜欢Vim,但我喜欢Lisma系统的互动性,即Emacs。没有什么比在编辑器中的任何地方键入一行代码并立即通过一次击键来评估它,在编辑器中更改或检查编辑器的状态(包括实时文档)以及在运行时使用单击键(C-M-x)。
#3
2
I don't have any viper or vimpulse tweaks for you, but I do recommend that you try follow-mode.
我没有任何viper或vimpulse调整,但我建议你尝试跟随模式。
Of course I'd also recommend that you start learning Emacs too. I mean, if you're in this far you might as well go through the tutorial and maybe have a look at emacswiki.
当然我也建议你也开始学习Emacs。我的意思是,如果你在这个目前,你可能会通过教程,也许看看emacswiki。
#4
1
The version of VIM I use support (Window version) support splitting a file into 2 different frames using "Ctrl+W s"...
我使用支持(Window版本)的VIM版本支持使用“Ctrl + W s”将文件分成2个不同的帧...
#5
1
Vim easily lets you open a file in two different frames:
Vim可以轻松地在两个不同的框架中打开文件:
:split
to split it horizontally
:拆分以水平拆分
:vsplit
to split it vertically
:vsplit将其垂直拆分
You can split the screen as many times as you want between the same file, different files, or both.
您可以根据需要在同一文件,不同文件或两者之间拆分屏幕。
CTRL-w-w
switches frames.
CTRL-W-w切换帧。
:resize +n
or :resize -n
resizes the current frame.
:resize + n或:resize -n调整当前帧的大小。
#6
1
Emacs+vimpulse is awesome, but I think its right workflow is to liberally use emacs commands in combination to vim shortcuts. For example, emacs's macro shortcut F3 and F4 is easier than vim's qq and @q . Also emacs commands are accessed through Alt+x, not : commands. Though vimpulse support a few important vim commands, they are there just for compatibility.
Emacs + vimpulse非常棒,但我认为它的正确工作流程是将emacs命令与vim快捷方式结合使用。例如,emacs的宏快捷键F3和F4比vim的qq和@q更容易。此外,emacs命令可通过Alt + x访问,而不是:命令。虽然vimpulse支持一些重要的vim命令,但它们只是为了兼容性。
Followings are my vimpulse specific customizations.
以下是我的vimpulse特定自定义。
.emacs
; I use C-d to quit emacs and vim
(vimpulse-global-set-key 'vi-state (kbd "C-d") 'save-buffers-kill-terminal)
; use ; instead of :
(vimpulse-global-set-key 'vi-state (kbd ";") 'viper-ex)
; use C-e instead of $. This works for all motion command too! (e.g. d C-e is easier to type than d$)
(vimpulse-global-set-key 'vi-state (kbd "C-e") 'viper-goto-eol)
(defun t_save() (interactive)(save-buffer)(viper-change-state-to-vi))
(global-set-key (kbd "\C-s") 't_save) ; save using C-s instead of :w<CR> or C-x-s
(defun command-line-diff (switch)
(let ((file1 (pop command-line-args-left))
(file2 (pop command-line-args-left)))
(ediff file1 file2)))
;; Usage: emacs -diff file1 file2 (much better then vimdiff)
(add-to-list 'command-switch-alist '("-diff" . command-line-diff))
If you like terminal, you can use emacs -nw. In this case, this clipboard add-on is useful. http://www.lingotrek.com/2010/12/integrating-emacs-with-x11-clipboard-in.html
如果您喜欢终端,可以使用emacs -nw。在这种情况下,此剪贴板插件很有用。 http://www.lingotrek.com/2010/12/integrating-emacs-with-x11-clipboard-in.html
.viper
(setq viper-inhibit-startup-message 't)
(setq viper-expert-level '3)
(setq viper-ESC-key "\C-c") ; use C-c instead of ESC. unlike vim, C-c works perfectly with vimpulse.
Almost everything vim does can be as easily done (if not the same way) in emacs+vimpulse but definitely not vice versa!
在emacs + vimpulse中,几乎所有vim都可以轻松完成(如果不是以同样的方式),但绝对不会相反!
p.s. most of the suggestions above are supported by recent vimpulse BY DEFAULT.
附:最近的vimpulse BY DEFAULT支持上述大多数建议。
#7
0
You could always start vim in a shell buffer and resize it so it filled the whole frame?
你总是可以在shell缓冲区中启动vim并调整它以使其填满整个框架?
#8
0
If you want VIM functionality, it makes more sense to just install VIM!
如果您想要VIM功能,那么只安装VIM就更有意义了!
#9
0
I'm not sure if I answer your question, as it is not entirely clear what you are asking (why the macro's are not working, or which tweaks are available for emulating vim in emacs)
so, is this your problem?:
我不确定我是否回答你的问题,因为你要问的是什么(为什么宏不起作用,或者哪些调整可用于在emacs中模拟vim),所以,这是你的问题吗?:
- One user who uses an ancient emacs-snapshot (from 2005) mentions
that this mode causes all the keys on his keyboard to stop working unless he deletes the line that reads 'viper--key-maps from the macro my-get-emulation-keymap in this file一位使用古老emacs-snapshot的用户(从2005年开始)提到这种模式会导致键盘上的所有键停止工作,除非他删除了“viper - 来自宏my-get-emulation的键映射”的行 - 此文件中的keymap
if it is, you can try the stated solution.
如果是,您可以尝试所述的解决方案。
I got this information from the emacs wiki, and it's a known bug.
我从emacs wiki获得了这些信息,这是一个已知的错误。
#1
7
You could run VIM in client server mode, then you could have two windows connecting to one instance, hence removing the need for Emacs.
您可以在客户端服务器模式下运行VIM,然后您可以将两个窗口连接到一个实例,从而无需使用Emacs。
#2
3
I don't know how to make Vim macros work, but since you asked for tweaks for making emacs as vim-like as possible, here's a few additions to vimpulse I use everyday:
我不知道如何使Vim宏工作,但是因为你要求调整使emacs尽可能像vim一样,这里是我每天使用的vimpulse的一些补充:
(define-key viper-vi-global-user-map [(delete)] 'delete-char)
(define-key viper-vi-global-user-map "/" 'isearch-forward-regexp)
(define-key viper-vi-global-user-map "?" 'isearch-backward-regexp)
(define-key viper-vi-global-user-map "\C-wh" 'windmove-left)
(define-key viper-vi-global-user-map "\C-wj" 'windmove-down)
(define-key viper-vi-global-user-map "\C-wk" 'windmove-up)
(define-key viper-vi-global-user-map "\C-wl" 'windmove-right)
(define-key viper-vi-global-user-map "\C-wv" '(lambda () (interactive)
(split-window-horizontally)
(other-window 1)
(switch-to-buffer (other-buffer))))
(define-key viper-visual-mode-map "F" 'viper-find-char-backward)
(define-key viper-visual-mode-map "t" 'viper-goto-char-forward)
(define-key viper-visual-mode-map "T" 'viper-goto-char-backward)
(define-key viper-visual-mode-map "e" '(lambda ()
(interactive)
(viper-end-of-word 1)
(viper-forward-char 1)))
(push '("only" (delete-other-windows)) ex-token-alist)
(push '("close" (delete-window)) ex-token-alist)
Of course, learning Emacs is very important too, but Emacs relies on customization to make it behave exactly like you want it to. And the default Vim key bindings are so comfortable that using Viper simply means that Viper does some Emacs customization for you.
当然,学习Emacs也非常重要,但Emacs依靠自定义使其行为与您想要的完全一样。默认的Vim键绑定非常舒适,使用Viper只是意味着Viper为您做了一些Emacs自定义。
As for using Vim instead of Emacs, I love Vim, but I love the interactiveness of the Lisp system that is Emacs. Nothing feels like typing a line of code anywhere in your editor and instantly evaluating it with a single keystroke, changing or inspecting the state of your editor from your editor (including the live documentation) with a single keystroke (C-M-x
) while it is running.
至于使用Vim代替Emacs,我喜欢Vim,但我喜欢Lisma系统的互动性,即Emacs。没有什么比在编辑器中的任何地方键入一行代码并立即通过一次击键来评估它,在编辑器中更改或检查编辑器的状态(包括实时文档)以及在运行时使用单击键(C-M-x)。
#3
2
I don't have any viper or vimpulse tweaks for you, but I do recommend that you try follow-mode.
我没有任何viper或vimpulse调整,但我建议你尝试跟随模式。
Of course I'd also recommend that you start learning Emacs too. I mean, if you're in this far you might as well go through the tutorial and maybe have a look at emacswiki.
当然我也建议你也开始学习Emacs。我的意思是,如果你在这个目前,你可能会通过教程,也许看看emacswiki。
#4
1
The version of VIM I use support (Window version) support splitting a file into 2 different frames using "Ctrl+W s"...
我使用支持(Window版本)的VIM版本支持使用“Ctrl + W s”将文件分成2个不同的帧...
#5
1
Vim easily lets you open a file in two different frames:
Vim可以轻松地在两个不同的框架中打开文件:
:split
to split it horizontally
:拆分以水平拆分
:vsplit
to split it vertically
:vsplit将其垂直拆分
You can split the screen as many times as you want between the same file, different files, or both.
您可以根据需要在同一文件,不同文件或两者之间拆分屏幕。
CTRL-w-w
switches frames.
CTRL-W-w切换帧。
:resize +n
or :resize -n
resizes the current frame.
:resize + n或:resize -n调整当前帧的大小。
#6
1
Emacs+vimpulse is awesome, but I think its right workflow is to liberally use emacs commands in combination to vim shortcuts. For example, emacs's macro shortcut F3 and F4 is easier than vim's qq and @q . Also emacs commands are accessed through Alt+x, not : commands. Though vimpulse support a few important vim commands, they are there just for compatibility.
Emacs + vimpulse非常棒,但我认为它的正确工作流程是将emacs命令与vim快捷方式结合使用。例如,emacs的宏快捷键F3和F4比vim的qq和@q更容易。此外,emacs命令可通过Alt + x访问,而不是:命令。虽然vimpulse支持一些重要的vim命令,但它们只是为了兼容性。
Followings are my vimpulse specific customizations.
以下是我的vimpulse特定自定义。
.emacs
; I use C-d to quit emacs and vim
(vimpulse-global-set-key 'vi-state (kbd "C-d") 'save-buffers-kill-terminal)
; use ; instead of :
(vimpulse-global-set-key 'vi-state (kbd ";") 'viper-ex)
; use C-e instead of $. This works for all motion command too! (e.g. d C-e is easier to type than d$)
(vimpulse-global-set-key 'vi-state (kbd "C-e") 'viper-goto-eol)
(defun t_save() (interactive)(save-buffer)(viper-change-state-to-vi))
(global-set-key (kbd "\C-s") 't_save) ; save using C-s instead of :w<CR> or C-x-s
(defun command-line-diff (switch)
(let ((file1 (pop command-line-args-left))
(file2 (pop command-line-args-left)))
(ediff file1 file2)))
;; Usage: emacs -diff file1 file2 (much better then vimdiff)
(add-to-list 'command-switch-alist '("-diff" . command-line-diff))
If you like terminal, you can use emacs -nw. In this case, this clipboard add-on is useful. http://www.lingotrek.com/2010/12/integrating-emacs-with-x11-clipboard-in.html
如果您喜欢终端,可以使用emacs -nw。在这种情况下,此剪贴板插件很有用。 http://www.lingotrek.com/2010/12/integrating-emacs-with-x11-clipboard-in.html
.viper
(setq viper-inhibit-startup-message 't)
(setq viper-expert-level '3)
(setq viper-ESC-key "\C-c") ; use C-c instead of ESC. unlike vim, C-c works perfectly with vimpulse.
Almost everything vim does can be as easily done (if not the same way) in emacs+vimpulse but definitely not vice versa!
在emacs + vimpulse中,几乎所有vim都可以轻松完成(如果不是以同样的方式),但绝对不会相反!
p.s. most of the suggestions above are supported by recent vimpulse BY DEFAULT.
附:最近的vimpulse BY DEFAULT支持上述大多数建议。
#7
0
You could always start vim in a shell buffer and resize it so it filled the whole frame?
你总是可以在shell缓冲区中启动vim并调整它以使其填满整个框架?
#8
0
If you want VIM functionality, it makes more sense to just install VIM!
如果您想要VIM功能,那么只安装VIM就更有意义了!
#9
0
I'm not sure if I answer your question, as it is not entirely clear what you are asking (why the macro's are not working, or which tweaks are available for emulating vim in emacs)
so, is this your problem?:
我不确定我是否回答你的问题,因为你要问的是什么(为什么宏不起作用,或者哪些调整可用于在emacs中模拟vim),所以,这是你的问题吗?:
- One user who uses an ancient emacs-snapshot (from 2005) mentions
that this mode causes all the keys on his keyboard to stop working unless he deletes the line that reads 'viper--key-maps from the macro my-get-emulation-keymap in this file一位使用古老emacs-snapshot的用户(从2005年开始)提到这种模式会导致键盘上的所有键停止工作,除非他删除了“viper - 来自宏my-get-emulation的键映射”的行 - 此文件中的keymap
if it is, you can try the stated solution.
如果是,您可以尝试所述的解决方案。
I got this information from the emacs wiki, and it's a known bug.
我从emacs wiki获得了这些信息,这是一个已知的错误。