cohama / lexima.vim

Auto close parentheses and repeat by dot dot dot...
999 stars 46 forks source link

Unexpected behaviour on Neovim with ALE #154

Open ottijp opened 3 weeks ago

ottijp commented 3 weeks ago

I found a unexpected behaviour on Neovim when using this plugin with ALE. I'm not sure which causes this problem.

I would like to know how to fix this problem or if there is a workaround.

Problem

When I insert [] on each line in visual mode, the expected result is as follows:

[] hoge
[] piyo

However, I got the following result:

[] hoge
pi hoyo

https://github.com/user-attachments/assets/84ecc2ec-6f3c-467c-8120-86449b4d3688

This only occurs when I insert [] (with an additional space after the closing square bracket), but not when I insert [].

Reproduction

Before starting NeoVim:

git clone https://github.com/cohama/lexima.vim
git clone https://github.com/dense-analysis/ale

My init.vim:

set rtp+=lexima.vim
set rtp+=ale

Start NeoVim:

nvim -u init.vim

And type the following:

ihoge<CR>piyo<ESC>k^<C-v>jI[<Right> <ESC>

Environment

$ sw_vers
ProductName:            macOS
ProductVersion:         13.5
BuildVersion:           22G74

$ nvim --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info

The problem occurs only in combination of Neovim and ALE.

with ALE problem occurs
Vim false false
Vim true false
NeoVim false false
NeoVim true true
cohama commented 3 weeks ago

Thanks for your report. I could reproduce this issue.

cohama commented 3 weeks ago

I think this issue is probably hard to fix. I have no idea why using with ALE causes this issue, and why vim is no problem.

cohama commented 3 weeks ago

Workaround is using <C-g>U<Right> instead of just <Right>. (See also :help i_CTRL-G_U)

<Right> (or any other cursor move keys) will break undo block. I think undo block is related to this issue.

ottijp commented 3 weeks ago

Thank you for your investigation. Although I don't fully understand the details about the undo block, I have confirmed that the workaround works.

By the way, I really appreciate your efforts in developing and maintaining this handy plugin. It helps me every day! 😀