Vim -> 边确认边查找替换

本文介绍了在Vim编辑器中如何进行精确的全局查找替换操作,并提供了逐步指南来实现交互式的查找替换流程,帮助用户更高效地进行文本编辑。

进行简单的全局查找替换的时候,可以使用ex的如下命令

:%s/which/what/g


它的用法比较简单

%表示每一行(everyline)
s替换(substitue)
which查找的内容
what替换的内容
g全局(global on that line)

这样可以快速的实现全局的查找替换功能,但是有时候我们并不想一次性完成所有的替换操作,有可能只想替换一部分。

实现这种操作,我们首先想到的执行顺序应该是 查找 -> 是否修改? -> 修改 -> 查找下一个 -> 是否修改? -> 修改。

具体的命令可按如下顺序执行:

/which查找
cwwhat[ESC]chang word
n下一个,无需替换
n继续下一个,需要修改
..(dot)是用来重复上一次操作,即cwwhat[ESC]

/opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c: 在函数‘ngx_http_sticky_header_filter’中: /opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c:475:63: 错误:‘ngx_http_upstream_headers_in_t’没有名为‘cookies’的成员 if (ngx_http_parse_set_cookie_lines(&r->upstream->headers_in.cookies, &ctx->sticky_conf->cookie_name, &transfer_cookie) == NGX_DECLINED) ^ /opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c:475:3: 错误:传递‘ngx_http_parse_set_cookie_lines’的第 2 个参数时在不兼容的指针类型间转换 [-Werror] if (ngx_http_parse_set_cookie_lines(&r->upstream->headers_in.cookies, &ctx->sticky_conf->cookie_name, &transfer_cookie) == NGX_DECLINED) ^ In file included from /opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c:9:0: src/http/ngx_http.h:113:18: 附注:需要类型‘struct ngx_table_elt_t *’,但实参的类型为‘struct ngx_str_t *’ ngx_table_elt_t *ngx_http_parse_set_cookie_lines(ngx_http_request_t *r, ^ /opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c:475:3: 错误:提供给函数‘ngx_http_parse_set_cookie_lines’的实参太少 if (ngx_http_parse_set_cookie_lines(&r->upstream->headers_in.cookies, &ctx->sticky_conf->cookie_name, &transfer_cookie) == NGX_DECLINED) ^ In file included from /opt/nginx-sticky-module-ng-master/ngx_http_sticky_module.c:9:0: src/http/ngx_http.h:113:18: 附注:在此声明 ngx_table_elt_t *ngx_http_parse_set_cookie_lines(ngx_http_request_t *r,
最新发布
06-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值