junegunn / limelight.vim

:flashlight: All the world's indeed a stage and we are merely players
MIT License
2.36k stars 53 forks source link

allow to use movements to define paragraphs #57

Open xi opened 5 years ago

xi commented 5 years ago

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.

josswright commented 4 years ago

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?

xi commented 4 years ago

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.

josswright commented 4 years ago

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?

toejough commented 4 years ago

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 commented 4 years ago

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.

mtshrmn commented 3 years ago

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.

onliner10 commented 2 years ago

Any chance we could merge this?