7

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?

1
  • 1
    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.
    – toogley
    Feb 16 '17 at 14:31
8

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 )
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)
2
  • 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?
    – Jeff Bauer
    Jul 8 '16 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.