维姆:100+字符长度搜索查询导致崩溃

发布于 2024-12-18 13:49:30 字数 383 浏览 1 评论 0原文

在 gVim 搜索窗口(“q/”)中,我的屏幕在换行之前可以容纳 100 个字符。 (这与主编辑窗口中的文本换行设置不同。)在构建复杂的搜索查询(我稍后将其插入命令语句中)时,当我尝试运行 gVim 时,它会锁定它 - 仅当以下情况时才会发生这种情况:查询行在此窗口内换行。我写的那一行似乎没有什么不寻常的地方。我第一个迹象表明可能出现问题是当我看到 gVim 自动放置在“/”之前(在搜索窗口内的搜索查询语句之前)被添加到查询行的包裹部分时 - 但是,显然,我不确定那是的问题。

有其他人在 gVim 中开发长搜索查询时遇到困难吗?我在 Ubuntu Natty 系统上运行 7.3(带补丁 1-35)。

我意识到我可以将这条线分解成更小的函数,但我几乎已经完成了这种方式,并且有兴趣发现一种解决方案 - 如果有的话。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苦妄 2024-12-25 13:49:30

作为一种解决方法,您可以使用常规 vim 脚本/缓冲区来分配搜索模式

一种“简单”方法:

  1. 打开一个(新)缓冲区,
  2. 在单行长行上输入搜索模式,就像在搜索窗口中一样
  3. do以下命令将搜索模式设置为搜索寄存器:

    :let @/=getline('.')
    

这一事实

  • 这与在搜索窗口内按 Enter 键具有相同的效果,除了光标获胜 不跳转到第一个匹配项,
  • 该模式不会记录在搜索历史记录中(有效避免崩溃)

这个基本主题有许多变体。其本质是:将您的搜索模式直接分配给 @/

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 @/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文