In browsing markdown files, I find the following search useful
/\v^(\*|#)
However, when I try to map it I get an error
nmap <c-j> /\v^(\*|#)<cr>
E488: Trailing characters: #)
What would be the best way to make this work?
In browsing markdown files, I find the following search useful
/\v^(\*|#)
However, when I try to map it I get an error
nmap <c-j> /\v^(\*|#)<cr>
E488: Trailing characters: #)
What would be the best way to make this work?
You need to use <Bar> instead of |:
nmap <c-j> /\v^(\*<Bar>#)<cr>
This is because the | is used as a command separator, for example:
nmap <C-j> :echo "Foo" | echo "bar"
Is actually seen as:
nmap <C-j> :echo "Foo"
echo "bar"
The | separates the nmap command from the echo command. In your case, Vim reads it as:
nmap <c-j> /\v^(\*
#)<cr>
Hence the somewhat confusing error.
Also see :help map_bar.
inoremap "\begin{document}" "\begin{document}<CR>\end{document}<Esc>O"
– alhelal
Feb 12 '18 at 09:33
<bar>is one of them) maybe it would be useful for you a next time. – statox Sep 06 '16 at 08:11