I have this added to my vimrc

map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>

This is from vim-go-tutorial here.

While after running a simple :GoBuild with some errors, while trying to jump to the next error, it doesn't do as intended jump to the next definition. While doing :cnext and then doing a <C-m> works and executes :cprevious

While in the file, I tried running :map <c-m> and it only shows being mapped to :cprevious which is why this command was working in the first place, but then when I tried doing a :map <c-n>, It showed me a couple of things being mapped

x  <C-N>       * :<C-U>call multiple_cursors#new("v", 0)<CR>
n  <C-N>       * :call multiple_cursors#new("n", 1)<CR>
os <C-N>         :cnext<CR>

While I don't have the other two mappings being showed in my vimrc, how do I remove these two other invocations and just have :cnext

1 Answer 1


They were added by a plugin

It looks like these mappings are added by the vim-multiple-cursors plugin.

To prevent that plugin from overriding your <C-n> mapping, you can either remove the plugin (the fact that you didn't recognise it suggests you don't use it?) or tell it not to create mappings and set up your own:

let g:multi_cursor_use_default_mapping=0

" Default mapping
"let g:multi_cursor_start_word_key      = '<C-n>' USE SOMETHING ELSE INSTEAD
"                                         OF `<C-n>` HERE
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key           = 'g<C-n>'
let g:multi_cursor_select_all_key      = 'g<A-n>'
let g:multi_cursor_next_key            = '<C-n>' AND PROBABLY HERE
let g:multi_cursor_prev_key            = '<C-p>'
let g:multi_cursor_skip_key            = '<C-x>'
let g:multi_cursor_quit_key            = '<Esc>'

N.B. The vim-multiple-cursors GitHub page has a massive banner saying that the plugin is deprecated and that you should use vim-visual-multi instead. Note that vim-visual-multi also overrides <C-n> by default, but has a different mechanism for changing the mapping it uses.

Using both sets of mappings

If you only want to use your <C-n> mapping in Go files, and want to use the vim-multiple-cursors plugin's mapping elsewhere, then you could instead set up your mappings for the Go filetype by creating the file ~/.vim/after/ftplugin/go if it doesn't already exist, and then adding your mapping as a buffer-local mapping in that file:

nnoremap <buffer> <C-n> :cnext<CR>
nnoremap <buffer> <C-m> :cprevious<CR>

Your Answer

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

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