Reputation: 193
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?
Upvotes: 3
Views: 108
Reputation: 28406
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
:help recursive_mapping
Upvotes: 5