Skip to content

Commit f0e0862

Browse files
author
bcannon
committed
Add a highlight group for denoting bad whitespace. Also added a match rule for
leading tabs in a line when in Python mode. Also fixed some grammatical errors in the comments. git-svn-id: http://svn.python.org/projects/python/trunk@38578 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 22bc4e4 commit f0e0862

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

Misc/vimrc

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
"
1010
" All setting are protected by 'au' ('autocmd') statements. Only files ending
1111
" in .py or .pyw will trigger the Python settings while files ending in *.c or
12-
" *.h will trigger the C settings. This make the file "safe" in terms of only
12+
" *.h will trigger the C settings. This makes the file "safe" in terms of only
1313
" adjusting settings for Python and C files.
1414
"
1515
" Only basic settings needed to enforce the style guidelines are set.
1616
" Some suggested options are listed but commented out at the end of this file.
17-
"
1817

1918

2019
" Number of spaces to use for an indent.
@@ -39,6 +38,12 @@ au BufRead,BufNewFile *.py,*.pyw set expandtab
3938
au BufRead,BufNewFile *.c,*.h set noexpandtab
4039
au BufRead,BufNewFile Makefile* set noexpandtab
4140

41+
" Use the below highlight group when displaying bad whitespace is desired
42+
highlight BadWhitespace ctermbg=red guibg=red
43+
44+
" Display tabs at the beginning of a line in Python mode as bad
45+
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
46+
4247
" Wrap text after a certain number of characters
4348
" Python: 79
4449
" C: 79
@@ -67,7 +72,7 @@ au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
6772

6873
" Set the default file encoding to UTF-8: ``set encoding=utf-8``
6974

70-
" Put a marker at the beginning of the file to differentiate between UTF and
75+
" Puts a marker at the beginning of the file to differentiate between UTF and
7176
" UCS encoding (WARNING: can trick shells into thinking a text file is actually
7277
" a binary file when executing the text file): ``set bomb``
7378

@@ -79,9 +84,11 @@ au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
7984

8085
" Folding based on indentation: ``set foldmethod=indent``
8186

82-
" Make trailing whitespace explicit:
83-
"highlight WhitespaceEOL ctermbg=red guibg=red
84-
"match WhitespaceEOL /\s\+$/
85-
" or
86-
"set list listchars=trail:-
87+
" Make trailing whitespace explicit (left off since this will automatically
88+
" insert the highlight or characters *as you type*, which can get annoying):
89+
"``match BadWhitespace /\s\+$/``
90+
"
91+
" or, for a non-colored, character-based solution:
92+
"
93+
"``set list listchars=trail:-``
8794

0 commit comments

Comments
 (0)