How do I get emacs to start in Vi mode?

I've tried putting (setq term-setup-hook 'vip-mode) in my .emacs file but this only seems to load the vip module and I have to manually call vip-change-mode-to-vi and C-z doesn't work as an alias for that method.

What am I doing wrong here?

p.s. Please spare me any religious sentiments.

13.10.2009 18:40:27
Are you trying to cause some sort of explosion or something? :)
Rob Hruska 13.10.2009 18:42:13
nope, I'm just a long time Vim user who likes the emacs/gdb integration.
Pierre-Antoine LaFayette 13.10.2009 20:38:48
4 ОТВЕТА
РЕШЕНИЕ

You answered your own question, really: you need to call vip-change-mode-to-vi. EMACS is just a lisp interpreter with some glossy side-effects; if you want to always be in vip vi mode, call the function.

A couple things:

  1. You should use add-hook. What you're using will remove any other hooks.

    (add-hook 'term-setup-hook ...)

  2. Consider using a lambda expression to stick things together, as

    (add-hook 'term-setup-hook (lambda () (vip-mode)))

    That means you have one closure that you can put all this stuff into

1
25.04.2016 14:29:32
How do I call the function? I tried (vip-change-mode-to-vi) but it tells me that Symbol's function definition is void. I guess it need to wait for the module to load or something.
Pierre-Antoine LaFayette 13.10.2009 19:25:11
I happen to be on the one computer I won wih no emacs, but yeah, that indicates something isn't loaded. There are a couple options: you need to require something, or vip-mode is an autoloaded package. Get into the scratch buffer in a clean EMACS, and enter (require vip-mode) followed by C-j to execute it, and see what happens. It ikf returns t, then add that require to your ,emacs.
Charlie Martin 31.10.2009 18:46:41
 (setq viper-mode t)
 (require 'viper)
1
13.10.2009 19:00:26

I was able to get emacs started in vip-mode by doing what I found here. If you scroll to the bottom, there's a link to a .emacs file, and I copied the first three commands from there:

(setq term-setup-hook 'vip-mode)
(global-unset-key "\e\e")
(put 'eval-expression 'disabled nil) 

I also saw an entry elsewhere from someone who just added to their .emacs:

(vip-mode)

I tried that, but the first time I started emacs with it, it prompted me with an "inhibit vip-mode something", to which I responded n, and after that, subsequent startups wouldn't use vip-mode.

0
13.10.2009 19:01:02

If really want to use vi/vim in Emacs, I think you maybe like evil(a great vim emulation, the successor to Vimpulse and vim-mode).

If you want to know more about evil, you can Google Emacs wiki evil.

Basic description: (after you have installed this package) With basic settings, this package will get in vim-mode at start up (also, you can change it).

You can use C-z to vim-mode, in this mode, you will also have other vim modes (normal insert visual ...), if you want to leave vim-mode to emacs mode, type C-z again.

Evil, really evil & cool!

1
23.11.2012 09:20:30