Ricalsin
Ricalsin

Reputation: 940

Vim: 100+ character length search query causes crash

In the gVim Search window ("q/"), my screen can fit 100 characters before wrapping the line. (This is apart from the text-wrapping setting in the main editing window.) In building a complex search query (that I would later plug into a command statement) it locks up gVim when I try to run it - which only occurs if the query line wraps within this window. There appears to be nothing in the line I wrote that was out of the ordinary. My first sign that something might be wrong was when I saw gVim's automatically placed pre "/" (before the search query sentence within the Search Window) was added to the wrapped portion of the query line - but, obviously, I am not sure that's the issue.

Has anyone else experienced difficulty in developing long search queries in gVim? I'm running 7.3 (w/patches 1-35) on a Ubuntu Natty system.

I realize I can break this line apart into smaller functions, but I was almost done doing it this way and would be interested in discovering a solution - if there is one.

Upvotes: 2

Views: 162

Answers (1)

sehe
sehe

Reputation: 392903

As a workaround, you can use a regular vim script/buffer to assign search patterns

One 'simple' approach:

  1. open a (new) buffer
  2. type the search pattern as you would in the search window, on a single long line
  3. do the following command to set the searchpattern as into the search register:

    :let @/=getline('.')
    

This has the same effect as pressing enter inside the Search Window, except for the fact that

  • the cursor won't jump to the first match
  • the pattern won't be recorded in the search history (effectively avoiding your crash)

There are a number of variation on this basic theme. The essence of which is: assign your search pattern directly into @/

Upvotes: 2

Related Questions