dagcilibili
dagcilibili

Reputation: 491

Searching across multiple lines

I have switched to using vim with its very nice plugins for writing a TeX documents. However, the only problem I have is while searching for sequences that span multiple lines. I know I can write \_s\+ instead of putting spaces but it takes time to do this every time. Regarding this, is there a way to tell vim to replace, on the go, space bar push event with \_s\+ when we are searching with /?

Upvotes: 0

Views: 69

Answers (1)

FDinoff
FDinoff

Reputation: 31419

You could try this.

cnoremap <expr> <space> (getcmdtype() is# '/') ? '\_s\+' : ' '

Every time a space is encountered it is replaced by \_s\+ when the command type if / or it replaced by a space normally. (If you want this to also work when searching with ? change the / to a ?)

Upvotes: 2

Related Questions