haya14busa / vim-asterisk

:snowflake: *-Improved
http://www.vim.org/scripts/script.php?script_id=5059
MIT License
384 stars 19 forks source link

Sometimes crashes and closes buffer on first use #34

Closed alerque closed 4 years ago

alerque commented 4 years ago

After using (and loving!) this plugin for a while, I've reluctantly had to disable my bindings to it. I was having a problem with buffers suddenly closing on me and finally realized it was triggered by * motions (in my case bound to <Plug>(asterisk-z*).

A little bit of poking showed in typically happened on the first run in a new tab or buffer, it would typically work if I opened up the buffer and tried again, and it typically worked thereafter until I switched buffers or opened something new. Then it was likely to crash again.

I don't know how to get useful debug information as the buffer just disappears and no messages are shown but I'd be happy to try something if there is a way to get any error being reported.

I'm using Neovim and vim-plug, and other than bindings my only setting is:

let g:asterisk#keeppos = 1
haya14busa commented 4 years ago
alerque commented 4 years ago

So far I haven't been able to get this down to a minimal example. It still happens all the time in production (I have to disable it most days) but I can't figurue out what the minimal conditions are.

No I don't have any custom maps for triggering Escape.

alerque commented 4 years ago

Is there any kind of debug logging I can turn on to see what happens during the time between activating a binding an my buffer being gone? This is happening often enough if there was something I could enable to get debug info I'm sure I could sit down and make it fail.

haya14busa commented 4 years ago

How about using :h verbose (and :h verbosefile)?

ghost commented 4 years ago

I think this is a minimal reproducing.

" setting
let g:asterisk#keeppos = 1
map z*  <Plug>(asterisk-z*)

Steps below.

$ vim
:new a<CR>
:new b<CR>
ifoo<ESC>
z*

( New-lines are ignored. )

After this, the buffer is changed to a but expected to stay in b.

Is this author's case ?

alerque commented 4 years ago

@LumaKernel Yup that's pretty much it.

haya14busa commented 4 years ago

I still cannot reproduce it.

issue34.vimrc

" Put this vimrc and start vim at the root of vim-asterisk plugin.
execute "set rtp+=" . getcwd()
let g:asterisk#keeppos = 1
map z*  <Plug>(asterisk-z*)
$ vim -N -u issue34.vimrc 
:new a<CR>
:new b<CR>
ifoo<ESC>
z*
vim --version ``` $ vim --version VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 20 2019 19:38:07) Included patches: 1-2050 Compiled by Homebrew Huge version without GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_any_white +arabic +file_in_path +mouse_urxvt -tcl +autocmd +find_in_path +mouse_xterm +termguicolors +autochdir +float +multi_byte +terminal -autoservername +folding +multi_lang +terminfo -balloon_eval -footer -mzscheme +termresponse +balloon_eval_term +fork() +netbeans_intg +textobjects -browse +gettext +num64 +textprop ++builtin_terms -hangul_input +packages +timers +byte_offset +iconv +path_extra +title +channel +insert_expand +perl -toolbar +cindent +job +persistent_undo +user_commands -clientserver +jumplist +postscript +vartabs -clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +virtualedit +cmdline_hist +langmap -python +visual +cmdline_info +libcall +python3 +visualextra +comments +linebreak +quickfix +viminfo +conceal +lispindent +reltime +vreplace +cryptv +listcmds +rightleft +wildignore +cscope +localmap +ruby +wildmenu +cursorbind -lua +scrollbind +windows +cursorshape +menu +signs +writebackup +dialog_con +mksession +smartindent -X11 +diff +modify_fname -sound -xfontset +digraphs +mouse +spell -xim -dnd -mouseshape +startuptime -xpm -ebcdic +mouse_dec +statusline -xsmp +emacs_tags -mouse_gpm -sun_workshop -xterm_clipboard +eval -mouse_jsbterm +syntax -xterm_save +ex_extra +mouse_netterm +tag_binary +extra_search +mouse_sgr -tag_old_static system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/home/linuxbrew/.linuxbrew/share/vim" Compilation: gcc-5 -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc-5 -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl@1.1/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl@1.1/lib -L/home/linuxbrew/.linuxbrew/opt/readline/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/readline/lib -Wl,-E -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/perl/5.30.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/CORE -L/usr/local/lib -Wl,--as-needed -o vim -lm -lnsl -lncurses -ldl -Wl,-E -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/perl/5.30.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/CORE -fstack-protector-strong -L/usr/local/lib -L/home/linuxbrew/.linuxbrew/Cellar/perl/5.30.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -L/home/linuxbrew/.linuxbrew/Cellar/python/3.7.4_1/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/ruby/2.6.4_2/lib -L/home/linuxbrew/.linuxbrew/Cellar/ruby/2.6.4_2/lib -lruby -lm ```

