Make { and } ignore lines containing only whitespace

前端 未结 5 1782
一生所求
一生所求 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:43

    As said before, if you run :help paragraph you will see that lines with whitespace are not treated as a boundary.

    In the mean time there are two plugin projects which could help:

    • Improved paragraph motion (mirrored as https://github.com/vim-scripts/Improved-paragraph-motion)
    • Vim Paragraph Motion based on the code in the other answers.

    If you use Pathogen, simply download from one of the sites mentioned above.

    If you use Vundle, put one of the following in your .vimrc:

    • Improved paragraph motion:

      Bundle 'vim-scripts/Improved-paragraph-motion'
      
    • Vim Paragraph Motion:

      Bundle 'dbakker/vim-paragraph-motion'
      

    Run :BundleInstall after a reboot and the { } motions should stop on lines containing whitespace characters.

提交回复
热议问题