vim-textobj-sentence icon indicating copy to clipboard operation
vim-textobj-sentence copied to clipboard

Allow users to specify additional sentence terminators

Open ghost opened this issue 5 years ago • 4 comments

I use this to prevent LeTeX environments from interfering with sentence rewrapping (gqis). In my after/ftplugin/tex.vim:

let g:re_term_user =                                                                 
  \ '|\\begin\{[a-zA-Z]*\}' .
  \ '|\\end\{[a-zA-Z]*\}'

call textobj#sentence#init()

ghost avatar Aug 24 '20 15:08 ghost

Okay, I will do that. I am also thinking about the interface and might try to make it more flexible. Will probably update the pull request on the weekend. Thanks for considering to merge it!

ghost avatar Aug 27 '20 12:08 ghost

I have been working on it and noticed a problem: there is interference with the l:re_negative_lookback. What I mean is, when I add a custom terminator and use gqis on a line preceeded by one of the custom terminators, it will read backwards to far and reformat too much.

I noticed that problem is gone when I remove l:re_negative_lookback from b:textobj_sentence_re_i, but that is of course not a satisfactory solution.

Any suggestions how this can be fixed properly, i.e., by adjusting l:re_negative_lookback based on g:re_extra_sentence_term?

sekoenig avatar Aug 27 '20 22:08 sekoenig

I've been trying but can't quite get it to work due to lack of experience with lookahead and lookbehind regexp tricks. What I want to do is modify l:re_negative_lookback so that it does not read across anything that is specified in g:re_extra_sentence_term. Can you perhaps help me by explaining what exactly the current l:re_negative_lookback does and what is its interplay with l:leading and l:trailing?

sekoenig avatar Aug 30 '20 19:08 sekoenig

Has there been any new progress on this PR (Pull Request)?

VimWei avatar Jun 08 '24 13:06 VimWei