English 中文(简体)
Vim,搜索文件标题[封闭]
原标题:Vim, search in document header [closed]
  • 时间:2012-01-14 13:33:56
  •  标签:
  • search
  • vim
Closed. This question needs details or clarity. It is not currently accepting answers.

我需要一种宏观/功能,从顶头开始,以寻找一种具体模式。 删除第1行的斜线。

举例来说,本说明:

"This is the first line

"This is the third line

if exists("did_something")

如果它发现这种模式,否则就会停止。

All help appreciated!

最佳回答

让我说一下你的模式是这封信。

a. 寻求一条没有评论的行文,但包含以下内容:

 /^\%(s*")@!.*e

使用了负头号(@!),以确认该行的起步(<>>>/code>)后面是一开始评论(whitespace, 然后是一番引用s*>),但随后是一(.*e)。 <代码/>%(>>>>>使所附模式成为其他操作者(如负光头)可以作为一个单位运作的一种原子。

采用<代码>:g

 :g/^\%(s*")@!.*e/echo "found one"

查看现有线路是否匹配,使用<代码>match()。

 :echo match( getline(line( . )),  ^\%(s*")@!.*e  ) >= 0 ?  true  :  false 

监管部门几乎总是一样,问题在于你想要与对应关系做些什么?

问题回答

暂无回答




相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签