sponsor Vim development Vim logo Vim Book Ad

Improved paragraph motion : Improve paragraph motion

 script karma  Rating 20/9, Downloaded by 365    Comments, bugs, improvements  Vim wiki

created by
Luke Ng
script type
A simple utility improve the "{" and "}" motion in normal / visual mode.
In vim, a blank line only containing white space is NOT a paragraph
boundary, this utility remap the key "{" and "}" to handle that.

It supports in normal and visual mode, and able to handle with count. It
also support redefine the regexp for boundary, or local definition of

The utility uses a custom regexp to define paragraph boundaries, the
matched line will be treated as paragraph boundary.
Note that the regexp will be enforced to match from the start of line, to
avoid strange behaviour when moving.

Configuration Variables:
g:ip_skipfold     Set as 1 will make the "{" and "}" motion skip paragraph
                  boundaries in closed fold.
                  Default is 0.

g:ip_boundary     The global definition of paragraph boundary.
                  Default value is "\s*$".
                  It can be changed in .vimrc or anytime. Defining
                  b:ip_boundary will override this setting.

                      :let g:ip_boundary = '"\?\s*$'
                  Setting that will make empty lines, and lines only
                  contains '"' as boundaries.

                  Note that there is no need adding a "^" sign at the
                  beginning. It is enforced by the script.

b:ip_boundary     Local definition of paragraph boundary. It will override
                  g:ip_boundary if set. Useful when customize boundary for
                  local buffer or only apply to particular file type.
                  Default is unset.
install details
Simply copy the file to plugin folder and restart vim.

If you do not know where to place it,
check with "USING A GLOBAL PLUGIN" under :help standard-plugin

Without any setting, it will treat empty line (with or without space) as
paragraph boundary.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ipmotion.vim 1.0 2012-02-27 6.0 Luke Ng Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo