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
11 " Pathogen runtime path manipulation
12 "call pathogen#infect() "Using the infect method breaks ft detection
13 call pathogen#runtime_append_all_bundles()
16 "Activate syntax highlighting
18 "Activate filetype plugins: syntax highlighting, indentation, and more
19 filetype plugin indent on
27 "vim-7 and newer has vimspell (spell checker) built in
29 set spelllang=de_at,en
34 "Set some properties for ctags, grep and the size of the
35 "most-left column for foldings
37 set grepprg=grep\ -nH\ $*
40 "Set incremental search and highlighted search results
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:$
68 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
70 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
72 "let fortran_free_source=1
73 au BufNewFile *.f90 set fortran_free_source=1
74 au BufRead,BufNewFile *.INC set filetype=fortran
75 au Filetype fortran set cindent cst csto=0
80 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
82 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
84 au BufRead,BufNewFile */.irssi/logs/*.log set filetype=irssilog
87 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
88 " Easychair conference system review form
89 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
91 au BufRead,BufNewFile review_form_*.txt set filetype=easychair
92 au Syntax easychair runtime! syntax/easychair.vim
95 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
96 " C, C++, C#, objc, java
97 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
99 au Filetype c,cpp,cs,objc,java map <F4> :cnext <CR>
100 au Filetype c,cpp,cs,objc,java map <S-F4> :cprevious <CR>
101 au Filetype c,cpp,cs,objc,java map <F11> :AS <CR>
102 au Filetype c,cpp,cs,objc,java map <S-F11> :A <CR>
103 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
104 au Filetype c,cpp,cs,objc map <F7> :make <CR>
105 au Filetype java map <F7> :!ant -f ../build.xml <CR>
106 au Filetype c,cpp,cs,obj set makeprg=make
107 au Filetype c,cpp,cs,obj set tabstop=4
108 au Filetype c,cpp,cs,obj set shiftwidth=4
111 "Adds STL prefix 'std::' to 'id'
112 function AddNamespaceDeclTo(ns, id)
113 echo "Add '" . a:ns . "' to " . a:id
114 "Line starts with a:id
115 execute ":%s!^\\(\\s*\\)" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!e"
116 "Line beginning, white space, not # or / (preprocessor or comment)
117 execute ":%s!^\\(\\s*[^#/].*[^:]\\)\\<" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!ge"
121 "Adds STL prefix 'std::' to several identifiers
122 function AddSTLNamespaceDecl()
123 call AddNamespaceDeclTo("std","cin")
124 call AddNamespaceDeclTo("std","cout")
125 call AddNamespaceDeclTo("std","cerr")
127 call AddNamespaceDeclTo("std","swap")
128 call AddNamespaceDeclTo("std","sort")
129 call AddNamespaceDeclTo("std","max")
130 call AddNamespaceDeclTo("std","min")
132 call AddNamespaceDeclTo("std","deque")
133 call AddNamespaceDeclTo("std","endl")
134 call AddNamespaceDeclTo("std","list")
135 call AddNamespaceDeclTo("std","map")
136 call AddNamespaceDeclTo("std","multimap")
137 call AddNamespaceDeclTo("std","ostream")
138 call AddNamespaceDeclTo("std","pair")
139 call AddNamespaceDeclTo("std","priority_queue")
140 call AddNamespaceDeclTo("std","set")
141 call AddNamespaceDeclTo("std","queue")
142 call AddNamespaceDeclTo("std","stack")
143 call AddNamespaceDeclTo("std","string")
144 call AddNamespaceDeclTo("std","vector")
148 function EscapeHexToChar()
149 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
151 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
152 execute '%s/^\(.*\)$/"\1"/'
157 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
159 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
161 au Filetype text set textwidth=80
162 "According to thunderbirds settings
163 au Filetype mail set textwidth=72
165 "a and w reformat the paragraph automatically and a new paragraph
166 "is indicated by lines not ending with white-space
168 au Filetype mail,text set fo+=n spell
173 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
175 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
177 "au Filetype php set fo=tcqn
179 au Filetype php set spell
182 au Filetype php set textwidth=80
183 "au Filetype php set cindent
188 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
190 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
192 au BufRead,BufNewFile *.cls set filetype=tex
193 au Filetype tex set textwidth=80
196 function TexTransUmlaute()
197 execute ':%s/ü/\\\"u/ge'
198 execute ':%s/Ü/\\\"U/&'
199 execute ':%s/ö/\\\"o/&'
200 execute ':%s/Ö/\\\"O/&'
201 execute ':%s/ä/\\\"a/&'
202 execute ':%s/Ä/\\\"A/&'
203 execute ':%s/ß/\\\"s/&'
204 execute ':%s/²/\^2/&'
208 function FindWordRepeatings()
209 execute '/\(\<\S\+\>\)\s\+\1\>'
210 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
215 let g:tex_flavor = "latex"
216 let g:LatexBox_viewer="okular"
217 let g:LatexBox_latexmk_options="-pvc"
219 au Filetype tex set smartindent
221 au Filetype tex set tabstop=4
222 au Filetype tex set shiftwidth=4
224 au Filetype tex map! ,b \begin{}<Esc>i
225 au Filetype tex map! ,e <esc>:call TexClosePrev(0)<cr>a<cr>
226 au Filetype tex map! ,i \begin{itemize}<Return>\end{itemize}<ESC>O\item
227 au Filetype tex map! ,f \begin{frame}<Return>\end{frame}<ESC>O\frametitle{
228 au Filetype tex map! ,p \begin{figure}<Return>\end{figure}<ESC>O\centering<Return>\includegraphics{
233 au Filetype tex set spell
238 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
240 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
242 au Filetype python map <F5> :!python % <CR>
245 " vimrc file for following the coding standards specified in PEP 7 & 8.
247 " Number of spaces that a pre-existing tab is equal to.
248 " For the amount of space used for a new tab use shiftwidth.
249 au Filetype python set tabstop=4
250 au Filetype python set shiftwidth=4
251 au Filetype python set expandtab
253 " Wrap text after a certain number of characters
254 au BufRead,BufNewFile *.py,*.pyw set textwidth=79
259 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
261 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
263 "Opens the current file in ipe
264 au Filetype xml map <M-o> :call OpenIn("ipe") <CR>
267 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
269 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
272 au BufRead,BufNewFile *.plt set filetype=gnuplot
273 au BufRead,BufNewFile *.plot set filetype=gnuplot
274 au BufRead,BufNewFile *.gnuplot set filetype=gnuplot
276 "Opens the current file in ipe
277 au Filetype gnuplot map <M-o> :call OpenIn("gnuplot -persist") <CR>
281 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
283 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
285 let g:EnhCommentifyUseAltKeys = 'Yes'
289 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
291 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
293 "function InsertTabWrapper()
294 " let col = col('.') - 1
295 " if !col || getline('.')[col - 1] !~ '\k'
302 " Remap the tab key to select action with InsertTabWrapper
303 "inoremap <C-space> <c-r>=InsertTabWrapper()<cr>
305 let g:SuperTabMappingForward = "<C-space>"
306 let g:SuperTabDefaultCompletionType = 'context'
307 "let g:SuperTabDefaultCompletionType = '<c-x><c-u>'
310 source ~/.vimrc-local