How about using :h verbose (and :h verbosefile)?

Can you try this as above to understand why the buffer is closed?

alerque commented 4 years ago

@haya14busa Neovim here.

I can't get that minimum example to reproduce either. It happens enough in the wild but not in that MRE for me.

ghost commented 4 years ago

That reproducing steps is including some another options. ( Sorry, I though they doesn't effect. ) I'll try to get minimum options.

ghost commented 4 years ago
set splitbelow
set hidden

let &rtp .= ',' .. getcwd()

let g:asterisk#keeppos = 1
map z*  <Plug>(asterisk-z*)

new a
new b
exe "normal! iabc\<ESC>"
normal z*
" now, current buffer is not b

How about this?

EDIT : Sorry, this is bad....

ghost commented 4 years ago

@alerque Please let me know whether you're using splitbelow/splitright .

alerque commented 4 years ago

@LumaKernel Negative, the only thing I see that might be related to your question is set inccommand=split.

You can see my full RC file here.

ghost commented 4 years ago

The versions I tested with {vim} -u issue34.vimrc below.

/usr/bin/vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 30 2020 08:31:37) Included patches: 1-177 Compiled by luma Huge version without GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_old_static +arabic +file_in_path +mouse_urxvt -tag_any_white +autocmd +find_in_path +mouse_xterm -tcl +autochdir +float +multi_byte +termguicolors -autoservername +folding +multi_lang +terminal -balloon_eval -footer -mzscheme +terminfo +balloon_eval_term +fork() +netbeans_intg +termresponse -browse +gettext +num64 +textobjects ++builtin_terms -hangul_input +packages +textprop +byte_offset +iconv +path_extra +timers +channel +insert_expand -perl +title +cindent +job +persistent_undo -toolbar -clientserver +jumplist +popupwin +user_commands -clipboard +keymap +postscript +vartabs +cmdline_compl +lambda +printer +vertsplit +cmdline_hist +langmap +profile +virtualedit +cmdline_info +libcall -python +visual +comments +linebreak -python3 +visualextra +conceal +lispindent +quickfix +viminfo +cryptv +listcmds +reltime +vreplace +cscope +localmap +rightleft +wildignore +cursorbind -lua -ruby +wildmenu +cursorshape +menu +scrollbind +windows +dialog_con +mksession +signs +writebackup +diff +modify_fname +smartindent -X11 +digraphs +mouse -sound -xfontset -dnd -mouseshape +spell -xim -ebcdic +mouse_dec +startuptime -xpm +emacs_tags +mouse_gpm +statusline -xsmp +eval -mouse_jsbterm -sun_workshop -xterm_clipboard +ex_extra +mouse_netterm +syntax -xterm_save +extra_search +mouse_sgr +tag_binary system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/home/luma/bin/vim/8.2/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lacl -lattr -lgpm -ldl
/usr/local/bin/nvim --version NVIM v0.5.0-330-g71ee46acc Build type: Release LuaJIT 2.1.0-beta3 Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/luma/neovim/build/config -I/home/luma/neovim/src -I/home/luma/neovim/.deps/usr/include -I/usr/include -I/home/luma/neovim/build/src/nvim/auto -I/home/luma/neovim/build/include Compiled by luma Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/local/share/nvim" Run :checkhealth for more info
ghost commented 4 years ago
set hidden

let &rtp .= ',' .. getcwd()

let g:asterisk#keeppos = 1
map z*  <Plug>(asterisk-z*)

I realized that this is only happening with neovim.

haya14busa commented 4 years ago

Probably there could be a bug / an incompatible change in neovim.

What will happen when you type m` and <C-o> without moving cursor between the both commands?

In Vim, the cursor won't move and <C-o> consume 1 jumplist internally.

ghost commented 4 years ago

Cursor will move !! Then, this is Neovim's bug...? Sorry for my poor understanding about |jumplist|...

ghost commented 4 years ago

For now, I make an issue to neovim.

ghost commented 4 years ago

According to https://github.com/neovim/neovim/issues/10825 https://github.com/neovim/neovim/issues/9874#issuecomment-481369640, this behavior is a specification for neovim and recommended to use `` ...

haya14busa commented 4 years ago

As I commented https://github.com/neovim/neovim/issues/9874#issuecomment-581501666, I strongly believe neovim behavior is weird and should be fixed, but I merged #36 to fix this issue for now.

Thank you @LumaKernel for the fix and investigation :+1: