Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLVED]和vim-multiple-cursors同时工作时异常卡顿 #2

Closed
wyntau opened this issue Nov 5, 2015 · 9 comments
Closed

[SOLVED]和vim-multiple-cursors同时工作时异常卡顿 #2

wyntau opened this issue Nov 5, 2015 · 9 comments
Labels

Comments

@wyntau
Copy link
Contributor

wyntau commented Nov 5, 2015

在vim里面执行下面的代码后, 写一些代码, 然后查看profile.log, 会得到下面的两个

:profile start profile.log
:profile func *
:profile file *
" At this point do slow actions
:profile pause
:noautocmd qall!
FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
  290  16.731661             Fcitx2en()
  290   7.645549             Fcitx2zh()
   26   2.532700   2.510486  <SNR>191_wait_for_user_input()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
  290             16.731661  Fcitx2en()
  290              7.645549  Fcitx2zh()
   26   2.532700   2.510486  <SNR>191_wait_for_user_input()
FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
  178   5.211900             Fcitx2en()
  917   2.788163             provider#python#Call()
  178   1.443873   1.067604  <SNR>193_OnInsertLeave()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
  178              5.211900  Fcitx2en()
  917              2.788163  provider#python#Call()
   15   1.153560   1.147730  <SNR>196_wait_for_user_input()
@xcodebuild
Copy link
Owner

这里的调用次数是正常的么,是否确实切换了这么多次模式?
我测试了下应该正常,因为每次模式切换都会调用这两个函数中的一个,而且都对应一次进程调用,所以运行效率确实不高,但我使用的过程中没有感觉到明显的卡顿,我不知道有没有什么好的解决方案(也许可以异步调用?)。

@wyntau
Copy link
Contributor Author

wyntau commented Nov 5, 2015

第2个记录应该是正常的, 第1个里面我使用的vim-multiple-cursors插件, 拼音状态下使用vim-multiple-cursors插件, 可以看到状态栏里的输入法状态像疯了一样切换😱, 而且反应特别慢.
不知道vim-multiple-cursors在编辑状态时是怎么样的, 是不是因为这个插件导致vim频繁的切换模式, 所以一直调用这两个方法

@xcodebuild
Copy link
Owner

你应该重点提到vim-multiple-cursors的,那这就是个兼容问题了,我回去测试一下看看

@xcodebuild xcodebuild changed the title Fcitx2en 及 Fcitx2zh 导致vim反应慢 和vim-multiple-cursors同时工作时异常卡顿 Nov 5, 2015
@xcodebuild
Copy link
Owner

fixed in 8126a2e , 是由于 vim-multiple-cursors 引起的状态切换,目前已经修复

@wyntau
Copy link
Contributor Author

wyntau commented Nov 5, 2015

好的, 我再试试看

@wyntau
Copy link
Contributor Author

wyntau commented Nov 5, 2015

@codefalling 目前还是有些问题

使用的neovim, 输入法为 百度五笔

step 1. 正常insert mode下, 使用中文进行输入
step 2. 使用esc返回到normal mode, 可以正常移动
step 3. 再次进入insert mode, 正常切换回中文输入
step 4. 再次返回normal mode
step 5. 使用 vim-multiple-cursors 选择多个地方按下c进入编辑进入insert mode, 此时没有切换回中文输入
step 6. 使用系统快捷键切换中文输入, 输入完成后,按下esc退出vim-multiple-cursors mode, 中文没有变回英文状态
step 7. 使用shift切换回中文键盘的英文状态(或者使用系统快捷键切换回英文键盘)
step 8. 进入正常的insert mode, 状态栏显示中文输入状态, 但是输出为英文, 按下shift键才能再输出中文(如果上面是使用系统快捷键切回英文键盘, 则此处也只有使用系统 快捷键先切回英文键盘, 再切回中文才行, 按下shift无效.)

试了几次都像上面这样

@xcodebuild
Copy link
Owner

5,6步可以解决,不过我这没网了,得明天再来解决了

@xcodebuild xcodebuild reopened this Nov 5, 2015
@xcodebuild
Copy link
Owner

我以为很难实现,没想到试了下确实可行,3593614364dd7961e1e9cecff301903cf84da00e 已经修复了这个问题。

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov  5 2015 20:15:49)
MacOS X (unix) version
Included patches: 1-909
Compiled by Homebrew

输入法是 Rime

step 1. insert mode 使用中文输入
step 2. 使用 esc 返回到 normal mode, 已切换回英文
step 3. 使用 vim-multiple-cursors 选择多个地方按下 c 进入编辑进入 insert mode, 顺利切换回中文
step 4. 再次使用 esc 返回到 normal mode, 顺利切换回英文

@wyntau
Copy link
Contributor Author

wyntau commented Nov 6, 2015

@codefalling 已经解决, 非常感谢~ 👍

@wyntau wyntau changed the title 和vim-multiple-cursors同时工作时异常卡顿 [SOLVED]和vim-multiple-cursors同时工作时异常卡顿 Nov 6, 2015
@wyntau wyntau closed this as completed Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants