> What's a good way to predefine commonly used but complex search
> patterns so they can be quickly invoked?
I am using Vim 7.2.315 with MocOS 10.4.11 Terminal.
I have pre-defined search patterns at the beginning of a "cliplog"
file.
Each entry in the cliplog is date stamped yyyymmdd.hhmmss
In any app, copy text, trigger the cliplog.sh, and the date stamped
clipboard will be appended to the file. This is the script:
date +%Y%m%d.%H%M%S >> ~/Documents/ClipLog.txt;
pbpaste >> ~/Documents/ClipLog.txt;
printf "\n\n" >> ~/Documents/ClipLog.txt;
When I want to use a search pattern, select it with visual mode, and
use this mapping:
vmap <silent> # y/<c-r><c-r>"<cr>
These are the ones I commonly use:
date stamp ^20[01][0-9]\{5}\.[0-9]\{6}
tags ( .* *)( )
gremlin [^\t\r -~]
space runs [ \t\xa0]\{2,}
trailing [ \t\xa0]\{1,}$
leading ^[ \t\xa0]\{1,}
controls [\x00-\x08\x0b\x0c\r\x0e-\x1f\x7f]\{1,}
No comments:
Post a Comment