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

Is it possible to make lexima continue a bullet list? #150

Closed
eight04 opened this issue Dec 15, 2023 · 2 comments
Closed

Is it possible to make lexima continue a bullet list? #150

eight04 opened this issue Dec 15, 2023 · 2 comments

Comments

@eight04
Copy link
Contributor

eight04 commented Dec 15, 2023

I tried something like:

call lexima#add_rule({'char': '<CR>', 'at': '\v^\s*\*\s+.*', 'input': '<CR>* ' })

It does work partially but if I try matching the cursor:

call lexima#add_rule({'char': '<CR>', 'at': '\v^\s*\*\s+.*\%#', 'input': '<CR>* ' })

It no longer works.

@cohama
Copy link
Owner

cohama commented Dec 20, 2023

\v can not be used with \%# because it means literary %# sequence matching but not cursor matching.

How about this.
call lexima#add_rule(#{char: '<CR>', at: '^\s*\*\s\+.*\%#', input: '<CR>* ' })

@eight04
Copy link
Contributor Author

eight04 commented Dec 20, 2023

👍

I tried mapping it to bullets.vim plugin (https://github.com/dkarter/bullets.vim/blob/746f92ae05cdcc988857d8e76418326f07af9494/plugin/bullets.vim#L1008C16-L1008C16)

call lexima#add_rule(#{char: '<CR>', at: '^\s*\*\s\+.*\%#', input: '<C-r>=BulletNewLine()<CR>' })

function! BulletNewLine()
  execute "normal \<Plug>(bullets-newline)"
  return ''
endfunction

Unfortunately, it seems there are some conflicts with cursor positioning so the cursor always ends with *| instead of * |.

@eight04 eight04 closed this as completed Dec 20, 2023
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