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
83 let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
84 colorscheme shuber-wombat
90 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
92 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
94 map <A-c> <plug>NERDCommenterToggle
97 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
99 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
101 "let fortran_free_source=1
102 au BufNewFile *.f90 set fortran_free_source=1
103 au Filetype fortran set cindent cst csto=0
106 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
107 " C, C++, C#, objc, java
108 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
110 au Filetype c,cpp,cs,objc,java map <F4> :cnext <CR>
111 au Filetype c,cpp,cs,objc,java map <S-F4> :cprevious <CR>
112 au Filetype c,cpp,cs,objc,java map <F11> :AS <CR>
113 au Filetype c,cpp,cs,objc,java map <S-F11> :A <CR>
114 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
115 au Filetype c,cpp,cs,objc map <F7> :make <CR>
116 au Filetype java map <F7> :!ant -f ../build.xml <CR>
117 au Filetype c,cpp,cs,obj set makeprg=make
120 "Adds STL prefix 'std::' to 'id'
121 function AddNamespaceDeclTo(ns, id)
122 echo "Add '" . a:ns . "' to " . a:id
123 "Line starts with a:id
124 execute ":%s!^\\(\\s*\\)" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!e"
125 "Line beginning, white space, not # or / (preprocessor or comment)
126 execute ":%s!^\\(\\s*[^#/].*[^:]\\)\\<" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!ge"
130 "Adds STL prefix 'std::' to several identifiers
131 function AddSTLNamespaceDecl()
132 call AddNamespaceDeclTo("std","cin")
133 call AddNamespaceDeclTo("std","cout")
134 call AddNamespaceDeclTo("std","cerr")
136 call AddNamespaceDeclTo("std","swap")
137 call AddNamespaceDeclTo("std","sort")
138 call AddNamespaceDeclTo("std","max")
139 call AddNamespaceDeclTo("std","min")
141 call AddNamespaceDeclTo("std","deque")
142 call AddNamespaceDeclTo("std","endl")
143 call AddNamespaceDeclTo("std","list")
144 call AddNamespaceDeclTo("std","map")
145 call AddNamespaceDeclTo("std","multimap")
146 call AddNamespaceDeclTo("std","ostream")
147 call AddNamespaceDeclTo("std","pair")
148 call AddNamespaceDeclTo("std","priority_queue")
149 call AddNamespaceDeclTo("std","set")
150 call AddNamespaceDeclTo("std","queue")
151 call AddNamespaceDeclTo("std","stack")
152 call AddNamespaceDeclTo("std","string")
153 call AddNamespaceDeclTo("std","vector")
157 function EscapeHexToChar()
158 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
160 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
161 execute '%s/^\(.*\)$/"\1"/'
166 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
168 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
170 au Filetype text set textwidth=80
171 "According to thunderbirds settings
172 au Filetype mail set textwidth=72
174 "a and w reformat the paragraph automatically and a new paragraph
175 "is indicated by lines not ending with white-space
177 au Filetype mail,text set fo+=n spell
181 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
182 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
186 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
188 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
190 "au Filetype php set fo=tcqn
192 au Filetype php set spell
195 au Filetype php set textwidth=80
196 "au Filetype php set cindent
201 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
203 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
205 au BufRead,BufNewFile *.cls set filetype=tex
206 au Filetype tex set textwidth=80
209 function TexTransUmlaute()
210 execute ':%s/ü/\\\"u/ge'
211 execute ':%s/Ü/\\\"U/&'
212 execute ':%s/ö/\\\"o/&'
213 execute ':%s/Ö/\\\"O/&'
214 execute ':%s/ä/\\\"a/&'
215 execute ':%s/Ä/\\\"A/&'
216 execute ':%s/ß/\\\"s/&'
217 execute ':%s/²/\^2/&'
221 function FindWordRepeatings()
222 execute '/\(\<\S\+\>\)\s\+\1\>'
223 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
228 let g:tex_flavor = "latex"
229 let g:LatexBox_viewer="okular"
230 let g:LatexBox_latexmk_options="-pvc"
232 au Filetype tex set smartindent
234 au Filetype tex map! ,b \begin{}<Esc>i
235 au Filetype tex map! ,e <esc>:call TexClosePrev(0)<cr>a<cr>
236 au Filetype tex map! ,i \begin{itemize}<Return>\end{itemize}<ESC>O\item
237 au Filetype tex map! ,f \begin{frame}<Return>\end{frame}<ESC>O\frametitle{
238 au Filetype tex map! ,p \begin{figure}<Return>\end{figure}<ESC>O\centering<Return>\includegraphics{
243 au Filetype tex set spell
248 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
250 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
252 au Filetype python map <F5> :!python % <CR>
255 " vimrc file for following the coding standards specified in PEP 7 & 8.
257 " Number of spaces that a pre-existing tab is equal to.
258 " For the amount of space used for a new tab use shiftwidth.
259 au Filetype python set shiftwidth=4
260 au Filetype python set expandtab
262 " Wrap text after a certain number of characters
263 au Filetype python set textwidth=79
266 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
268 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
270 "Opens the current file in ipe
271 au Filetype xml map <M-o> :call OpenIn("ipe") <CR>
274 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
276 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
278 "Opens the current file in ipe
279 au Filetype gnuplot map <M-o> :call OpenIn("gnuplot -persist") <CR>
282 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
284 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
286 let g:ycm_min_num_of_chars_for_completion = 999
291 if filereadable($HOME . "/.vimrc-local")
292 source ~/.vimrc-local