diff options
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 622 |
1 files changed, 622 insertions, 0 deletions
@@ -0,0 +1,622 @@ | |||
1 | call pathogen#infect() | ||
2 | " Pathogen | ||
3 | |||
4 | filetype plugin indent on | ||
5 | set omnifunc=syntaxcomplete#Complete | ||
6 | |||
7 | " conceal displays LaTeX formulars inline with UTF8 | ||
8 | set conceallevel=0 " 1,2 to enable it | ||
9 | set concealcursor= | ||
10 | |||
11 | set linebreak | ||
12 | |||
13 | "set wrap | ||
14 | set nowrap | ||
15 | |||
16 | set noswapfile | ||
17 | "set noundofile | ||
18 | "set nobackup | ||
19 | "set nowritebackup | ||
20 | set backupdir=~/.vim/temp | ||
21 | set directory=~/.vim/temp | ||
22 | set undodir=~/.vim/temp | ||
23 | |||
24 | " [code completion] | ||
25 | set completeopt=longest,menuone | ||
26 | |||
27 | " [spell checker] | ||
28 | "set spell " enable spell checking | ||
29 | set spelllang=en,de | ||
30 | |||
31 | set guifont=DejaVu\ Sans\ Mono\ bold\ 11 | ||
32 | "set guifont=Liberation\ Mono\ for\ Powerline\ 11 | ||
33 | |||
34 | |||
35 | |||
36 | " [Kopieren und Einfuegen] | ||
37 | " verwendet das x-window-clipboard <3 | ||
38 | set clipboard=unnamedplus | ||
39 | "set clipboard=autoselectplus | ||
40 | |||
41 | |||
42 | " [SUCHEN] | ||
43 | " When 'ignorecase' and 'smartcase' are both on, if a pattern contains an uppercase letter, it is case sensitive, otherwise, it is not. For example, /The would find only "The", while /the would find "the" or "The" etc. | ||
44 | set ignorecase | ||
45 | set smartcase | ||
46 | |||
47 | " [VIEW] | ||
48 | syntax on | ||
49 | |||
50 | |||
51 | " machen, dass der befehl wie z.B. " a p fuer register a | ||
52 | set showcmd | ||
53 | set number | ||
54 | |||
55 | set guioptions+=m "show menu bar | ||
56 | set guioptions-=T "remove toolbar | ||
57 | set guioptions+=r "show right-hand scroll bar | ||
58 | set guioptions-=c "use console dialogs instead of popups | ||
59 | set guioptions+=a "autoselect: copy&paste using middleclick | ||
60 | set guioptions+=e "add tab pages | ||
61 | set guioptions+=p "use gui pointer callback for x11 | ||
62 | |||
63 | |||
64 | " ohne den naechsten eintrag verschwindet die powerline manchmal... | ||
65 | set laststatus=2 | ||
66 | |||
67 | " set width for indentation | ||
68 | "set tabstop=2 | ||
69 | "set softtabstop=2 | ||
70 | "set shiftwidth=2 | ||
71 | " replace tabstop by space | ||
72 | "set expandtab | ||
73 | |||
74 | " same in short... | ||
75 | set ts=2 sts=2 sw=2 expandtab | ||
76 | |||
77 | |||
78 | let $PAGER='' | ||
79 | |||
80 | "set <S-Up>=^[[1;2A <S-Down>=^[[1;2B <S-Right>=^[[1;2C <S-Left>=^[[1;2D | ||
81 | "set <F13>=^[[24~ | ||
82 | "map <F13> <S-Down> | ||
83 | "nnoremap <F13> :test | ||
84 | "set <F13>=^[9;0011 | ||
85 | " map <F13> <xF1> | ||
86 | |||
87 | " q: ist der befehlseditor, damit kann man befehle kopieren in den textblock" | ||
88 | " q/ ist die history fuer die letzten suchen | ||
89 | " | ||
90 | " au=auto command, vimenter=event, *=filetype, NERDTree=command | ||
91 | " au vimenter * NERDTree | ||
92 | |||
93 | "nnoremap <Tab> :tabnext | ||
94 | "nnoremap <S-Tab> :tabpreviews | ||
95 | |||
96 | "nnoremap <C-Tab> :bnext<CR> | ||
97 | "nnoremap <C-S-Tab> :bprevious<CR> | ||
98 | |||
99 | "nnoremap <C-Tab> <C-PageDown> | ||
100 | "nnoremap <C-S-Tab> <C-PageUp> | ||
101 | " | ||
102 | nnoremap <C-Tab> :tabnext<CR> | ||
103 | nnoremap <C-S-Tab> :tabprevious<CR> | ||
104 | " do not display full path as tabname | ||
105 | set guitablabel=%t | ||
106 | |||
107 | "nnoremap <C-Tab> :bnext<CR> | ||
108 | "nnoremap <C-S-Tab> :bprevious<CR> | ||
109 | |||
110 | "nnoremap <C-Space> :call s:LaunchCompletion() | ||
111 | "inoremap <C-space> <C-x><C-o><C-p> | ||
112 | nnoremap <C-space> <C-n><C-n><C-p> | ||
113 | "inoremap <C-Space> <C-x><C-o> | ||
114 | inoremap <C-Space> <C-n> | ||
115 | "inoremap <C-@> <C-Space> | ||
116 | " open omni completion menu closing previous if open and opening new menu without changing the text | ||
117 | " | ||
118 | " simulate CTRL+C | ||
119 | vnoremap <C-c> y | ||
120 | "vnoremap <C-x> d | ||
121 | "noremap <C-v> gP " interfers with VISUAL BLOCK mode | ||
122 | |||
123 | " activate visual mode in normal mode | ||
124 | "map <S-Up> V | ||
125 | ":map <S-Down> V | ||
126 | " these are mapped in visual mode | ||
127 | "map <S-Up> k | ||
128 | "map <S-Down> j | ||
129 | " increase/decrease indent in visual mode by tab and shift-tab | ||
130 | vmap <Tab> >gv | ||
131 | vmap <S-Tab> <gv | ||
132 | |||
133 | " make arrow keys work in visual mode | ||
134 | vmap <Esc>OA k | ||
135 | vmap <Esc>OB j | ||
136 | vmap <Esc>OC l | ||
137 | vmap <Esc>OD h | ||
138 | " map shift-right to visually select and so on | ||
139 | nnoremap <C-Right> El | ||
140 | nnoremap <S-Right> vl | ||
141 | nnoremap <S-Left> vj | ||
142 | nnoremap <S-Up> vk | ||
143 | nnoremap <S-Down> vj | ||
144 | |||
145 | " quickfix list (lists errors and warnings) | ||
146 | " nnoremap <F5> :cw<CR> | ||
147 | nnoremap <F5> :call ToggleQuickfixList()<CR> | ||
148 | |||
149 | |||
150 | "nnoremap <Tab> :MBEbf<CR> | ||
151 | "nnoremap <S-Tab> :MBEbb<CR> | ||
152 | nnoremap <Tab> <C-w>w | ||
153 | nnoremap <S-Tab> <C-w>W | ||
154 | |||
155 | |||
156 | " nnoremap <C-w> :q<CR> | ||
157 | noremap! <C-s> <ESC>:w<CR> | ||
158 | |||
159 | "nnoremap <C-]> :PREVCOLOR<CR> | ||
160 | nnoremap <C-K> :NEXTCOLOR<CR> | ||
161 | |||
162 | |||
163 | nnoremap <Home> ^ | ||
164 | vmap <Home> ^ | ||
165 | |||
166 | nnoremap <End> $ | ||
167 | vmap <End> $ | ||
168 | |||
169 | nnoremap <Leader> \ | ||
170 | |||
171 | " nnoremap <C-o> :NERDTreeToggle<CR> | ||
172 | nnoremap <C-o> :browse e<CR> | ||
173 | let NERDTreeShowHidden=1 | ||
174 | let NERDTreeQuiToNopen=1 | ||
175 | let NERDChristmasTree=1 | ||
176 | let NERDTreeMinimalUI=1 | ||
177 | let NERDTreeWinSize = 40 | ||
178 | let NERDTreeMapToggleHidden='\h' | ||
179 | |||
180 | " -------------------------------------------------------------------- | ||
181 | let g:airline_left_sep = '▶' | ||
182 | let g:airline_right_sep = '◀' | ||
183 | "let g:airline_theme = 'powerlineish' | ||
184 | "let g:airline_theme = 'tomorrow' | ||
185 | let g:airline_theme = 'light' | ||
186 | let g:airline_powerline_fonts = 1 | ||
187 | if !exists('g:airline_symbols') | ||
188 | let g:airline_symbols = {} | ||
189 | endif | ||
190 | let g:airline_symbols.space = "\ua0" | ||
191 | |||
192 | |||
193 | let g:miniBufExplAutoStart = 1 | ||
194 | "let g:miniBufExplVSplit = 20 " column width in chars | ||
195 | "let g:miniBufExplBRSplit = 1 " Put new window below | ||
196 | let g:miniBufExplShowBufNumbers = 0 | ||
197 | let g:miniBufExplUseSingleClick = 1 | ||
198 | let g:miniBufExplCycleArround = 1 | ||
199 | let g:miniBufExplMapWindowNavVim = 1 | ||
200 | let g:miniBufExplMapWindowNavArrows = 1 | ||
201 | let g:miniBufExplMapCTabSwitchBufs = 1 | ||
202 | let g:miniBufExplModSelTarget = 1 | ||
203 | " MiniBufExpl Colors | ||
204 | hi MBENormal guifg=fg guibg=bg | ||
205 | hi MBEChanged guifg=red guibg=bg | ||
206 | hi MBEVisibleNormal guifg=bg guibg=fg | ||
207 | hi MBEVisibleChanged guifg=bg guibg=FG | ||
208 | hi MBEVisibleActiveNormal guifg=bg guibg=fg | ||
209 | hi MBEVisibleActiveChanged guifg=bg guibg=fg | ||
210 | |||
211 | |||
212 | if v:version >= 700 | ||
213 | au BufLeave * let b:winview = winsaveview() | ||
214 | au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif | ||
215 | endif | ||
216 | |||
217 | " function! PlaySound() | ||
218 | " silent! exec '!play ~/.vim/support/tape.aiff &' | ||
219 | " endfunction | ||
220 | "autocmd CursorMovedI * call PlaySound() | ||
221 | |||
222 | |||
223 | set nocompatible | ||
224 | set modeline | ||
225 | set modelines=3 | ||
226 | " vim: syntax=vim | ||
227 | " | ||
228 | " | ||
229 | " | ||
230 | " clang_autocomplete options | ||
231 | |||
232 | |||
233 | let g:clang_use_library=1 | ||
234 | "let g:clang_library_path='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib' | ||
235 | let g:clang_auto_select=0 | ||
236 | let g:clang_complete_auto=1 " automatically complete after ->, ., :: | ||
237 | let g:clang_periodic_quickfix=1 | ||
238 | let g:clang_close_preview=1 " If equal to 1, the preview window will be close automatically after a completion | ||
239 | "let g:clang_snippets=1 | ||
240 | "let g:clang_conceal_snippets=1 | ||
241 | "let g:clang_snippets_engine='clang_complete' | ||
242 | "let g:clang_complete_macros=1 | ||
243 | "let g:clang_complete_patterns=1 | ||
244 | "let g:clang_close_preview=1 | ||
245 | |||
246 | " Show clang errors in the quickfix window | ||
247 | "let g:clang_complete_copen = 1 | ||
248 | " | ||
249 | " | ||
250 | let g:clang_user_options='|| exit 0' | ||
251 | let g:clang_sort_algo="alpha" | ||
252 | |||
253 | |||
254 | |||
255 | " muss am ende stehen, macht das INSERT nicht angezeigt wird. macht ja airline | ||
256 | " auch schon. | ||
257 | set noshowmode " hide --INSERT-- from command line (as its already shown in airline) | ||
258 | set cursorline " highlight currently selected line | ||
259 | |||
260 | set wildmenu " displays command options in status line / airline when pressing TAB | ||
261 | set wildmode=longest:full,full | ||
262 | |||
263 | set scrolloff=2 " always keep at least two lines visible (when seeking) | ||
264 | |||
265 | "noremap help vert help | ||
266 | cabbrev help tab help | ||
267 | "autocmd FileType help,* wincmd L | ||
268 | |||
269 | "autocmd BufNew * if winnr('$') == 1 | tab sball | endif | ||
270 | "autocmd BufReadPost * tab ball | ||
271 | map ,e :e <C-R>=expand("%:p:h") . "/" <CR> | ||
272 | |||
273 | " If wanted, auto commenting can be disabled for all files with: | ||
274 | autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | ||
275 | |||
276 | colorscheme maxvb6 | ||
277 | if has("gui_running") | ||
278 | "colorscheme Tomorrow-Night-Blue | ||
279 | "colorscheme bclear | ||
280 | else | ||
281 | " use 256 colors in Console mode if we think the terminal supports it | ||
282 | if &term =~? 'mlterm\|xterm\|screen' | ||
283 | set t_Co=256 | ||
284 | endif | ||
285 | "set t_Co=256 | ||
286 | "set t_AB=^[[48;5;%dm | ||
287 | "set t_AF=^[[38;5;%dm | ||
288 | "set term=ansi | ||
289 | "colorscheme ibmedit | ||
290 | "colorscheme h80 | ||
291 | "colorscheme greyhouse | ||
292 | "colorscheme tango-morning | ||
293 | "colorscheme jhlight | ||
294 | "colorscheme newspaper | ||
295 | "colorscheme relaxedgreen | ||
296 | let g:airline_theme = 'hybrid' | ||
297 | "highlight LineNr ctermfg=grey ctermbg=black | ||
298 | endif | ||
299 | |||
300 | |||
301 | " ex command for toggling hex mode - define mapping if desired | ||
302 | command -bar Hexmode call ToggleHex() | ||
303 | |||
304 | " helper function to toggle hex mode | ||
305 | function ToggleHex() | ||
306 | " hex mode should be considered a read-only operation | ||
307 | " save values for modified and read-only for restoration later, | ||
308 | " and clear the read-only flag for now | ||
309 | let l:modified=&mod | ||
310 | let l:oldreadonly=&readonly | ||
311 | let &readonly=0 | ||
312 | let l:oldmodifiable=&modifiable | ||
313 | let &modifiable=1 | ||
314 | if !exists("b:editHex") || !b:editHex | ||
315 | " save old options | ||
316 | let b:oldft=&ft | ||
317 | let b:oldbin=&bin | ||
318 | " set new options | ||
319 | setlocal binary " make sure it overrides any textwidth, etc. | ||
320 | let &ft="xxd" | ||
321 | " set status | ||
322 | let b:editHex=1 | ||
323 | " switch to hex editor | ||
324 | %!xxd | ||
325 | else | ||
326 | " restore old options | ||
327 | let &ft=b:oldft | ||
328 | if !b:oldbin | ||
329 | setlocal nobinary | ||
330 | endif | ||
331 | " set status | ||
332 | let b:editHex=0 | ||
333 | " return to normal editing | ||
334 | %!xxd -r | ||
335 | endif | ||
336 | " restore values for modified and read only state | ||
337 | let &mod=l:modified | ||
338 | let &readonly=l:oldreadonly | ||
339 | let &modifiable=l:oldmodifiable | ||
340 | endfunction | ||
341 | |||
342 | |||
343 | " Show syntax highlighting groups for word under cursor | ||
344 | map <C-S-P> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' | ||
345 | \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" | ||
346 | \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> | ||
347 | |||
348 | |||
349 | " Append modeline after last line in buffer using \ml | ||
350 | " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX | ||
351 | " files. | ||
352 | function! AppendModeline() | ||
353 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | ||
354 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | ||
355 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | ||
356 | call append(line("$"), l:modeline) | ||
357 | endfunction | ||
358 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | ||
359 | |||
360 | |||
361 | " make vimdiff ignore white spaces | ||
362 | set diffopt+=iwhite | ||
363 | set diffopt+=filler | ||
364 | set diffexpr="" | ||
365 | set nocompatible | ||
366 | |||
367 | |||
368 | set diffopt+=iwhite | ||
369 | |||
370 | |||
371 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 | ||
372 | highlight Cursor guifg=black guibg=lightgreen | ||
373 | |||
374 | |||
375 | |||
376 | set virtualedit=onemore | ||
377 | " damit das highlight der klammern nicht genauso aussieht wie der cursor | ||
378 | hi MatchParen cterm=none ctermbg=yellow ctermfg=yellow | ||
379 | |||
380 | |||
381 | " An example for a vimrc file. | ||
382 | " | ||
383 | " Maintainer: Bram Moolenaar <Bram@vim.org> | ||
384 | " Last change: 2014 Nov 05 | ||
385 | " | ||
386 | " To use it, copy it to | ||
387 | " for Unix and OS/2: ~/.vimrc | ||
388 | " for Amiga: s:.vimrc | ||
389 | " for MS-DOS and Win32: $VIM\_vimrc | ||
390 | " for OpenVMS: sys$login:.vimrc | ||
391 | |||
392 | " When started as "evim", evim.vim will already have done these settings. | ||
393 | if v:progname =~? "evim" | ||
394 | finish | ||
395 | endif | ||
396 | |||
397 | " Use Vim settings, rather than Vi settings (much better!). | ||
398 | " This must be first, because it changes other options as a side effect. | ||
399 | set nocompatible | ||
400 | |||
401 | " allow backspacing over everything in insert mode | ||
402 | set backspace=indent,eol,start | ||
403 | |||
404 | if has("vms") | ||
405 | set nobackup " do not keep a backup file, use versions instead | ||
406 | else | ||
407 | set backup " keep a backup file (restore to previous version) | ||
408 | set undofile " keep an undo file (undo changes after closing) | ||
409 | endif | ||
410 | set history=50 " keep 50 lines of command line history | ||
411 | set ruler " show the cursor position all the time | ||
412 | set showcmd " display incomplete commands | ||
413 | set incsearch " do incremental searching | ||
414 | |||
415 | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | ||
416 | " let &guioptions = substitute(&guioptions, "t", "", "g") | ||
417 | |||
418 | " Don't use Ex mode, use Q for formatting | ||
419 | map Q gq | ||
420 | |||
421 | " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | ||
422 | " so that you can undo CTRL-U after inserting a line break. | ||
423 | inoremap <C-U> <C-G>u<C-U> | ||
424 | |||
425 | " In many terminal emulators the mouse works just fine, thus enable it. | ||
426 | if has('mouse') | ||
427 | set mouse=a | ||
428 | endif | ||
429 | |||
430 | " Switch syntax highlighting on, when the terminal has colors | ||
431 | " Also switch on highlighting the last used search pattern. | ||
432 | if &t_Co > 2 || has("gui_running") | ||
433 | syntax on | ||
434 | set hlsearch | ||
435 | endif | ||
436 | |||
437 | " Only do this part when compiled with support for autocommands. | ||
438 | if has("autocmd") | ||
439 | |||
440 | " Enable file type detection. | ||
441 | " Use the default filetype settings, so that mail gets 'tw' set to 72, | ||
442 | " 'cindent' is on in C files, etc. | ||
443 | " Also load indent files, to automatically do language-dependent indenting. | ||
444 | filetype plugin indent on | ||
445 | |||
446 | " Put these in an autocmd group, so that we can delete them easily. | ||
447 | augroup vimrcEx | ||
448 | au! | ||
449 | |||
450 | " For all text files set 'textwidth' to 78 characters. | ||
451 | autocmd FileType text setlocal textwidth=78 | ||
452 | |||
453 | " When editing a file, always jump to the last known cursor position. | ||
454 | " Don't do it when the position is invalid or when inside an event handler | ||
455 | " (happens when dropping a file on gvim). | ||
456 | " Also don't do it when the mark is in the first line, that is the default | ||
457 | " position when opening a file. | ||
458 | autocmd BufReadPost * | ||
459 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
460 | \ exe "normal! g`\"" | | ||
461 | \ endif | ||
462 | |||
463 | augroup END | ||
464 | |||
465 | else | ||
466 | |||
467 | set autoindent " always set autoindenting on | ||
468 | |||
469 | endif " has("autocmd") | ||
470 | |||
471 | " Convenient command to see the difference between the current buffer and the | ||
472 | " file it was loaded from, thus the changes you made. | ||
473 | " Only define it when not defined already. | ||
474 | if !exists(":DiffOrig") | ||
475 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | ||
476 | \ | wincmd p | diffthis | ||
477 | endif | ||
478 | |||
479 | if has('langmap') && exists('+langnoremap') | ||
480 | " Prevent that the langmap option applies to characters that result from a | ||
481 | " mapping. If unset (default), this may break plugins (but it's backward | ||
482 | " compatible). | ||
483 | set langnoremap | ||
484 | endif | ||
485 | |||
486 | |||
487 | |||
488 | |||
489 | |||
490 | |||
491 | |||
492 | |||
493 | |||
494 | |||
495 | |||
496 | |||
497 | |||
498 | |||
499 | |||
500 | |||
501 | |||
502 | |||
503 | |||
504 | |||
505 | |||
506 | |||
507 | |||
508 | |||
509 | |||
510 | |||
511 | |||
512 | |||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | " An example for a vimrc file. | ||
520 | " | ||
521 | " Maintainer: Bram Moolenaar <Bram@vim.org> | ||
522 | " Last change: 2014 Nov 05 | ||
523 | " | ||
524 | " To use it, copy it to | ||
525 | " for Unix and OS/2: ~/.vimrc | ||
526 | " for Amiga: s:.vimrc | ||
527 | " for MS-DOS and Win32: $VIM\_vimrc | ||
528 | " for OpenVMS: sys$login:.vimrc | ||
529 | |||
530 | " When started as "evim", evim.vim will already have done these settings. | ||
531 | if v:progname =~? "evim" | ||
532 | finish | ||
533 | endif | ||
534 | |||
535 | " Use Vim settings, rather than Vi settings (much better!). | ||
536 | " This must be first, because it changes other options as a side effect. | ||
537 | set nocompatible | ||
538 | |||
539 | " allow backspacing over everything in insert mode | ||
540 | set backspace=indent,eol,start | ||
541 | |||
542 | if has("vms") | ||
543 | set nobackup " do not keep a backup file, use versions instead | ||
544 | else | ||
545 | set backup " keep a backup file (restore to previous version) | ||
546 | set undofile " keep an undo file (undo changes after closing) | ||
547 | endif | ||
548 | set history=50 " keep 50 lines of command line history | ||
549 | set ruler " show the cursor position all the time | ||
550 | set showcmd " display incomplete commands | ||
551 | set incsearch " do incremental searching | ||
552 | |||
553 | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | ||
554 | " let &guioptions = substitute(&guioptions, "t", "", "g") | ||
555 | |||
556 | " Don't use Ex mode, use Q for formatting | ||
557 | map Q gq | ||
558 | |||
559 | " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | ||
560 | " so that you can undo CTRL-U after inserting a line break. | ||
561 | inoremap <C-U> <C-G>u<C-U> | ||
562 | |||
563 | " In many terminal emulators the mouse works just fine, thus enable it. | ||
564 | if has('mouse') | ||
565 | set mouse=a | ||
566 | endif | ||
567 | |||
568 | " Switch syntax highlighting on, when the terminal has colors | ||
569 | " Also switch on highlighting the last used search pattern. | ||
570 | if &t_Co > 2 || has("gui_running") | ||
571 | syntax on | ||
572 | set hlsearch | ||
573 | endif | ||
574 | |||
575 | " Only do this part when compiled with support for autocommands. | ||
576 | if has("autocmd") | ||
577 | |||
578 | " Enable file type detection. | ||
579 | " Use the default filetype settings, so that mail gets 'tw' set to 72, | ||
580 | " 'cindent' is on in C files, etc. | ||
581 | " Also load indent files, to automatically do language-dependent indenting. | ||
582 | filetype plugin indent on | ||
583 | |||
584 | " Put these in an autocmd group, so that we can delete them easily. | ||
585 | augroup vimrcEx | ||
586 | au! | ||
587 | |||
588 | " For all text files set 'textwidth' to 78 characters. | ||
589 | autocmd FileType text setlocal textwidth=78 | ||
590 | |||
591 | " When editing a file, always jump to the last known cursor position. | ||
592 | " Don't do it when the position is invalid or when inside an event handler | ||
593 | " (happens when dropping a file on gvim). | ||
594 | " Also don't do it when the mark is in the first line, that is the default | ||
595 | " position when opening a file. | ||
596 | autocmd BufReadPost * | ||
597 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
598 | \ exe "normal! g`\"" | | ||
599 | \ endif | ||
600 | |||
601 | augroup END | ||
602 | |||
603 | else | ||
604 | |||
605 | set autoindent " always set autoindenting on | ||
606 | |||
607 | endif " has("autocmd") | ||
608 | |||
609 | " Convenient command to see the difference between the current buffer and the | ||
610 | " file it was loaded from, thus the changes you made. | ||
611 | " Only define it when not defined already. | ||
612 | if !exists(":DiffOrig") | ||
613 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | ||
614 | \ | wincmd p | diffthis | ||
615 | endif | ||
616 | |||
617 | if has('langmap') && exists('+langnoremap') | ||
618 | " Prevent that the langmap option applies to characters that result from a | ||
619 | " mapping. If unset (default), this may break plugins (but it's backward | ||
620 | " compatible). | ||
621 | set langnoremap | ||
622 | endif | ||