vim 在一行的块选择内替换
我在乳胶文件中有以下表达式
\begin{dfn} \tag{Diagram $
I have the following expression in a latex file
\begin{dfn} \tag{Diagram $????$ over a trisp $\Delta$}
\label{dfn:Diagram D over a trisp Delta}
now i want to substitute all the spaces in the brackets on the second line with :
.
my idea was to visual select the expression by v%
while being on one of the brackets and then :s/\ /:/g
but this replaces all whitespaces and results in
::::::::::::::\label{dfn:Diagram:????:over:a:trisp:Delta}
which results in the task of removing the :
before the \label{…}
as vim is a very powerful editor - there should be an easier way, that I don't know yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转到第一个
{
,按v
,按%
。这将直观地选择{
和}
之间的文本。然后按:
并在迷你栏中输入s/\%V\ /:/g
。请参阅此说明:请注意,否则
g
将替换当前行上的所有内容。Go to the first
{
, pressv
, press%
. This will visually select the text between{
and}
. Then press:
and enters/\%V\ /:/g
in your minibar. See this for explanation:Note that otherwise
g
will replace all on the current line.