git.fiddlerwoaroof.com
Ed L authored on 31/10/2011 18:14:34
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,111 @@
1
+" Configuration file for vim
2
+set modelines=0      " CVE-2007-2438
3
+
4
+" Normally we use vim-extensions. If you want true vi-compatibility
5
+" remove change the following statements
6
+set nocompatible  " Use Vim defaults instead of 100% vi compatibility
7
+set backspace=2      " more powerful backspacing
8
+
9
+" Don't write backup file if vim is being called by "crontab -e"
10
+au BufWrite /private/tmp/crontab.* set nowritebackup
11
+" Don't write backup file if vim is being called by "chpass"
12
+au BufWrite /private/etc/pw.* set nowritebackup
13
+
14
+
15
+"Enable support for Color xterm
16
+:if has("terminfo")
17
+:  set t_Co=8
18
+:  set t_Sf=[3%p1%dm
19
+:  set t_Sb=[4%p1%dm
20
+:else
21
+:  set  t_Co=8
22
+:  set t_Sf=[3%dm
23
+:  set t_Sb=[4%dm
24
+:endif
25
+
26
+
27
+
28
+
29
+"Turn on line-numbering and auto-indent
30
+:set nu
31
+":set cindent shiftwidth=2
32
+":set cindent cino=>2
33
+
34
+"Diable the anti-python smart indent of #
35
+:set ignorecase
36
+:set smartcase
37
+
38
+
39
+"SmartIndent for Python
40
+:set smartindent
41
+:autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
42
+:autocmd BufRead *.mako set ft=mako
43
+
44
+:inoremap # X#
45
+
46
+set incsearch
47
+set scrolloff=3
48
+set wildmode=longest,list
49
+set autoread
50
+
51
+"Render tabs as 2 columns wide
52
+set tabstop=3 expandtab
53
+set shiftwidth=3
54
+":else
55
+":  set tabstop=3 softtabstop=2 expandtab
56
+":  set shiftwidth=2
57
+":endif
58
+
59
+"Code shifting with >> operator will shift code by 2 cols
60
+"    is there a way to shift code by a tab?
61
+
62
+"Turn Syntax Highlighting on by default, and assume the xterm background is black
63
+set background=dark
64
+syntax enable
65
+let python_highlight_all = 1
66
+let python_space_errors=1
67
+let python_no_tab_space_error=1
68
+nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
69
+autocmd FileType python set complete+=k~/.vim/syntax/python.vim "isk+=.,(
70
+autocmd FileType python set noexpandtab
71
+autocmd FileType python map K \pW
72
+
73
+map W wb"_dwP
74
+map cs :sil! :%s/\s\+$//g<CR>``:%s/^\(\t\+\)\( \+\(\t*\)\)\+/\1\3/gc<CR>``
75
+autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
76
+
77
+map ZZ :w<CR>
78
+map ZX :wq<cr>
79
+
80
+map <BS> dh
81
+
82
+" when we reload, tell vim to restore the cursor to the saved position
83
+:au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
84
+
85
+filetype plugin on
86
+:set pastetoggle=<F11>
87
+
88
+python << EOF
89
+import os
90
+import sys
91
+import vim
92
+for p in sys.path:
93
+    if os.path.isdir(p):
94
+        vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
95
+EOF
96
+
97
+let counter = 0                                                                          
98
+inoremap <expr> <C-L> ListItem()                                                         
99
+inoremap <expr> <C-R> ListReset()                                                        
100
+                                                                                        
101
+func ListItem()                                                                          
102
+ let g:counter += 1                                                                     
103
+ return g:counter . '. '                                                                
104
+endfunc                                                                                  
105
+                                                                                        
106
+func ListReset()                                                                         
107
+ let g:counter = 0                                                                      
108
+ return ''                                                                              
109
+endfunc                                                                                  
110
+
111
+:set diffopt=vertical,filler,iwhite,foldcolumn:0