sponsor Vim development Vim logo Vim Book Ad

JumpToTrailingWhitespace : Motions to locate unwanted whitespace at the end of lines.

 script karma  Rating 2/2, Downloaded by 1729  Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
This plugin provides movement commands to quickly go to whitespace at the end
of each line. (Usually in order to remove it).

This plugin leverages the superior detection and customization facilities of
the companion ShowTrailingWhitespace.vim plugin (vimscript #3966), though it
can also be used without it if you're not interested in highlighting and

Instead of jumping and deleting each occurrence manually, you can use the
companion DeleteTrailingWhitespace.vim (vimscript #3967) plugin to strip off
the trailing whitespace with one command, or even have this done automatically
on each write.

]$                      Go to [count] next occurrence of trailing whitespace.
[$                      Go to [count] previous occurrence of trailing

Normal, operator-pending, and visual mode mappings are defined, even though
the latter two are typically less useful that the normal mode mappings. The
'wrapscan' setting applies.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim JumpToTrailingWhitespace*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.
- Requires the CountJump plugin (vimscript #3130), version 1.70 or higher.
- The ShowTrailingWhitespace.vim plugin (vimscript #3966) complements this
  script, but is not required. With it, the jumps consider the whitespace
  exceptions for certain filetypes.

For a permanent configuration, put the following commands into your vimrc:

To change the default mappings from ]$ to ]x, use:
    let g:JumpToTrailingWhitespace_Mapping = 'x'
To also change the [ / ] prefix to something else, follow the instructions for
CountJump-remap-motions. (This requires CountJump 1.60.)

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
JumpToTrailingWhitespace-1.10.vmb.gz 1.10 2012-09-03 7.0 Ingo Karkat - As the search obeys the 'wrapscan' setting, also issue corresponding "trailing whitespace search hit BOTTOM, continuing at TOP" wrap warning messages. This requires the enhanced CountJump plugin version 1.70.
JumpToTrailingWhitespace.vba.gz 1.01 2012-03-28 7.0 Ingo Karkat - CHG: Change g:JumpToTrailingWhitespace_mapping to g:JumpToTrailingWhitespace_Mapping.
- Document changing of [ / ] prefix through new CountJump 1.60.
JumpToTrailingWhitespace.vba.gz 1.00 2012-03-16 7.0 Ingo Karkat 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.