There is no limit to a pattern size and your mapping does exactly what you asked it to do. Your problem is that you didn't ask it to do what you want.
So your command is the following:
nmap <leader>so :sort i /ap\s\+<leader>/<cr>
What we can see in your screenshot is that when you pressed <leader>so
vim executed the mapping until it met <leader>
where it put a ,
instead. This is pretty normal you probably have let mapleader = ","
somewhere in your vimrc
. After that, the mapping continued with /
and you can't see <cr>
since it is the keypress which validates the command.
So your problem is not a limit in the pattern it is that the command you want to map doesn't work properly. To solve that you should
- Take your pattern
/ap\s\+<leader>/
and change it until it matches what you want (simply start a search with /
and modify the pattern until you are satisfied
- Once your pattern works use the command
:sort i /newpattern/
from Vim command line to be sure it works properly.
- Finally, when you command works you can create your mapping. (Note that I would advise using
nnoremap
instead of nmap
)