limelight.vim icon indicating copy to clipboard operation
limelight.vim copied to clipboard

allow to use movements to define paragraphs

Open xi opened this issue 6 years ago • 7 comments

I really like this plugin, but it feels a bit awkward that it comes with its own definition of what a paragraph should be, considering that vim already has a definition for that.

I propose to allow to use movement commands such as {, (, [[, and [z to define paragraphs. While this might not be perfect, it could make requests like #38, #44, or #52 more feasible.

Note that this pull request includes the changes from #56 because I didn't want to separate them only to deal with merge conflicts afterwards.

xi avatar Feb 22 '19 16:02 xi

I've just tried this (in NeoVim 0.4.3, in case it's relevant). I have the following in my init.vim:

let g:limelight_mode = 'movement'
let g:limelight_bop = '('
let g:limelight_eop = ')'

As far as I can tell, this seems to be highlighting most of the document, although it seems to break somewhere around actual parenthesis characters. I'm certainly not getting the expected sentence highlighting, though!

Am I doing something wrong? Is this not working as expected? Is there any way I could get this behaviour?

josswright avatar Mar 09 '20 21:03 josswright

Hi @josswright. It's hard to know exactly what went wrong. I just tested this code with neovim 0.3.4 and it worked fine. Can you provide more information on what you expected and what you got instead?

Note that this plugin can only highlight lines. So if a sentence starts in the middle of a line, that whole line will be highlighted.

Can you maybe try highlighting a paragraph with { and }? That should create more predictable results.

xi avatar Mar 09 '20 22:03 xi

Hi @josswright. It's hard to know exactly what went wrong. I just tested this code with neovim 0.3.4 and it worked fine. Can you provide more information on what you expected and what you got instead?

Note that this plugin can only highlight lines. So if a sentence starts in the middle of a line, that whole line will be highlighted.

Can you maybe try highlighting a paragraph with { and }? That should create more predictable results.

I tried this with '{' and '}' as well. I'm editing LaTeX, so curly braces turn up fairly often. What I seem to be seeing right now is that this is highlighting all lines between any '{' or '}' character and the next instance of either of those characters.

Is the line-level highlighting a feature of Limelight itself? As I never got it working beyond the paragraph level, I never ran into this. Is that a Vim restriction or a Limelight restriction?

josswright avatar Mar 10 '20 08:03 josswright

this is working fine for me in neovim right now (v0.4.3). This is exactly the enhancement I was looking for - thanks @xi !

toejough avatar Apr 24 '20 13:04 toejough

something in this PR broke my stack navigation - I can get into a place where I'm jumping between two functions and then that's all I can do. if I type :jumps to see my stack, the pointer is always at the bottom.

disabling this option allows me to use ctrl-o and ctrl-i to navigate my stack like normal.

toejough avatar May 08 '20 13:05 toejough

Hey this is a perfect solution for the problem, everything seems to work smoothly. I'd really like to see this in the master branch.

mtshrmn avatar Nov 15 '20 18:11 mtshrmn

Any chance we could merge this?

onliner10 avatar Oct 06 '21 17:10 onliner10