aboutsummaryrefslogtreecommitdiff
path: root/doc/strip_trailing_whitespace.txt
blob: 96635abc5314ac4306cd1cbf729a53063b6edc3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
*strip_trailing_whitespace.txt*	For Vim version 6.0	Last change: 2018 June 10

DESCRIPTION				*strip_trailing_whitespace*

This plugin provides a mapping target and an optional custom command with the
author's approach to stripping trailing whitespace from an entire buffer,
including removing empty or whitespace-only lines at the end of the buffer,
without making command noise and without moving the cursor from its current
position.

This is a very commonly written and implemented plugin, but I wrote my own
because I could not find a plugin that did this in exactly the way I wanted:

- Provide a |<Plug>| mapping
- Provide a user command to do the stripping as well if wanted
- Strip trailing lines as well as trailing spaces, reporting both
- Work with even very old Vim (>=6.0)
- Work with a single |undo|
- Don't move the cursor
- Don't change the search pattern
- Don't define an |autocmd|
- Don't force a key mapping
- Don't define a global function

REQUIREMENTS				*strip_trailing_whitespace-requirements*

This plugin is only available if 'compatible' is not set.

COMMANDS				*strip_trailing_whitespace-commands*

					*:StripTrailingWhitespace*
The plugin provides a single `:StripTrailingWhitespace` command if Vim has the
|+user_commands| feature, but this is not required. It operates on the entire
buffer, and accepts neither a range nor arguments.

MAPPINGS				*strip_trailing_whitespace-mappings*

					*<Plug>StripTrailingWhitespace*
The single mapping target provided is |<Plug>StripTrailingWhitespace|,
mappable in any mode. There is no default key mapping to the target; you
should define this yourself in your |vimrc|. For example:
>
	:nmap <Leader>x <Plug>StripTrailingWhitespace
<
AUTHOR					*strip_trailing_whitespace-author*

Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.

LICENSE					*strip_trailing_whitespace-license*

Licensed for distribution under the same terms as Vim itself (see |license|).

 vim:tw=78:ts=8:ft=help:norl: