I'm relatively new to vim rebinds; I am trying to map <leader>q to exit vim, but the following rebind does not seem to work:

map <leader>q :q<cr>

However, all of the following seem to be working:

nmap <leader>w :w!<cr>

map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>t<leader> :tabnext

I'm using this basic vimrc configuration as a template

Edit: turns out it was a completely unrelated problem, see the answer below.

1 Answer 1


As it turned out, I was defining map <leader>q :q<cr> before the line let mapleader = ";", which meant that for <leader>q, the leader key was either undefined or mapped to some other key.

To future beginner vim users out there, always define mapleader before you add any map <leader>X rebinds!

  • Also to future beginner vim users out there. There are a myriad ways to exit vim. The most convenient by far is ZZ, which is even easier than <leader>q. Nov 20 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .