aboutsummaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authorMax Christian Pohle2015-09-06 05:08:14 +0200
committerMax Christian Pohle2015-09-06 05:08:14 +0200
commit64436bf70832028052dd278760761230d7d0bc77 (patch)
tree29c90b25369169b85417009626da1713edcc9a30 /vimrc
parent4a3e984105a960556bd727662c349170a61eb4fb (diff)
downloadvim-karlmarks-64436bf70832028052dd278760761230d7d0bc77.tar.bz2
vim-karlmarks-64436bf70832028052dd278760761230d7d0bc77.zip
switched to vundle, cleaned and commented the vimrc
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc767
1 files changed, 166 insertions, 601 deletions
diff --git a/vimrc b/vimrc
index ea96df4..b14ac67 100644
--- a/vimrc
+++ b/vimrc
@@ -1,622 +1,187 @@
1call pathogen#infect() 1"================================================================================
2" Pathogen 2" Vundle: plugin manager...
3set nocompatible| " do not try to be vi, be vim
4filetype off| " Vundle needs this
5set rtp+=~/.vim/plugins/Vundle.vim
6call vundle#begin('~/.vim/plugins/')
7
8" Plugin dependant configurations...
9Plugin 'VundleVim/Vundle.vim'
10Plugin 'cscope_plus.vim' " run cscope -R -b in project folder then use
11Plugin 'autoload_cscope.vim' " CTRL+\ s searches word under cursor, CTRL+T back
12Plugin 'tpope/vim-fugitive' " the most complete GIT integration plugin
13Plugin 'taglist-plus' " quick code navigator
14let Tlist_Compact_Format = 1
15let Tlist_GainFocus_On_ToggleOpen = 1
16let Tlist_Close_On_Select = 1
17Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion
18let g:ycm_global_ycm_extra_conf = '/home/max/.vim/_ycm_extra_conf.py' | " fallback, right one should be in the applications path
19let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?'
20let g:ycm_key_select_completion = '<Tab>' | " key completion key
21let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar
22let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar
23let g:ycm_collect_identifiers_from_tags_files = 1 | "
24let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode
25inoremap <buffer> ( <C-X><C-o>(
26"if !exists("g:ycm_semantic_triggers")
27" let g:ycm_semantic_triggers = {}
28"endif
29"let g:ycm_semantic_triggers['c'] = ['('] | "
30
31
32call vundle#end() | " required
33filetype plugin indent on | " required
34
35"================================================================================
36" custom config
37
38set noswapfile | " noundofile, nobackup, nowritebackup
39set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory
40set directory=~/.vim/temp | "
41set undodir=~/.vim/temp | "
42
43set ts=2 sts=2 sw=2 expandtab | " indentation which i like
44set autoindent | " always set autoindenting on
45set copyindent | " copy the previous indentation on autoindenting
46set scrolloff=2 | " always keeps at least two lines visible (when seeking)
47
48set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
49set number | " toggle line numbers
50set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap
51set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap
52set diffopt+=iwhite,filler | " lets diff ignore white spaces
53set spell| set spelllang=en,de| " enable spell checker
54set showcmd | " displays status line messages while selecting (matrix size)
55set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews
56set linebreak | " do not wrap in the middle of words
57set showbreak=› | " symbol used in the beginning of a wrapped line
58set listchars=tab:▸\ ,eol:¬ | " symbols used when using :set list (which displays non-printable chars)
59
60
61set virtualedit=onemore " one character beyond the line length should be navigatable (options: all,insert,block,onemore)
62nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line:w
63
64" search...
65set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive
66set incsearch " do incremental searching
67set showmatch|set matchtime=4 " blinks matching braces
68
69set novisualbell " don't beep
70set noerrorbells " don't beep
71set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 " how the caret looks like
3 72
4filetype plugin indent on 73if has("autocmd")
5set omnifunc=syntaxcomplete#Complete 74 set modeline " set variables specific to a file, like indentation by adding a comment
6 75 set modelines=3 " how many lines in the beginning and end of the file can be mode lines?
7" conceal displays LaTeX formulars inline with UTF8
8set conceallevel=0 " 1,2 to enable it
9set concealcursor=
10
11set linebreak
12
13"set wrap
14set nowrap
15
16set noswapfile
17"set noundofile
18"set nobackup
19"set nowritebackup
20set backupdir=~/.vim/temp
21set directory=~/.vim/temp
22set undodir=~/.vim/temp
23
24" [code completion]
25set completeopt=longest,menuone
26
27" [spell checker]
28"set spell " enable spell checking
29set spelllang=en,de
30
31set 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
38set 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.
44set ignorecase
45set smartcase
46
47" [VIEW]
48syntax on
49
50
51" machen, dass der befehl wie z.B. " a p fuer register a
52set showcmd
53set number
54
55set guioptions+=m "show menu bar
56set guioptions-=T "remove toolbar
57set guioptions+=r "show right-hand scroll bar
58set guioptions-=c "use console dialogs instead of popups
59set guioptions+=a "autoselect: copy&paste using middleclick
60set guioptions+=e "add tab pages
61set guioptions+=p "use gui pointer callback for x11
62
63
64" ohne den naechsten eintrag verschwindet die powerline manchmal...
65set 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...
75set ts=2 sts=2 sw=2 expandtab
76
77
78let $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"
102nnoremap <C-Tab> :tabnext<CR>
103nnoremap <C-S-Tab> :tabprevious<CR>
104" do not display full path as tabname
105set 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>
112nnoremap <C-space> <C-n><C-n><C-p>
113"inoremap <C-Space> <C-x><C-o>
114inoremap <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
119vnoremap <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
130vmap <Tab> >gv
131vmap <S-Tab> <gv
132
133" make arrow keys work in visual mode
134vmap <Esc>OA k
135vmap <Esc>OB j
136vmap <Esc>OC l
137vmap <Esc>OD h
138" map shift-right to visually select and so on
139nnoremap <C-Right> El
140nnoremap <S-Right> vl
141nnoremap <S-Left> vj
142nnoremap <S-Up> vk
143nnoremap <S-Down> vj
144
145" quickfix list (lists errors and warnings)
146" nnoremap <F5> :cw<CR>
147nnoremap <F5> :call ToggleQuickfixList()<CR>
148
149
150"nnoremap <Tab> :MBEbf<CR>
151"nnoremap <S-Tab> :MBEbb<CR>
152nnoremap <Tab> <C-w>w
153nnoremap <S-Tab> <C-w>W
154
155
156" nnoremap <C-w> :q<CR>
157noremap! <C-s> <ESC>:w<CR>
158
159"nnoremap <C-]> :PREVCOLOR<CR>
160nnoremap <C-K> :NEXTCOLOR<CR>
161
162
163nnoremap <Home> ^
164vmap <Home> ^
165 76
166nnoremap <End> $ 77
167vmap <End> $ 78 augroup resCur | " make cursor appear in its previous position when reopening a file...
79 "autocmd!
80 autocmd BufReadPost * call setpos(".", getpos("'\""))
81 augroup END
168 82
169nnoremap <Leader> \ 83 augroup PreviewOnBottom | " will open new windows below the current (only in insert mode, so that the preview window is drawn below)
84 autocmd InsertEnter * set splitbelow
85 autocmd InsertLeave * set splitbelow!
86 augroup END
170 87
171" nnoremap <C-o> :NERDTreeToggle<CR> 88 augroup OmniFunc | " this will enable omnicomplete just in case this configuration runs somewhere, where YouCompleteMe is not compiled
172nnoremap <C-o> :browse e<CR> 89 if exists("+omnifunc")
173let NERDTreeShowHidden=1 90 autocmd Filetype *
174let NERDTreeQuiToNopen=1 91 \ if &omnifunc == "" |
175let NERDChristmasTree=1 92 \ setlocal omnifunc=syntaxcomplete#Complete |
176let NERDTreeMinimalUI=1 93 \ setlocal completeopt=longest,menuone |
177let NERDTreeWinSize = 40 94 \ endif
178let NERDTreeMapToggleHidden='\h' 95 endif
96 augroup END
179 97
180" -------------------------------------------------------------------- 98 autocmd FileType text setlocal textwidth=78 " text files: set 'textwidth' to 78
181let g:airline_left_sep = '▶' 99 autocmd FileType gitcommit set tw=72 " longer commit messages without auto line wrapping
182let g:airline_right_sep = '◀' 100 autocmd FileType LaTeX let g:tex_flavor = "latex" |set conceallevel=1| set concealcursor=
183"let g:airline_theme = 'powerlineish'
184"let g:airline_theme = 'tomorrow'
185let g:airline_theme = 'light'
186let g:airline_powerline_fonts = 1
187if !exists('g:airline_symbols')
188 let g:airline_symbols = {}
189endif 101endif
190let g:airline_symbols.space = "\ua0"
191
192
193let g:miniBufExplAutoStart = 1
194"let g:miniBufExplVSplit = 20 " column width in chars
195"let g:miniBufExplBRSplit = 1 " Put new window below
196let g:miniBufExplShowBufNumbers = 0
197let g:miniBufExplUseSingleClick = 1
198let 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
204hi MBENormal guifg=fg guibg=bg
205hi MBEChanged guifg=red guibg=bg
206hi MBEVisibleNormal guifg=bg guibg=fg
207hi MBEVisibleChanged guifg=bg guibg=FG
208hi MBEVisibleActiveNormal guifg=bg guibg=fg
209hi MBEVisibleActiveChanged guifg=bg guibg=fg
210 102
211 103"================================================================================
212if v:version >= 700 104" gui stuff and appearance
213 au BufLeave * let b:winview = winsaveview() 105if &t_Co > 2
214 au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif 106 set hlsearch "
107 set cursorline " highlight currently selected line
215endif 108endif
216 109
217" function! PlaySound() 110if has('mouse')
218" silent! exec '!play ~/.vim/support/tape.aiff &' 111 set mouse=a
219" endfunction 112endif
220"autocmd CursorMovedI * call PlaySound()
221
222
223set nocompatible
224set modeline
225set modelines=3
226" vim: syntax=vim
227"
228"
229"
230" clang_autocomplete options
231
232
233let g:clang_use_library=1
234"let g:clang_library_path='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib'
235let g:clang_auto_select=0
236let g:clang_complete_auto=1 " automatically complete after ->, ., ::
237let g:clang_periodic_quickfix=1
238let 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"
250let g:clang_user_options='|| exit 0'
251let 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.
257set noshowmode " hide --INSERT-- from command line (as its already shown in airline)
258set cursorline " highlight currently selected line
259
260set wildmenu " displays command options in status line / airline when pressing TAB
261set wildmode=longest:full,full
262
263set scrolloff=2 " always keep at least two lines visible (when seeking)
264
265"noremap help vert help
266cabbrev help tab help
267"autocmd FileType help,* wincmd L
268
269"autocmd BufNew * if winnr('$') == 1 | tab sball | endif
270"autocmd BufReadPost * tab ball
271map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
272
273" If wanted, auto commenting can be disabled for all files with:
274autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
275 113
276colorscheme maxvb6
277if has("gui_running") 114if has("gui_running")
278 "colorscheme Tomorrow-Night-Blue 115 set guitablabel=%t " do not display full path as tabname
279 "colorscheme bclear 116 set guioptions+=m " menu bar
117 set guioptions+=T " toolbar
118 set guioptions+=r " right-hand scroll bar
119 set guioptions-=c " use console dialogs instead of popups
120 set guioptions+=a " autoselect: copy&paste using middleclick
121 set guioptions+=e " add tab pages
122 set guioptions+=p " use gui pointer callback for x11
123 set toolbariconsize=large " make the icon toolbar as big as possible
280else 124else
281 " use 256 colors in Console mode if we think the terminal supports it
282 if &term =~? 'mlterm\|xterm\|screen' 125 if &term =~? 'mlterm\|xterm\|screen'
283 set t_Co=256 126 set t_Co=256 | " fixes incompatibilities with our color scheme
284 endif 127 endif
285 "set t_Co=256 128 set title | " set the terminal caption
286 "set t_AB=^[[48;5;%dm 129 set titleold="vim ended" | " set terminal title after closing vim
287 "set t_AF=^[[38;5;%dm 130 set titlestring="VIM-CONSOLE" | " set window title
288 "set term=ansi 131 set icon | " sets the terminal icon to vim
289 "colorscheme ibmedit 132 set ttyfast | " modern terminals are all fast in a way
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
298endif 133endif
299 134
300 135colorscheme maxvb6
301" ex command for toggling hex mode - define mapping if desired 136syntax enable
302command -bar Hexmode call ToggleHex() 137
303 138"================================================================================
304" helper function to toggle hex mode 139" plugin hotkeys
305function ToggleHex() 140nnoremap <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L
306 " hex mode should be considered a read-only operation 141
307 " save values for modified and read-only for restoration later, 142" code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
308 " and clear the read-only flag for now 143" reacts on CTRL+P, CTRL+Space
309 let l:modified=&mod 144inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
310 let l:oldreadonly=&readonly 145inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
311 let &readonly=0 146inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
312 let l:oldmodifiable=&modifiable 147inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
313 let &modifiable=1 148inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
314 if !exists("b:editHex") || !b:editHex 149inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
315 " save old options 150
316 let b:oldft=&ft 151" custom commands...
317 let b:oldbin=&bin 152cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user
318 " set new options 153
319 setlocal binary " make sure it overrides any textwidth, etc. 154" custom hotkeys...
320 let &ft="xxd" 155nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs
321 " set status 156nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab
322 let b:editHex=1 157nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines...
323 " switch to hex editor 158map <C-h> <C-w>h|map <C-j> <C-w>j|map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcut
324 %!xxd 159
325 else 160
326 " restore old options 161"================================================================================
327 let &ft=b:oldft 162" deactivated on-demand commands (just in case one needs them one day)
328 if !b:oldbin 163" set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background
329 setlocal nobinary 164" map shift-right to visually select and so on
330 endif 165"nnoremap <C-Right> El
331 " set status 166"nnoremap <S-Right> vl
332 let b:editHex=0 167"nnoremap <S-Left> vj
333 " return to normal editing 168"nnoremap <S-Up> vk
334 %!xxd -r 169"nnoremap <S-Down> vj
335 endif 170" noremap % v% " jump between braces and highlight
336 " restore values for modified and read only state 171"nnoremap <Home> ^
337 let &mod=l:modified 172"vmap <Home> ^
338 let &readonly=l:oldreadonly 173"nnoremap <End> $
339 let &modifiable=l:oldmodifiable 174"vmap <End> $
340endfunction 175"nnoremap <C-Tab> <C-PageDown>
341 176"nnoremap <C-S-Tab> <C-PageUp>
342 177":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
343" Show syntax highlighting groups for word under cursor 178"map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode
344map <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.
352function! 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)
357endfunction
358nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
359
360
361" make vimdiff ignore white spaces
362set diffopt+=iwhite
363set diffopt+=filler
364set diffexpr=""
365set nocompatible
366
367
368set diffopt+=iwhite
369
370
371set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500
372highlight Cursor guifg=black guibg=lightgreen
373
374
375
376set virtualedit=onemore
377" damit das highlight der klammern nicht genauso aussieht wie der cursor
378hi MatchParen cterm=none ctermbg=yellow ctermfg=yellow
379
380
381" An example for a vimrc file.
382" 179"
383" Maintainer: Bram Moolenaar <Bram@vim.org> 180"inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys!
384" Last change: 2014 Nov 05 181" binding ESC can easily break cursor key movement on the console (tricky, because gvim works)
385" 182"
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.
393if v:progname =~? "evim"
394 finish
395endif
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.
399set nocompatible
400
401" allow backspacing over everything in insert mode
402set backspace=indent,eol,start
403
404if has("vms")
405 set nobackup " do not keep a backup file, use versions instead
406else
407 set backup " keep a backup file (restore to previous version)
408 set undofile " keep an undo file (undo changes after closing)
409endif
410set history=50 " keep 50 lines of command line history
411set ruler " show the cursor position all the time
412set showcmd " display incomplete commands
413set 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
419map 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.
423inoremap <C-U> <C-G>u<C-U>
424
425" In many terminal emulators the mouse works just fine, thus enable it.
426if has('mouse')
427 set mouse=a
428endif
429
430" Switch syntax highlighting on, when the terminal has colors
431" Also switch on highlighting the last used search pattern.
432if &t_Co > 2 || has("gui_running")
433 syntax on
434 set hlsearch
435endif
436
437" Only do this part when compiled with support for autocommands.
438if 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
465else
466
467 set autoindent " always set autoindenting on
468
469endif " 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.
474if !exists(":DiffOrig")
475 command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
476 \ | wincmd p | diffthis
477endif
478
479if 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
484endif
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" 183"
521" Maintainer: Bram Moolenaar <Bram@vim.org>
522" Last change: 2014 Nov 05
523" 184"
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.
531if v:progname =~? "evim"
532 finish
533endif
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.
537set nocompatible
538
539" allow backspacing over everything in insert mode
540set backspace=indent,eol,start
541
542if has("vms")
543 set nobackup " do not keep a backup file, use versions instead
544else
545 set backup " keep a backup file (restore to previous version)
546 set undofile " keep an undo file (undo changes after closing)
547endif
548set history=50 " keep 50 lines of command line history
549set ruler " show the cursor position all the time
550set showcmd " display incomplete commands
551set 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
557map Q gq
558 185
559" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, 186"inoremap <C-Space> <C-x><C-o>
560" so that you can undo CTRL-U after inserting a line break. 187"inoremap <C-@> <C-Space>
561inoremap <C-U> <C-G>u<C-U>
562
563" In many terminal emulators the mouse works just fine, thus enable it.
564if has('mouse')
565 set mouse=a
566endif
567
568" Switch syntax highlighting on, when the terminal has colors
569" Also switch on highlighting the last used search pattern.
570if &t_Co > 2 || has("gui_running")
571 syntax on
572 set hlsearch
573endif
574
575" Only do this part when compiled with support for autocommands.
576if 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
603else
604
605 set autoindent " always set autoindenting on
606
607endif " 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.
612if !exists(":DiffOrig")
613 command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
614 \ | wincmd p | diffthis
615endif
616
617if 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
622endif
..