How can I search a string in vim and thereby ignoring any whitespace (or particularly line breaks) between any characters?
And probably thereby making a function that can search ignoring all whitespace.
I found a way to ignore whitespace in regex. No really elegant. Just insert \s* between any character. So therefor making this a function would be really needed.
https://stackoverflow.com/questions/4590298/how-to-ignore-whitespace-in-a-regular-expression-subject-string
I also have found a way to search around line breaks in vim:
vim search around line breaks
However the last link gives a solution only if the line break is there were a space was. However I want to ignore all whitespace.
So when I search helloworld here:
blabla blalba hell
oworld bla bla h
elloworl bla bla
It should match it twice, despite the line breaks.
I thought I basically need to alter the function from the vim link a bit which changes the search to:
h\n?e\n?l\n?l\n?o\n? \n?w\n?o\n?r\n?l\n?d
Or:
h\s_?e\s_?l\s_?l\s_?o\s_? \s_?w\s_?o\s_?r\s_?l\s_?d
But I have not idea how to do alter the function for that.