annotate Misc/Vim/vimrc @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 1db6243e93f2
children 63770a5a0c79
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
1 " vimrc file for following the coding standards specified in PEP 7 & 8.
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
2 "
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
3 " To use this file, source it in your own personal .vimrc file (``source
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
4 " <filename>``) or, if you don't have a .vimrc file, you can just symlink to it
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
5 " (``ln -s <this file> ~/.vimrc``). All options are protected by autocmds
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
6 " (read below for an explanation of the command) so blind sourcing of this file
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
7 " is safe and will not affect your settings for non-Python or non-C files.
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
8 "
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
9 "
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
10 " All setting are protected by 'au' ('autocmd') statements. Only files ending
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
11 " in .py or .pyw will trigger the Python settings while files ending in *.c or
34694
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
12 " *.h will trigger the C settings. This makes the file "safe" in terms of only
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
13 " adjusting settings for Python and C files.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
14 "
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
15 " Only basic settings needed to enforce the style guidelines are set.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
16 " Some suggested options are listed but commented out at the end of this file.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
17
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
18
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
19 " Number of spaces to use for an indent.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
20 " This will affect Ctrl-T and 'autoindent'.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
21 " Python: 4 spaces
39712
82081ba9a5c5 Have pre-existing C files use 8 spaces indents (to match old PEP 7 style), but
Brett Cannon <bcannon@gmail.com>
parents: 39711
diff changeset
22 " C: 8 spaces (pre-existing files) or 4 spaces (new files)
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
23 au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
39712
82081ba9a5c5 Have pre-existing C files use 8 spaces indents (to match old PEP 7 style), but
Brett Cannon <bcannon@gmail.com>
parents: 39711
diff changeset
24 au BufRead *.c,*.h set shiftwidth=8
82081ba9a5c5 Have pre-existing C files use 8 spaces indents (to match old PEP 7 style), but
Brett Cannon <bcannon@gmail.com>
parents: 39711
diff changeset
25 au BufNewFile *.c,*.h set shiftwidth=4
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
26
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
27 " Number of spaces that a pre-existing tab is equal to.
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
28 " For the amount of space used for a new tab use shiftwidth.
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
29 " Python: 8
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
30 " C: 8
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
31 au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=8
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
32
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
33 " Replace tabs with the equivalent number of spaces.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
34 " Also have an autocmd for Makefiles since they require hard tabs.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
35 " Python: yes
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
36 " C: no
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
37 " Makefile: no
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
38 au BufRead,BufNewFile *.py,*.pyw set expandtab
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
39 au BufRead,BufNewFile *.c,*.h set noexpandtab
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
40 au BufRead,BufNewFile Makefile* set noexpandtab
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
41
34694
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
42 " Use the below highlight group when displaying bad whitespace is desired
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
43 highlight BadWhitespace ctermbg=red guibg=red
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
44
44376
1db6243e93f2 Make trailing whitespace explicit (including when it is an all-whitespace
Brett Cannon <bcannon@gmail.com>
parents: 39712
diff changeset
45 " Display tabs at the beginning of a line in Python mode as bad.
34694
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
46 au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
44376
1db6243e93f2 Make trailing whitespace explicit (including when it is an all-whitespace
Brett Cannon <bcannon@gmail.com>
parents: 39712
diff changeset
47 " Make trailing whitespace be flagged as bad.
1db6243e93f2 Make trailing whitespace explicit (including when it is an all-whitespace
Brett Cannon <bcannon@gmail.com>
parents: 39712
diff changeset
48 au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
34694
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
49
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
50 " Wrap text after a certain number of characters
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
51 " Python: 79
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
52 " C: 79
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
53 au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set textwidth=79
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
54
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
55 " Turn off settings in 'formatoptions' relating to comment formatting.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
56 " - c : do not automatically insert the comment leader when wrapping based on
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
57 " 'textwidth'
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
58 " - o : do not insert the comment leader when using 'o' or 'O' from command mode
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
59 " - r : do not insert the comment leader when hitting <Enter> in insert mode
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
60 " Python: not needed
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
61 " C: prevents insertion of '*' at the beginning of every line in a comment
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
62 au BufRead,BufNewFile *.c,*.h set formatoptions-=c formatoptions-=o formatoptions-=r
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
63
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
64 " Use UNIX (\n) line endings.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
65 " Only used for new files so as to not force existing files to change their
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
66 " line endings.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
67 " Python: yes
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
68 " C: yes
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
69 au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
70
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
71
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
72 " ----------------------------------------------------------------------------
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
73 " The following section contains suggested settings. While in no way required
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
74 " to meet coding standards, they are helpful.
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
75
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
76 " Set the default file encoding to UTF-8: ``set encoding=utf-8``
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
77
34694
9f078d766804 Add a highlight group for denoting bad whitespace. Also added a match rule for
Brett Cannon <bcannon@gmail.com>
parents: 33916
diff changeset
78 " Puts a marker at the beginning of the file to differentiate between UTF and
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
79 " UCS encoding (WARNING: can trick shells into thinking a text file is actually
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
80 " a binary file when executing the text file): ``set bomb``
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
81
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
82 " For full syntax highlighting:
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
83 "``let python_highlight_all=1``
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
84 "``syntax on``
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
85
34792
bbb60e269ce8 Add comment about optional option for keeping indentation level from previous
Brett Cannon <bcannon@gmail.com>
parents: 34694
diff changeset
86 " Automatically indent based on file type: ``filetype indent on``
bbb60e269ce8 Add comment about optional option for keeping indentation level from previous
Brett Cannon <bcannon@gmail.com>
parents: 34694
diff changeset
87 " Keep indentation level from previous line: ``set autoindent``
33520
3e17aed2324c When this file is sourced in, or used as, one's vimrc file it will set the proper settings to follow the style guidelines laid out in PEPs 7 & 8 as best it can without forcing extraneous settings.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
88
33916
02016d5a4dc6 Comment cleanup.
Brett Cannon <bcannon@gmail.com>
parents: 33572
diff changeset
89 " Folding based on indentation: ``set foldmethod=indent``