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

[Feature Request] Add g:lexima_manually_keys #132

Open
4513ECHO opened this issue Apr 11, 2022 · 8 comments
Open

[Feature Request] Add g:lexima_manually_keys #132

4513ECHO opened this issue Apr 11, 2022 · 8 comments

Comments

@4513ECHO
Copy link
Contributor

Motivation

lexima binds mapping automatically in lexima#add_rule().
But it sometimes comes into conflict with other plugins or configs.
We want the way to avoid this problem.

Feature Overview

We can define g:lexima_manually_keys which is list of keys. lexima does not bind to these keys. Users have to use lexima#expand() by thereselves.

Example is here:

let g:lexima_manually_keys = ['$', '<CR>']

call lexima#add_rule({ 'char': '$', 'some': 'config })
call lexima#add_rule({ 'char': '<CR>', 'some': 'config })

inoremap <expr> $ DollarFunc()
cnoremap <expr> <CR> CRFunc()

function! DollarFunc() abort
  if some#condition()
    return some#function()
  endif
  return lexima#expand('$', 'i')
endfunction
@cohama
Copy link
Owner

cohama commented Apr 11, 2022

I'm not sure why g:lexima_manually_keys is necessary.
In your example, inoremap <expr> $ DollarFunc() overrides $ rules defined by lexima.vim.

@4513ECHO
Copy link
Contributor Author

Yes, surely we can override mappings if we execute *(nore)map after lexima defined rules.
However, if lexima is made lazy by plugin manager, understanding "after lexima defined rules" is hard for most users....
It is important for lexima not to bind mappings certainly.

@cohama
Copy link
Owner

cohama commented Apr 11, 2022

In my opinion, it is hard for most users to understand lazy feature and the best solution to such a situation is to not using lazy feature.

@4513ECHO
Copy link
Contributor Author

Hmm, your opinion is true. The lazy feature is advanced.
However, the most important problem is that lexima define mappings implicitly. There are many related issue in the repository about conflict of mappings. It is serious not also for advanced users but beginners.
If the way exists to avoid conflict with other plugins or configs explicitly, we can reduce such problems.

@4513ECHO
Copy link
Contributor Author

Is there any update on this?
If you don't want to include this feature, I'll close this issue. Otherwise I'll send a PR.

@cohama
Copy link
Owner

cohama commented Jul 25, 2022

I'm sorry to slow response. Yes, I can not believe this feature best solution to solve this problem.

@4513ECHO
Copy link
Contributor Author

Ok, thanks.

@cohama cohama reopened this Jun 13, 2023
@cohama
Copy link
Owner

cohama commented Jun 13, 2023

As discussed vim-jp slack, I finally found out that there are some cases adding a rule and resolving conflicts want to be done independently.

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

No branches or pull requests

2 participants