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?
2 Answers
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 )
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)
-
1Unfortunately this doesn't quite get there, but after some searching I found the following solution work (evil-ex-define-cmd "q[uit]" nil)– MarkJun 17, 2016 at 11:31
-
1@Mark Why not add that as an answer to your question and accept it? Jul 8, 2016 at 14:47