Vim – Search Around Line Breaks

searchvim

When I am editing a LaTeX document in vim, often times I want to search for a phrase. Because I have LaTeX setup to wrap lines, sometimes half of the phrase will be on one line while the other half is on the next. In such a case, the search does not find what I'm looking for. So for example

blah blah blah hello
world blah blah blah

when searching using /hello world, I don't find what I'm looking for. Is there a quick and easy way to modify this search to get me where I want to be? Or better yet, a way to tell vim to match any white space (space, tab, new line) with a space in the search string?

Best Answer

After more searching, it looks like the easiest way to do this is with \_s. So for example:

/hello\_sworld