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

bullets-newline fails to trigger InsertEnter and InsertLeave events #151

Open
VimWei opened this issue May 13, 2024 · 2 comments
Open

bullets-newline fails to trigger InsertEnter and InsertLeave events #151

VimWei opened this issue May 13, 2024 · 2 comments

Comments

@VimWei
Copy link

VimWei commented May 13, 2024

brglng/vim-im-select is dedicated to automatically toggling the state of input methods, significantly improving the experience for users working with non-English input methods.

But bullets-vim conflicts with brglng/vim-im-select:

`let g:bullets_custom_mappings = [ ['nmap', 'o', '<Plug>(bullets-newline)'] ]`

o can add bullets-newline but fails to trigger vim's InsertEnter and InsertLeave events. but this trigger is required by vim-im-select.

@VimWei VimWei changed the title Conflicts with brglng/vim-im-select bullets-newline fails to trigger vim's InsertEnter and InsertLeave events May 13, 2024
@VimWei VimWei changed the title bullets-newline fails to trigger vim's InsertEnter and InsertLeave events bullets-newline fails to trigger InsertEnter and InsertLeave events May 13, 2024
@harshad1
Copy link
Collaborator

harshad1 commented May 15, 2024

FWIW, o appears to work correctly without the custom mapping - it inserts a new line below, adds the correct bullet / number, and enters insert mode..

Ignore this

@VimWei
Copy link
Author

VimWei commented May 15, 2024

After update RIME/weasel from 0.15 to 0.16 : https://github.com/rime/weasel/releases/tag/0.16.0

There have been some changes in the results:

  1. o can add bullets-newline and trigger vim-im-select properly.
  2. But O with the following definition fails to trigger vim-im-select:
    function! SmartBulletsNewlineAbove()
        let l:save_cursor = getcurpos()
        let l:current_line_num = l:save_cursor[1]
        execute "normal! \<Plug>(bullets-newline)"
        if line('.') > l:current_line_num
            execute line('.') . 'move ' . (l:current_line_num - 1)
        endif
        execute "normal! \<Plug>(bullets-renumber)"
        call setpos('.', [0, l:current_line_num, 0, 0])
        call feedkeys('A', 'i')
    endfunction

    let g:bullets_custom_mappings = [ ['nmap', 'O', ':call SmartBulletsNewlineAbove()<CR>']]

It seems that the issue lies with the line: execute "normal! \<Plug>(bullets-newline)"

Hoping that Bullets.vim can provide an official <Plug>(bullets-newline-above) for better compatibility with other plugins.

ref: #110

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