Vim Find/Replace Tips #2
将每个
awfDao.update(awfQueue, TCLS_AWF_QUEUE);
行上面加一行
awfQueue.setUpdateBy(super.getCurrentUser().getUserId());
%s/\(\s*\)\(awfDao.update(awfQueue,.*TCLS_AWF_QUEUE.*);\)/\1awfQueue.setUpdateBy(super.getCurrentUser().getUserId());\r\1\2/
执行后即变为
awfQueue.setUpdateBy(super.getCurrentUser().getUserId());
awfDao.update(awfQueue, TCLS_AWF_QUEUE);
其中\1代表第一个匹配参数\(\s*\),即语句前面的空格缩进
\2代表第二个匹配参数,即awfDao.update(awfQueue, TCLS_AWF_QUEUE);
星期三, 一月 31, 2007 | 标签: vim | 0 Comments
Vim Find/Replace Tips #1
打算把所有抛出BaseAdminException的Logger都去掉
} catch (BaseAdminException e) { |
执行如下语句即可:
:%s/} catch (BaseAdminException e) {\_s*logger.error.*);/} catch (BaseAdminException e) {
星期二, 一月 30, 2007 | 标签: vim | 0 Comments
订阅:
博文 (Atom)