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

multiple autocmd #155

Closed
go2chenhua opened this issue May 11, 2018 · 21 comments
Closed

multiple autocmd #155

go2chenhua opened this issue May 11, 2018 · 21 comments

Comments

@go2chenhua
Copy link

- [x ] neovim

NVIM v0.3.0-1201-g8ce639304

- [x ] Windows 7

do:

:LeaderfBufTag
:LeaderfFunction

multi time

:au BufWipeout

--- Auto-Commands ---
BufWipeout
* call leaderf#BufTag#removeCache(expand(''))
call leaderf#BufTag#removeCache(expand(''))
call leaderf#Function#removeCache(expand(''))
call leaderf#Function#removeCache(expand(''))
call leaderf#BufTag#removeCache(expand(''))
call leaderf#BufTag#removeCache(expand(''))

and

VimLeave
* call GuiClose()
call leaderf#BufTag#cleanup()
call leaderf#BufTag#cleanup()
call leaderf#Function#cleanup()
...
call leaderf#Function#cleanup()
call leaderf#Function#cleanup()j

in python code

def _defineMaps(self):
    lfCmd("call leaderf#Function#Maps()")
    lfCmd("autocmd BufWipeout * call leaderf#Function#removeCache(expand('<abuf>'))")
    lfCmd("autocmd VimLeave * call leaderf#Function#cleanup()")

changed code

def _defineMaps(self):
    lfCmd("call leaderf#Function#Maps()")
    lfCmd("augroup LFGRP")
    lfCmd("autocmd!")
    lfCmd("autocmd BufWipeout * call leaderf#Function#removeCache(expand('<abuf>'))")
    lfCmd("autocmd VimLeave * call leaderf#Function#cleanup()")
    lfCmd("augroup END")

do:
LeaderfBufTag
LeaderfFunction

multi time:

:au BufWipeout

--- Auto-Commands ---
BufWipeout
* call leaderf#BufTag#removeCache(expand(''))
call leaderf#BufTag#removeCache(expand(''))
LFGRP BufWipeout
* call leaderf#Function#removeCache(expand(''))

BUT:

when nvim quit, still slow,

@Yggdroot
Copy link
Owner

Thanks for your suggestion.
Is it slow when quiting nvim if you don't use LeaderF?

Yggdroot added a commit that referenced this issue May 12, 2018
add augroup for autocmds
@Yggdroot Yggdroot added the bug label May 12, 2018
@go2chenhua
Copy link
Author

No.

if use :LeaderfLine, works fine.

again:

image

start nvim
after
:LeaderfBufTag
or
:LeaderfFunction

quiting nvim:
need press ...

image

@Yggdroot
Copy link
Owner

The multiple autocmds shown in your screenshot work as designed(except the g:Lf_VimResized), because they are attached to different event:

lfCmd("autocmd ColorScheme * call leaderf#colorscheme#setStatusline({}, '{}')"
.format(self.buffer.number, self._stl))
lfCmd("autocmd WinEnter,FileType * call leaderf#colorscheme#setStatusline({}, '{}')"
.format(self.buffer.number, self._stl))

How to reproduce the "Press ENTER..." issue? Could you describe the steps in more detail please?

@go2chenhua
Copy link
Author

only plug 'leaderf'
start nvim
e $MYVIMRC

source ~/.config/nvim/config/plugins.vim
finish

:LeaderfFunction

sel,

:q

Press ENTER....
Press ENTER...
Press ENTER...
Press ENTER...

英文好累, 若你的电脑不出现这种问题, 那就算了. 应该是我的电脑环境问题. 谢了.

@go2chenhua
Copy link
Author

添加 silent! 之后, 就没有 Press Enter... 了. 不过, 退出很慢. 可以忍受.

function! leaderf#Function#removeCache(bufNum)
silent! call leaderf#LfPy("functionExplManager.removeCache(".a:bufNum.")")
endfunction

function! leaderf#Function#cleanup()
silent! call leaderf#LfPy("functionExplManager._beforeExit()")
endfunction

@Yggdroot
Copy link
Owner

你的neovim是哪里下载的?我装上试试这个问题。

@go2chenhua
Copy link
Author

go2chenhua commented May 13, 2018 via email

@Yggdroot
Copy link
Owner

Yggdroot commented May 13, 2018

你说的“Press Enter”的问题应该是neovim的bug。

:au VimLeave * py3 subprocess.Popen("cd", shell=True)

执行一个这样的命令,退出时就会有“Press Enter...”

@go2chenhua
Copy link
Author

测试

function! Xxxd()
    py3 import subprocess; subprocess.Popen("cd", shell=True)
endfunction

" 退出不会
au VimLeave * silent! Xxxd

" 退出有问题   -> 循环 Press Enter .... 
" au VimLeave * silent py3 import subprocess; subprocess.Popen("cd", shell=True)

" 加 silent!  -> 没问题
" au VimLeave * silent! py3 import subprocess; subprocess.Popen("cd", shell=True)


" 未加 import subprocess;  -> Press Enter 一次, 等待很久 -> 符合 issue 
" au VimLeave * silent! py3 import subprocess; subprocess.Popen("cd", shell=True)

@go2chenhua
Copy link
Author

写错了
安静退出, 无等待
au VimLeave * silent! call Xxxd()

@Yggdroot
Copy link
Owner

我知道加了silent!就不会有“press...”了,但是理论上不加任何东西也不应该有“press ...”,所以这是neovim的bug。

@Yggdroot
Copy link
Owner

这是neovim gui的问题,因为终端nvim没问题。

@Yggdroot
Copy link
Owner

开了个issue,neovim/neovim#8380

@go2chenhua
Copy link
Author

go2chenhua commented May 13, 2018 via email

@go2chenhua
Copy link
Author

init.vim

autocmd! VimLeave * call leaderf#BufTag#cleanup() | call leaderf#File#cleanup() | call leaderf#Function#cleanup() | call GuiClose() 

leaderf

comment 上面三个 autocmd

保证 GuiClose 在最后.

现在瞬间退出.

@go2chenhua
Copy link
Author

使用 VimLeavePre, 也可以更好解决.
就不用 在 用户 init.vim 里 设置.

@Yggdroot
Copy link
Owner

不想因为neovim的bug,弄那么多弯弯绕的workaround,代码里已经有好多Neovim的workaround了,等Neovim稳定点再支持吧。
话说Neovim那么多bug,你为什么在windows上用Neovim,而不是gVim?

@go2chenhua
Copy link
Author

最近才 从 sublime text 转过来.

试一下 gvim 吧, 不过 等我看完 nvim 的文档 再说, 毕竟 nvim 是未来, 就像 py3 一样.

不是 bug 吧, VimLeavePre 我是看了别人代码才知道的, 我装的其他插件没用 VimLeave.

本地修改代码, 还是比较好.

话说, 动态添加 autocmd, 有点频繁, 添加一次 autocmd 就行.

最后, 我还是 comment 了这些动态代码, comment 了 非 fuzzyMatchC 的实现.

thx.

@Yggdroot
Copy link
Owner

也许你是对的,使用VimLeavePre 确实没问题了,不过gVim使用VimLeave也没问题,我觉得这是neovim的bug。

Yggdroot added a commit that referenced this issue May 13, 2018
change VimLeave to VimLeavePre
@Yggdroot
Copy link
Owner

Yggdroot commented May 14, 2018

确认是neovim-qt的bug,equalsraf/neovim-qt#394 .

@Yggdroot
Copy link
Owner

我还没怎么用neovim就已经遇到一堆bug了,我都开了十来个issue了,neovim/neovim#8382
这是一个新发现的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants