3

In my .vimrc I have these lines

nmap :s :update<cr>
nmap <F5> :set number!<cr>

Without the former mapping, the latter works, otherwise it doesn't. Why is this the case?

Enlico
  • 23,259
  • 6
  • 48
  • 102
pksimba
  • 193
  • 2
  • 10

1 Answers1

5

The problem is that the second mapping begins in a way, :s in :set, that triggers the previous mapping.

In general you should use non-recursive mappings, unless you have a reason to use recursive mappings.

In this case, you have to use

nnoremap :s :update<cr>
nnoremap <F5> :set number!<cr>

More info at

Enlico
  • 23,259
  • 6
  • 48
  • 102