I am learning vim.

I am at a part that I am very excited about because I think it will lead to a lot of productivity gains: key mapping.

I added the following mapping to my .vimrc:

let mapleader = ","

nnoremap <leader>inc :set incsearch<CR>

Then I saved the file, opened a new vim file in Vim in a new tab in iTerm, and tried to run the new mapping: I typed ,inc then Enter.

The result is:

E492: Not an editor command: ,inc

When I run :map, I see the mapping listed apparently correctly.

So my question is, why might this not be working?

If need be, I can paste my .vimrc here.

EDIT: I noticed that in fact the key binding does work but not in command mode as I had erroneously thought. It works in regular normal mode.

  • Welcome to Vim :-). If the answer is solving your problem maybe could you validate it (using the green V) to avoid that it popup regularly asking for a valid answer. Jan 7 at 11:14

1 Answer 1


I suspect that what you type is :,inc and not simply ,inc

Because of the initial : you must the c flavour of map

cnoremap <leader>inc set incsearch<CR>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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