comparison runtime/vimrc_example.vim @ 34:e170173ecb68 current-release

before ack base protocol.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 26 Nov 2008 15:02:10 +0900
parents 76efa0be13f1
children c16898406ff2
comparison
equal deleted inserted replaced
33:7d0d8b831f5a 34:e170173ecb68
1 " An example for a vimrc file. 1 " An example for a vimrc file.
2 " 2 "
3 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last change: 2006 Nov 16 4 " Last change: 2008 Jul 02
5 " 5 "
6 " To use it, copy it to 6 " To use it, copy it to
7 " for Unix and OS/2: ~/.vimrc 7 " for Unix and OS/2: ~/.vimrc
8 " for Amiga: s:.vimrc 8 " for Amiga: s:.vimrc
9 " for MS-DOS and Win32: $VIM\_vimrc 9 " for MS-DOS and Win32: $VIM\_vimrc
35 " let &guioptions = substitute(&guioptions, "t", "", "g") 35 " let &guioptions = substitute(&guioptions, "t", "", "g")
36 36
37 " Don't use Ex mode, use Q for formatting 37 " Don't use Ex mode, use Q for formatting
38 map Q gq 38 map Q gq
39 39
40 " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
41 " so that you can undo CTRL-U after inserting a line break.
42 inoremap <C-U> <C-G>u<C-U>
43
40 " In many terminal emulators the mouse works just fine, thus enable it. 44 " In many terminal emulators the mouse works just fine, thus enable it.
41 set mouse=a 45 if has('mouse')
46 set mouse=a
47 endif
42 48
43 " Switch syntax highlighting on, when the terminal has colors 49 " Switch syntax highlighting on, when the terminal has colors
44 " Also switch on highlighting the last used search pattern. 50 " Also switch on highlighting the last used search pattern.
45 if &t_Co > 2 || has("gui_running") 51 if &t_Co > 2 || has("gui_running")
46 syntax on 52 syntax on
64 autocmd FileType text setlocal textwidth=78 70 autocmd FileType text setlocal textwidth=78
65 71
66 " When editing a file, always jump to the last known cursor position. 72 " When editing a file, always jump to the last known cursor position.
67 " Don't do it when the position is invalid or when inside an event handler 73 " Don't do it when the position is invalid or when inside an event handler
68 " (happens when dropping a file on gvim). 74 " (happens when dropping a file on gvim).
75 " Also don't do it when the mark is in the first line, that is the default
76 " position when opening a file.
69 autocmd BufReadPost * 77 autocmd BufReadPost *
70 \ if line("'\"") > 0 && line("'\"") <= line("$") | 78 \ if line("'\"") > 1 && line("'\"") <= line("$") |
71 \ exe "normal! g`\"" | 79 \ exe "normal! g`\"" |
72 \ endif 80 \ endif
73 81
74 augroup END 82 augroup END
75 83
79 87
80 endif " has("autocmd") 88 endif " has("autocmd")
81 89
82 " Convenient command to see the difference between the current buffer and the 90 " Convenient command to see the difference between the current buffer and the
83 " file it was loaded from, thus the changes you made. 91 " file it was loaded from, thus the changes you made.
84 command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis 92 " Only define it when not defined already.
85 \ | wincmd p | diffthis 93 if !exists(":DiffOrig")
94 command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
95 \ | wincmd p | diffthis
96 endif