cohama / lexima.vim

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

Problem using lexima with multi-cursor when press Esc #133

Closed aj3423 closed 2 years ago

aj3423 commented 2 years ago

I'm using lexima with vim-multiple-cursors plugin, after doing some modification and press Esc to quit multi-cursor mode, lexima inserts a line "lexima#insmode#escape()" at the cursor position. lexima

The strange thing is, the problem only happens when the Vim buffer has been opened for a while. It works all fine when the vim is just started. As the problem in the image above, I closed and restarted the vim, the problem is gone.

How to debug this?

Neovim version: 0.6.1

cohama commented 2 years ago

This may be caused by a combination of both lexima.vim and vim-multiple-cursors. It is difficult to fix this problem but I can suggest a work around.

If you are familiar with . (dot repeat), you don't need to use vim-multiple-cursor. If no, you can throw away a dot repeat feature of lexima by the following setting.

let g:lexima_map_escape = ""
dezza commented 2 years ago
let g:lexima_map_escape = ""

May I suggest this should be default? Unwritten rule of vim plugins is no mappings by default. Current defaults (mapping ESC) is very problematic for many plugins.

habamax/vim-select is such an example (Closing window by <esc>) breaks.

cohama commented 2 years ago

Thanks for the suggestion.

You have a point. It is true that this mapping is often asked and often conflicts with other plugins. However, lexima.vim's raison d'etre is unrestricted dot-repeatability, so I don't want to lose it by default.

I will put it in the README or help doc as a frequently asked question.

dezza commented 2 years ago

Thats your choice, I respect that.

You can maybe decide the mapping on buftype

I already see lexima is not completing on buftype=nofile so if mapping is also <buffer>-local then its breaking "less" or at least leaving a door of opportunity for other plugins to mark a buffer unaffected by the default mapping by lexima.

cohama commented 2 years ago

I understand the problem of buftype=nofile. <buffer> mapping is one of solution but I'd like to think about a better one.