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
12 "Activate filetype plugins: syntax highlighting, indentation, and more
24 "vim-7 and newer has vimspell (spell checker) built in
26 set spelllang=de_at,en
31 "Set some properties for ctags, grep and the size of the
32 "most-left column for foldings
34 set grepprg=grep\ -nH\ $*
37 "Set incremental search and highlighted search results
42 "Activate syntax highlighting
45 "Power saving tip: powertop-homepage
46 let &guicursor = &guicursor . ",a:blinkon0"
47 "According to vim help -- enable mouse in xterm...
51 "Open current file with a specific program
53 execute ":!" . a:prog . " % &"
57 " Use the below highlight group when displaying bad whitespace is desired.
58 highlight BadWhitespace ctermbg=red guibg=red
59 " Make trailing whitespace be flagged as bad.
60 au Filetype python,tex,c,cpp,cs,objc,java syn match BadWhitespace /\s\+$/ containedin=ALL
62 " set list to activate
63 set listchars=tab:»,trail:·,eol:$
66 " Pathogen runtime path manipulation
67 call pathogen#infect()
70 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
72 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
74 "let fortran_free_source=1
75 au BufNewFile *.f90 set fortran_free_source=1
76 au BufRead,BufNewFile *.INC set filetype=fortran
77 au Filetype fortran set cindent cst csto=0
82 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
84 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
86 au BufRead,BufNewFile */.irssi/logs/*.log set filetype=irssilog
89 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
90 " Easychair conference system review form
91 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
93 au BufRead,BufNewFile review_form_*.txt set filetype=easychair
94 au Syntax easychair runtime! syntax/easychair.vim
97 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
98 " C, C++, C#, objc, java
99 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
101 au Filetype c,cpp,cs,objc,java map <F4> :cnext <CR>
102 au Filetype c,cpp,cs,objc,java map <S-F4> :cprevious <CR>
103 au Filetype c,cpp,cs,objc,java map <F11> :AS <CR>
104 au Filetype c,cpp,cs,objc,java map <S-F11> :A <CR>
105 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
106 au Filetype c,cpp,cs,objc map <F7> :make <CR>
107 au Filetype java map <F7> :!ant -f ../build.xml <CR>
108 au Filetype c,cpp,cs,obj set makeprg=make
109 au Filetype c,cpp,cs,obj set tabstop=4
110 au Filetype c,cpp,cs,obj set shiftwidth=4
113 "Adds STL prefix 'std::' to 'id'
114 function AddNamespaceDeclTo(ns, id)
115 echo "Add '" . a:ns . "' to " . a:id
116 "Line starts with a:id
117 execute ":%s!^\\(\\s*\\)" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!e"
118 "Line beginning, white space, not # or / (preprocessor or comment)
119 execute ":%s!^\\(\\s*[^#/].*[^:]\\)\\<" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!ge"
123 "Adds STL prefix 'std::' to several identifiers
124 function AddSTLNamespaceDecl()
125 call AddNamespaceDeclTo("std","cin")
126 call AddNamespaceDeclTo("std","cout")
127 call AddNamespaceDeclTo("std","cerr")
129 call AddNamespaceDeclTo("std","swap")
130 call AddNamespaceDeclTo("std","sort")
131 call AddNamespaceDeclTo("std","max")
132 call AddNamespaceDeclTo("std","min")
134 call AddNamespaceDeclTo("std","deque")
135 call AddNamespaceDeclTo("std","endl")
136 call AddNamespaceDeclTo("std","list")
137 call AddNamespaceDeclTo("std","map")
138 call AddNamespaceDeclTo("std","multimap")
139 call AddNamespaceDeclTo("std","ostream")
140 call AddNamespaceDeclTo("std","pair")
141 call AddNamespaceDeclTo("std","priority_queue")
142 call AddNamespaceDeclTo("std","set")
143 call AddNamespaceDeclTo("std","queue")
144 call AddNamespaceDeclTo("std","stack")
145 call AddNamespaceDeclTo("std","string")
146 call AddNamespaceDeclTo("std","vector")
150 function EscapeHexToChar()
151 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
153 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
154 execute '%s/^\(.*\)$/"\1"/'
159 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
161 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
163 au Filetype text set textwidth=80
164 "According to thunderbirds settings
165 au Filetype mail set textwidth=72
167 "a and w reformat the paragraph automatically and a new paragraph
168 "is indicated by lines not ending with white-space
170 au Filetype mail,text set fo+=n spell
175 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
177 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
179 "au Filetype php set fo=tcqn
181 au Filetype php set spell
184 au Filetype php set textwidth=80
185 "au Filetype php set cindent
190 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
192 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
194 au BufRead,BufNewFile *.cls set filetype=tex
195 au Filetype tex set textwidth=80
198 function TexTransUmlaute()
199 execute ':%s/ü/\\\"u/ge'
200 execute ':%s/Ü/\\\"U/&'
201 execute ':%s/ö/\\\"o/&'
202 execute ':%s/Ö/\\\"O/&'
203 execute ':%s/ä/\\\"a/&'
204 execute ':%s/Ä/\\\"A/&'
205 execute ':%s/ß/\\\"s/&'
206 execute ':%s/²/\^2/&'
210 function FindWordRepeatings()
211 execute '/\(\<\S\+\>\)\s\+\1\>'
212 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
217 let g:tex_flavor = "latex"
218 let g:LatexBox_viewer="okular"
219 let g:LatexBox_latexmk_options="-pvc"
221 au Filetype tex set smartindent
223 au Filetype tex set tabstop=4
224 au Filetype tex set shiftwidth=4
226 au Filetype tex map! ,b \begin{}<Esc>i
227 au Filetype tex map! ,e <esc>:call TexClosePrev(0)<cr>a<cr>
228 au Filetype tex map! ,i \begin{itemize}<Return>\end{itemize}<ESC>O\item
229 au Filetype tex map! ,f \begin{frame}<Return>\end{frame}<ESC>O\frametitle{
230 au Filetype tex map! ,p \begin{figure}<Return>\end{figure}<ESC>O\centering<Return>\includegraphics{
235 au Filetype tex set spell
240 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
242 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
244 au Filetype python map <F5> :!python % <CR>
247 " vimrc file for following the coding standards specified in PEP 7 & 8.
249 " Number of spaces that a pre-existing tab is equal to.
250 " For the amount of space used for a new tab use shiftwidth.
251 au Filetype python set tabstop=4
252 au Filetype python set shiftwidth=4
253 au Filetype python set expandtab
255 " Wrap text after a certain number of characters
256 au BufRead,BufNewFile *.py,*.pyw set textwidth=79
261 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
263 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
265 "Opens the current file in ipe
266 au Filetype xml map <M-o> :call OpenIn("ipe") <CR>
269 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
271 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
274 au BufRead,BufNewFile *.plt set filetype=gnuplot
275 au BufRead,BufNewFile *.plot set filetype=gnuplot
276 au BufRead,BufNewFile *.gnuplot set filetype=gnuplot
278 "Opens the current file in ipe
279 au Filetype gnuplot map <M-o> :call OpenIn("gnuplot -persist") <CR>
283 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
285 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
287 let g:EnhCommentifyUseAltKeys = 'Yes'
291 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
293 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
295 "function InsertTabWrapper()
296 " let col = col('.') - 1
297 " if !col || getline('.')[col - 1] !~ '\k'
304 " Remap the tab key to select action with InsertTabWrapper
305 "inoremap <C-space> <c-r>=InsertTabWrapper()<cr>
307 let g:SuperTabMappingForward = "<C-space>"
308 let g:SuperTabDefaultCompletionType = 'context'
309 "let g:SuperTabDefaultCompletionType = '<c-x><c-u>'
312 source ~/.vimrc-local