gpt4 book ai didi

ruby - 浏览文件时 Vim 崩溃

转载 作者:太空宇宙 更新时间:2023-11-03 18:12:09 25 4
gpt4 key购买 nike

我是 Vim 的新手。我已经使用它 2 天了(刚从子宫里出来),我在浏览我的某个 Ruby 文件时遇到了一些问题,但它没有崩溃。

在我收到错误消息之前,这里是我为重现问题所做的步骤...

  1. First I opened up the file as read-only with the :edit command

  2. If the file has no syntax coloring turn it on :syntax on. (For some reason it doesn't crash without it.)

  3. Navigate up and down the file with j and k (reproduces the crash quicker when you set the cursor in a position where it would scatter the cursor more. For ex, the end of a line)


起初我以为我的 .rb 文件有问题,但我也能够用位于 tk.rb 文件重现同样的崩溃>lib\ruby\2.2.0\ 文件夹。使用 tk.rb 花费了更多时间,因为代码中的注释使其更难崩溃。 (我建议在有很多行的文件上尝试它)。

这是我重现问题的 gif 以及我正在浏览以重现崩溃的文件...

http://puu.sh/jHXXG/14d2cf6460.gif

http://puu.sh/jHVG2/fdae9e38fa.rar

我正在使用 Vim 7.4 和 Windows 10。如果需要更多信息,请在评论中询问。我想知道如何解决这个问题。 Vim 看起来是一个非常好的程序。但是,如果它会因为使用 hjkl 导航而伤透自己和我的心。我可能不得不回到岔路口,沿着 emacs 的道路走下去。

最佳答案

正如评论中指出的那样,如果问题确实出在 Vim 中,您应该提交错误报告。

但首先您应该尝试以下操作:

  1. 确保您使用的是带有最新补丁的版本;有一些报告与您所描述的问题类似,并且有可能已经解决了。
  2. 检查是否有任何设置/插件触发了问题,超出了 :syntaxVim-FAQ 2.5 处的程序会有帮助。一些相关部分如下:

2.5. I have a "xyz" (some) problem with Vim. How do I determine it is a problem with my setup or with Vim? / Have I found a bug in Vim?

First, you need to find out, whether the error is in the actual runtime files or any plugin that is distributed with Vim or whether it is a simple side effect of any configuration option from your .vimrc or .gvimrc. So first, start vim like this:

vim -u NONE -U NONE -N -i NONE

this starts Vim in nocompatible mode (-N), without reading your viminfo file (-i NONE), without reading any configuration file (-u NONE for not reading .vimrc file and -U NONE for not reading a .gvimrc file) or even plugin.

If the error does not occur when starting Vim this way, then the problem is either related to some plugin of yours or some setting in one of your local setup files. You need to find out, what triggers the error, you try starting Vim this way:

vim -u NONE -U NONE -N

If the error occurs, the problem is your .viminfo file. Simply delete the viminfo file then. If the error does not occur, try:

vim -u ~/.vimrc --noplugin -N -i NONE

This will simply use your .vimrc as configuration file, but not load any plugins. If the error occurs this time, the error is possibly caused by some configuration option inside your .vimrc file. Depending on the length of your vimrc file, it can be quite hard to trace the origin within that file.

The best way is to add :finish command in the middle of your .vimrc. Then restart again using the same command line. If the error still occurs, the bug must be caused because of a setting in the first half of your .vimrc. If it doesn't happen, the problematic setting must be in the second half of your .vimrc. So move the :finish command to the middle of that half, of which you know that triggers the error and move your way along, until you find the problematic option. If your .vimrc is 350 lines long, you need at a maximum 9 tries to find the offending line (in practise, this can often be further reduced, since often lines depend on each other).

If the problem does not occur, when only loading your .vimrc file, the error must be caused by a plugin or another runtime file (indent autoload or syntax script). Check the output of the :scriptnames command to see what files have been loaded and for each one try to disable each one by one and see which one triggers the bug. Often files that are loaded by vim, have a simple configuration variable to disable them, but you need to check inside each file separately.

  1. 如果前面的步骤没有解决问题,您可以尝试检查类似的错误报告并尝试一些仍未合并的补丁:

关于ruby - 浏览文件时 Vim 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32115208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com