Make { and } ignore lines containing only whitespace

前端 未结 5 1700
一生所求
一生所求 2021-02-05 09:07

When you navigate by paragraph in vim using { and } it skips lines that contain nothing but whitespace though they are otherwise \'blank\'.

How can I convince vim to tre

5条回答
  •  星月不相逢
    2021-02-05 09:57

    The { and } commands move by "paragraph", and vim's documentation (see :help paragraph) says:

    Note that a blank line (only containing white space) is NOT a paragraph boundary.

    So the only way you can do this would be to remap { and }. Something like:

    nmap { ?^\\s*$
    nmap } /^\\s*$
    

    could work, but you may want to adjust this so it doesn't alter your search history.

提交回复
热议问题