I have many python code examples in my markdown files, which should be prepended with
So I write a vim function to do this job:
function AddShellPrompt() range let lnum = a:firstline while lnum <= a:lastline let replaced_line = substitute(getline(lnum), '^\s\+', '&>>>', '') call setline(lnum, replaced_line) let lnum += 1 endwhile endfunction
The problem is, for raw text like:
pow(2, 3) 8
I need only add
pow(2, 3), but not before
So I need to expand my regex.
It comes to me that if I only add
>>> for a line which contains any character of
I can get a pretty good result(though not perfect).
But the problem is, how to write regex (especially in vim) which expresses Some of the characters in the given set has appeared in the current line?