8

I'm moving from vim to spacemacs, and the only little frustration I have at the moment is that in vim my workflow tends to involve quitting vim a lot (with :q). I find myself continually exiting spacemacs by mistake - and having to wait for it to restart. Habits die hard. How can I either remap ':q' to quit the buffer (and not spacemacs) or disable ':q' completely to force myself to learn to kill buffers the spacemacs way?

Mark
  • 440
  • 4
  • 9
  • 2
    I think you can continue your workflow if you start emacs as a daemon and run emacsclient to actually edit files. Emacsclient will then start as fast as vim does. – uuu Feb 16 '17 at 14:31

2 Answers2

9

Adding the following to my config file (~/.spacemacs) resolved the problem:

(evil-ex-define-cmd "q[uit]" nil)

This can also be used to modify the behaviour of the ex command line by replacing nil with a function name, e.g.

(evil-ex-define-cmd "q[uit]" 'evil-window-delete )
Mark
  • 440
  • 4
  • 9
3

I've never used spacemacs before or evil mode but it would make sense to rebind the key to not do anything like this:

(define-key evil-ex-map "q" nil)
Jules
  • 1,225
  • 7
  • 13
  • 1
    Unfortunately this doesn't quite get there, but after some searching I found the following solution work (evil-ex-define-cmd "q[uit]" nil) – Mark Jun 17 '16 at 11:31
  • 1
    @Mark Why not add that as an answer to your question and accept it? – Jeffrey Bauer Jul 08 '16 at 14:47