1 " Purpose: My personal .vimrc
4 "Essential resources for vim users
5 " - vim.sf.net -- find tips and scripts for vim and gvim
7 "By calling ":help keyword" you get help for the specific
13 " Pathogen runtime path manipulation
14 "call pathogen#infect() "Using the infect method breaks ft detection
16 call pathogen#runtime_append_all_bundles()
17 call pathogen#helptags()
21 "Activate syntax highlighting
23 "Activate filetype plugins: syntax highlighting, indentation, and more
24 filetype plugin indent on
28 set backspace=indent,eol,start
30 "vim-7 and newer has vimspell (spell checker) built in
32 set spelllang=de_at,en
34 "set colorcolumn=80,+1
38 "Set some properties for ctags, grep and the size of the
39 "most-left column for foldings
41 set grepprg=grep\ -nH\ $*
44 "Set incremental search and highlighted search results
49 "Power saving tip: powertop-homepage
50 let &guicursor = &guicursor . ",a:blinkon0"
51 "According to vim help -- enable mouse in xterm...
55 "Open current file with a specific program
57 execute ":!" . a:prog . " % &"
61 " Use the below highlight group when displaying bad whitespace is desired.
62 highlight BadWhitespace ctermbg=red guibg=red
63 " Make trailing whitespace be flagged as bad.
64 au Filetype python,tex,c,cpp,cs,objc,java syn match BadWhitespace /\s\+$/ containedin=ALL
66 set listchars=tab:»,trail:·,eol:$
72 if exists(":DetectIndent")
73 au BufReadPost * :DetectIndent
75 "au Filetype python,tex,c,cpp,cs,objc,java :DetectIndent
76 "let g:detectindent_preferred_expandtab = 1
77 "let g:detectindent_preferred_indent = 4
80 let g:syntastic_mode_map = { 'mode' : 'active', 'active_filetypes' : [], 'passive_filetypes' : ['html'] }
85 let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
86 colorscheme shuber-wombat
92 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
94 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
96 map <A-c> <plug>NERDCommenterToggle
99 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
101 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
103 "let fortran_free_source=1
104 au BufNewFile *.f90 set fortran_free_source=1
105 au Filetype fortran set cindent cst csto=0
108 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
109 " C, C++, C#, objc, java
110 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
112 au Filetype c,cpp,cs,objc,java map <F4> :cnext <CR>
113 au Filetype c,cpp,cs,objc,java map <S-F4> :cprevious <CR>
114 au Filetype c,cpp,cs,objc,java map <F11> :AS <CR>
115 au Filetype c,cpp,cs,objc,java map <S-F11> :A <CR>
116 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
117 au Filetype c,cpp,cs,objc map <F7> :make <CR>
118 au Filetype java map <F7> :!ant -f ../build.xml <CR>
119 au Filetype c,cpp,cs,obj set makeprg=make
122 "Adds STL prefix 'std::' to 'id'
123 function AddNamespaceDeclTo(ns, id)
124 echo "Add '" . a:ns . "' to " . a:id
125 "Line starts with a:id
126 execute ":%s!^\\(\\s*\\)" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!e"
127 "Line beginning, white space, not # or / (preprocessor or comment)
128 execute ":%s!^\\(\\s*[^#/].*[^:]\\)\\<" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!ge"
132 "Adds STL prefix 'std::' to several identifiers
133 function AddSTLNamespaceDecl()
134 call AddNamespaceDeclTo("std","cin")
135 call AddNamespaceDeclTo("std","cout")
136 call AddNamespaceDeclTo("std","cerr")
138 call AddNamespaceDeclTo("std","swap")
139 call AddNamespaceDeclTo("std","sort")
140 call AddNamespaceDeclTo("std","max")
141 call AddNamespaceDeclTo("std","min")
143 call AddNamespaceDeclTo("std","deque")
144 call AddNamespaceDeclTo("std","endl")
145 call AddNamespaceDeclTo("std","list")
146 call AddNamespaceDeclTo("std","map")
147 call AddNamespaceDeclTo("std","multimap")
148 call AddNamespaceDeclTo("std","ostream")
149 call AddNamespaceDeclTo("std","pair")
150 call AddNamespaceDeclTo("std","priority_queue")
151 call AddNamespaceDeclTo("std","set")
152 call AddNamespaceDeclTo("std","queue")
153 call AddNamespaceDeclTo("std","stack")
154 call AddNamespaceDeclTo("std","string")
155 call AddNamespaceDeclTo("std","vector")
159 function EscapeHexToChar()
160 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
162 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
163 execute '%s/^\(.*\)$/"\1"/'
168 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
170 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
172 au Filetype text set textwidth=80
173 "According to thunderbirds settings
174 au Filetype mail set textwidth=72
176 "a and w reformat the paragraph automatically and a new paragraph
177 "is indicated by lines not ending with white-space
179 au Filetype mail,text set fo+=n spell
183 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
184 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
188 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
190 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
192 "au Filetype php set fo=tcqn
194 au Filetype php set spell
197 au Filetype php set textwidth=80
198 "au Filetype php set cindent
203 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
205 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
207 au BufRead,BufNewFile *.cls set filetype=tex
208 au Filetype tex set textwidth=80
211 function TexTransUmlaute()
212 execute ':%s/ü/\\\"u/ge'
213 execute ':%s/Ü/\\\"U/&'
214 execute ':%s/ö/\\\"o/&'
215 execute ':%s/Ö/\\\"O/&'
216 execute ':%s/ä/\\\"a/&'
217 execute ':%s/Ä/\\\"A/&'
218 execute ':%s/ß/\\\"s/&'
219 execute ':%s/²/\^2/&'
223 function FindWordRepeatings()
224 execute '/\(\<\S\+\>\)\s\+\1\>'
225 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
230 let g:tex_flavor = "latex"
231 let g:LatexBox_viewer="okular"
232 let g:LatexBox_latexmk_options="-pvc"
234 au Filetype tex set smartindent
237 au Filetype tex set spell
242 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
244 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
246 au Filetype python map <F5> :!python % <CR>
249 " vimrc file for following the coding standards specified in PEP 7 & 8.
251 " Number of spaces that a pre-existing tab is equal to.
252 " For the amount of space used for a new tab use shiftwidth.
253 au Filetype python set shiftwidth=4
254 au Filetype python set expandtab
256 " Wrap text after a certain number of characters
257 au Filetype python set textwidth=79
260 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
262 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
264 "Opens the current file in ipe
265 au Filetype xml map <M-o> :call OpenIn("ipe") <CR>
268 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
270 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
272 "Opens the current file in ipe
273 au Filetype gnuplot map <M-o> :call OpenIn("gnuplot -persist") <CR>
276 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
278 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
280 let g:ycm_min_num_of_chars_for_completion = 999
281 let g:ycm_key_list_select_completion = ['<Down>']
285 if filereadable($HOME . "/.vimrc-local")
286 source ~/.vimrc-local