junegunn / limelight.vim

:flashlight: All the world's indeed a stage and we are merely players

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: Suggest movement to first line of next paragraph

Hotschke opened this issue · comments

Thanks for your plugin limelight.vim. I certainly like it.

IMHO your plugin could suggest movements according to your highlighting.

I feel the defaults { and } do not fit very well to the highlighting, I always have to press j to put the focus on the next paragraph only.

For example:

  • g} jump to first line of next paragraph (nnoremap g} }j)
  • g{ jump to first line of previous paragraph
    Or a more advanced behavior: if not on the first line of the current paragraph first jump to first line of current paragraph afterwards jump to the first line of the previous paragraph

I agree that g} is not very convenient for a movement which you press all the time.
But I don't know better ones which are free. (compare vim-movement-shortcuts-wallpaper)

There are also the section movement commands [[ ]] which I like and use but are not meant to be paragraph jumping.

What do you think about this?

I can see that such mappings would be useful but I don't think it's the responsibility of limelight. Limelight is all about highlighting and nothing more. You can easily define such maps in your .vimrc and there's no point in limelight doing that for you and even for the users who do not need with the addition. It's also trivial to write custom commands that maps/unmaps them while toggling limelight.

I was thinking about adding them to your Readme.md and to doc/limelight.vim not defining them. I totally agree that they should go into the users vimrc.

Actually, I am not sure whether the mappings are that easy. There are a few corner cases to consider to make them work as expected. It has to be distinguished if the cursor is on a blank line or not. Could you help me with them if you know this by heart?
Sorry if this is the wrong place to ask. Stackexchange sites did not provide a good answer.

Well, I haven't actually tried doing it, maybe something like call search('^$\n\s*\zs\S')

Ok, that's a much better way to do it than I was thinking. Very helpful.

nnoremap g} :call search('^$\n\s*\zs\S')<CR>
nnoremap g{ :call search('^$\n\s*\zs\S', 'b')<CR>

Thank you. I hope I didn't bother you too much.

No problem.