每当我切换到它时,VIM刷新缓冲区(VIM refreshing buffer whenever I switch to it)
我正在使用VIM编辑SCP上的文件,因此读取和写入文件是一个非常缓慢的过程。
出于某种原因,每当我切换到缓冲区时,VIM都会从磁盘读取它。 状态栏显示:〜@ k。
我已经禁用了.vimrc中的所有自动命令,而且我还没有BufEnter的自动命令。 知道我可能会缺少什么吗?
更新:我发现了一个罪魁祸首,一个不是自动命令的字数宏。 现在,当我切换它时,它会更快,但仍然很慢。 状态栏说^ Ww。
更新2:我在下面尝试了ZyX的答案(谢谢!!)。 结果:
1)设置eventignore = all绝对解决它; 它的速度非常快。 但是2)尝试调试它对我不起作用。
我尝试了两个
:debug buffer scp-buffer-name
和:debug wincmd p
并得到:进入调试模式。 输入“cont”继续。
cmd:wincmd p
第1行:对于m in filter(copy(fuf#getModeNames()),'fuf#{v:val} #requiresOnCommandPre()')`
然后无论我键入什么(s,n,“cont”),该单行都会重复。 它显然与Fuzzy Finder插件有关,我使用了很多,这是我使用VIM的一个关键原因。 有任何想法吗?
再次感谢你的帮助。 非常感谢,XyZ!
问题已解决:确实是模糊查找器。 它具有MRU-File模式,在切换缓冲区时,文档说明可能会导致性能问题。 我禁用了这种模式,现在VIM又快了! 谢谢!
I'm using VIM to edit files over SCP, so reading and writing files is a very slow process.
For some reason, whenever I switch to a buffer, VIM reads it from disk. The status bar says: ~@k.
I've disabled all autocommands in my .vimrc, and I have no autocommands for BufEnter anyway. Any idea what I might be missing?
Update: I found one culprit, a word-count macro which wasn't an auto-command. Now when I switch it's a tad faster but still slow. Status bar says ^Ww.
Update 2: I tried ZyX's answer below (Thanks!!). The results:
1) setting eventignore=all absolutely solves it; it's blazing fast. BUT 2) trying to debug it doesn't work for me.
I tried both
:debug buffer scp-buffer-name
and:debug wincmd p
and got:Entering Debug mode. Type "cont" to continue.
cmd: wincmd p
line 1: for m in filter(copy(fuf#getModeNames()), 'fuf#{v:val}#requiresOnCommandPre()')`
And then no matter what I typed (s, n, "cont"), that single line would just repeat. It's obviously related to the Fuzzy Finder plugin, which I do use quite a lot and is a key reason for me to use VIM. Any ideas?
Thanks again for your help. Much appreciated, XyZ!
ISSUE SOLVED: It was indeed Fuzzy Finder. It has a MRU-File mode which documentation notes may cause a performance issue when switching buffers. I disabled this mode and now VIM is fast again! Thanks!
原文:https://stackoverflow.com/questions/5166999
最满意答案
如何检查是否已使用适当的参数调用
I18n.with_locale
。it 'sets locale from request' allow(I18n).to receive(:with_locale) get :action, locale: locale expect(I18n).to have_received(:with_locale).with(locale) end
How about checking if
I18n.with_locale
has been called with proper parameters.it 'sets locale from request' allow(I18n).to receive(:with_locale) get :action, locale: locale expect(I18n).to have_received(:with_locale).with(locale) end
相关问答
更多-
他们的建议转换如下: setup do @request.env['HTTP_REFERER'] = 'http://test.com/sessions/new' post :create, { :user => { :email => 'invalid@abc' } } end Their recommendation translates to the following: setup do @request.env['HTTP_REFERER'] = 'http://test.com/s ...
-
在我回答你的问题之前:在你的情况下会使用Bugsnag或类似的工作吗? 另外, rescue_from Exception, with: :exception_handler为你工作? (虽然不允许你再加上例外) 我挖掘Rails源代码,似乎参数不存储在任何地方。 它们只是作为splat传递给您的邮件程序类中定义的实例方法。 但是,有一种方法可以存储它们(没有猴子修补)。 邮件程序继承自AbstractController::Base 。 看下面的代码: # Call the action. Overr ...
-
你在打电话吗? load_resource_authorize_resource 在你的控制器中就是这样,还是你包括一个模型来授权? 我发现我可以复制你的问题,如果我输入如下内容: load_resource_authorize_resource Deck 我认为后者不起作用的原因是因为您要求CanCan任意授权“Deck”,而不是授权控制器操作,而这正是您真正想要做的。 Are you calling load_resource_authorize_resource in your contro ...
-
around_action更像是append_before_action + prepend_after_action 。 在内部,想想它就像rails有两个数组, @before_actions和@after_actions 。 因此,当您声明around_action ,它会将其推送/追加到@before_actions的末尾,并且它会@before_actions / @after_actions到@after_actions 。 快速测试如下: class SomeController < Appl ...
-
Rails有很多条件(Rails has_many conditions)[2024-02-06]
使用单引号括起条件: class Profile < ActiveRecord::Base has_many :friendships has_many :removed_friends, :class_name => 'Profile', :through => :friendships, :conditions => ' ( friendships.profile_id = #{self.id} OR friend ... -
如何检查是否已使用适当的参数调用I18n.with_locale 。 it 'sets locale from request' allow(I18n).to receive(:with_locale) get :action, locale: locale expect(I18n).to have_received(:with_locale).with(locale) end How about checking if I18n.with_locale has been called wit ...
-
http://guides.rubyonrails.org/active_record_querying.html 阅读13.2在预先加载的关联中指定条件 Using where like this will only work when you pass it a Hash. For SQL-fragments you need use references to force joined tables: Article.includes(:comments).where("comments.visib ...
-
Per steve klein的评论。 我喜欢这种解决方案,因为它的透明度。 如果这不是一个假设的例子,我肯定会重新使用satisfies_condition方法来获取参数数组(对于DRYness)。 before_action :a_or_b_or_c, only: [:show] before_action :b_or_c, only: [:edit, :update, :destroy] before_action :c, only: [:index] ... private def a_or_ ...
-
rails has_many setter应该设置条件,如果指定的话(rails has_many setter should set conditions if specified)[2022-10-24]
你需要使用: my_user.awesome_friends.create(:name=>'jim')或my_user.awesome_friends.build(:name=>'jim') 在文档中: has_many(:conditions) 如果使用散列,则关联的记录创建是作用域的。 has_many:posts,:conditions => {:published => true}将使用@ blog.posts.create或@ blog.posts.build创建已发布的帖子。 You need ... -
它们是等价的。 on: :create只是一个DSL版本,然后最终转换(在后台) if: :new_record 。 来自rails的源代码 验证(参见validations / validates.rb#L123)引导我们validates_with (参见验证/ with.rb#L92),导致我们validate (参见validations.rb#L162)我们可以看到on成为if : if options.key?(:on) options = options.dup ...