We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [search]

Searching for text with / or search(). For find/replace operations, use tag [substitute] instead.

Filter by
Sorted by
Tagged with
3
votes
1answer
927 views

How to setup AG (the silver searcher) in vim?

I am using AG to simplifying and improve the search in my vim. I remapped K to search for the current selected word as follows: if executable('ag') set grepprg=ag\ --nogroup\ --nocolor command -...
4
votes
1answer
906 views

Change '\r' to '\n' for search and replace?

In expression :s/foo/bar\n/g When replacing \n inserts a null byte, according to the docs I have to use \r. Since I insert newlines more frequently than null bytes, is there a way to change this ...
2
votes
1answer
502 views

How to remove inner content of html tag conditionally?

I've html file (e.g. curl -o page.html http://example.com/) where I would like to remove inner html block for given html tag. I've the following code which works: $ ex -V1 page.html <<-EOF /&...
1
vote
1answer
84 views

Search for continuation line

How to search for continuation line, as detected by c-indent in vim ? ie. the +N cinoption.
4
votes
2answers
596 views

How to search in Ex mode and place the cursor on the matched pattern?

I've the following example: vim -E http://example.com/ where I'd like to search for <head> tag. It seems that search only works when the lines are separated, but when the lines are joined ...
12
votes
2answers
3k views

What is the functional difference between :nohlsearch and :set nohlsearch?

I noticed that when I use :nohlsearch that it does not actually do the same thing as :set nohlsearch. In particular, the hlsearch setting is not actually switched off (which is what :set hlsearch) ...
2
votes
1answer
111 views

Configuring include-search for PHP

I just learned of the existence of include-search, but even after reading :help include-searchand :help includeexpr I'm not sure what I need to do to have [I find included and required files. How do ...
4
votes
1answer
183 views

What's the point of :promptfind after all

Not sure if it's an appropriate question. But I just can't help wondering, why would any Vim user find it necessary to invoke a GUI search prompt instead of search using / or ?, why would the designer ...
9
votes
2answers
700 views

Navigating code projects without using external commands

I am trying to gather a toolbox of Vim commands/queries, in command or search mode, for navigating a code-base without using Ctags or other external tools. Ctags are great but support can vary ...
1
vote
1answer
341 views

Delete all lines which contain any word not used anywhere else in the buffer

Note: For those of you who do not know VHDL do not worry, I will explain the problem with an example. Motivation I have a VHDL file which is a big mess of buses. I have declared many signals and I ...
6
votes
2answers
2k views

How do I search for a line that contains a pattern at column n

In writing some Vimscript to try to answer this question, I was exploring ways to "search for a line with pattern P in position X" (P is a search pattern, X is a number). One way to do this would be ...
3
votes
1answer
187 views

How can I make the “gn” motion wrap to the beginning of the file?

gn is a very useful command that selects the next search result. For example, if I insert foo bar baz into a file, move to the beginning, type /[aeiou]., and press gn, it would select oo in a visual ...
10
votes
4answers
201 views

Restricting operations to a section of code

There is many times in my day to day work life that I need to operate on a specific function, things like highlighting or searching for a variable, but I have never managed to limit the scope of the ...