SHOW:
|
|
- or go back to the newest paste.
| 1 | - | " An example for a vimrc file. |
| 1 | + | " An example for a vimrc file. |
| 2 | - | " |
| 2 | + | " |
| 3 | - | " Maintainer: Bram Moolenaar <[email protected]> |
| 3 | + | " Maintainer: Bram Moolenaar <[email protected]> |
| 4 | - | " Last change: 2002 Sep 19 |
| 4 | + | " Last change: 2002 Sep 19 |
| 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 |
| 10 | - | " for OpenVMS: sys$login:.vimrc |
| 10 | + | " for OpenVMS: sys$login:.vimrc |
| 11 | - | |
| 11 | + | |
| 12 | - | " When started as "evim", evim.vim will already have done these settings. |
| 12 | + | " When started as "evim", evim.vim will already have done these settings. |
| 13 | - | if v:progname =~? "evim" |
| 13 | + | if v:progname =~? "evim" |
| 14 | - | finish |
| 14 | + | finish |
| 15 | - | endif |
| 15 | + | endif |
| 16 | - | |
| 16 | + | |
| 17 | - | set t_Co=256 |
| 17 | + | set t_Co=256 |
| 18 | - | " Use Vim settings, rather then Vi settings (much better!). |
| 18 | + | " Use Vim settings, rather then Vi settings (much better!). |
| 19 | - | " This must be first, because it changes other options as a side effect. |
| 19 | + | " This must be first, because it changes other options as a side effect. |
| 20 | - | set nocompatible |
| 20 | + | set nocompatible |
| 21 | - | |
| 21 | + | |
| 22 | - | " allow backspacing over everything in insert mode |
| 22 | + | " allow backspacing over everything in insert mode |
| 23 | - | set backspace=indent,eol,start |
| 23 | + | set backspace=indent,eol,start |
| 24 | - | |
| 24 | + | |
| 25 | - | if has("vms") |
| 25 | + | if has("vms")
|
| 26 | - | set nobackup " do not keep a backup file, use versions instead |
| 26 | + | set nobackup " do not keep a backup file, use versions instead |
| 27 | - | else |
| 27 | + | else |
| 28 | - | set backup " keep a backup file |
| 28 | + | set backup " keep a backup file |
| 29 | - | endif |
| 29 | + | endif |
| 30 | - | set history=1000 " keep 1000 lines of command line history |
| 30 | + | set history=1000 " keep 1000 lines of command line history |
| 31 | - | set ruler " show the cursor position all the time |
| 31 | + | set ruler " show the cursor position all the time |
| 32 | - | set showcmd " display incomplete commands |
| 32 | + | set showcmd " display incomplete commands |
| 33 | - | set incsearch " do incremental searching |
| 33 | + | set incsearch " do incremental searching |
| 34 | - | set hidden |
| 34 | + | set hidden |
| 35 | - | set ignorecase |
| 35 | + | set ignorecase |
| 36 | - | set smartcase |
| 36 | + | set smartcase |
| 37 | - | set scrolloff=3 |
| 37 | + | set scrolloff=3 |
| 38 | - | set title |
| 38 | + | set title |
| 39 | - | nnoremap ' ` " backtick is more useful for marks |
| 39 | + | nnoremap ' ` " backtick is more useful for marks |
| 40 | - | nnoremap ` ' |
| 40 | + | nnoremap ` ' |
| 41 | - | |
| 41 | + | |
| 42 | - | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries |
| 42 | + | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries |
| 43 | - | " let &guioptions = substitute(&guioptions, "t", "", "g") |
| 43 | + | " let &guioptions = substitute(&guioptions, "t", "", "g") |
| 44 | - | |
| 44 | + | |
| 45 | - | " Don't use Ex mode, use Q for formatting |
| 45 | + | " Don't use Ex mode, use Q for formatting |
| 46 | - | map Q gq |
| 46 | + | map Q gq |
| 47 | - | |
| 47 | + | |
| 48 | - | " This is an alternative that also works in block mode, but the deleted |
| 48 | + | " This is an alternative that also works in block mode, but the deleted |
| 49 | - | " text is lost and it only works for putting the current register. |
| 49 | + | " text is lost and it only works for putting the current register. |
| 50 | - | "vnoremap p "_dp |
| 50 | + | "vnoremap p "_dp |
| 51 | - | |
| 51 | + | |
| 52 | - | " Switch syntax highlighting on, when the terminal has colors |
| 52 | + | " Switch syntax highlighting on, when the terminal has colors |
| 53 | - | " Also switch on highlighting the last used search pattern. |
| 53 | + | " Also switch on highlighting the last used search pattern. |
| 54 | - | if &t_Co > 2 || has("gui_running") |
| 54 | + | if &t_Co > 2 || has("gui_running")
|
| 55 | - | syntax on |
| 55 | + | syntax on |
| 56 | - | set hlsearch |
| 56 | + | set hlsearch |
| 57 | - | endif |
| 57 | + | endif |
| 58 | - | |
| 58 | + | |
| 59 | - | " Only do this part when compiled with support for autocommands. |
| 59 | + | " Only do this part when compiled with support for autocommands. |
| 60 | - | if has("autocmd") |
| 60 | + | if has("autocmd")
|
| 61 | - | |
| 61 | + | |
| 62 | - | " Enable file type detection. |
| 62 | + | " Enable file type detection. |
| 63 | - | " Use the default filetype settings, so that mail gets 'tw' set to 72, |
| 63 | + | " Use the default filetype settings, so that mail gets 'tw' set to 72, |
| 64 | - | " 'cindent' is on in C files, etc. |
| 64 | + | " 'cindent' is on in C files, etc. |
| 65 | - | " Also load indent files, to automatically do language-dependent indenting. |
| 65 | + | " Also load indent files, to automatically do language-dependent indenting. |
| 66 | - | filetype plugin indent on |
| 66 | + | filetype plugin indent on |
| 67 | - | |
| 67 | + | |
| 68 | - | " Put these in an autocmd group, so that we can delete them easily. |
| 68 | + | " Put these in an autocmd group, so that we can delete them easily. |
| 69 | - | augroup vimrcEx |
| 69 | + | augroup vimrcEx |
| 70 | - | au! |
| 70 | + | au! |
| 71 | - | |
| 71 | + | |
| 72 | - | " For all text files set 'textwidth' to 78 characters. |
| 72 | + | " For all text files set 'textwidth' to 78 characters. |
| 73 | - | autocmd FileType text setlocal textwidth=78 |
| 73 | + | autocmd FileType text setlocal textwidth=78 |
| 74 | - | |
| 74 | + | |
| 75 | - | " When editing a file, always jump to the last known cursor position. |
| 75 | + | " When editing a file, always jump to the last known cursor position. |
| 76 | - | " Don't do it when the position is invalid or when inside an event handler |
| 76 | + | " Don't do it when the position is invalid or when inside an event handler |
| 77 | - | " (happens when dropping a file on gvim). |
| 77 | + | " (happens when dropping a file on gvim). |
| 78 | - | autocmd BufReadPost * |
| 78 | + | autocmd BufReadPost * |
| 79 | - | \ if line("'\"") > 0 && line("'\"") <= line("$") | |
| 79 | + | \ if line("'\"") > 0 && line("'\"") <= line("$") |
|
| 80 | - | \ exe "normal g`\"" | |
| 80 | + | \ exe "normal g`\"" | |
| 81 | - | \ endif |
| 81 | + | \ endif |
| 82 | - | |
| 82 | + | |
| 83 | - | augroup END |
| 83 | + | augroup END |
| 84 | - | |
| 84 | + | |
| 85 | - | else |
| 85 | + | else |
| 86 | - | |
| 86 | + | |
| 87 | - | set autoindent " always set autoindenting on |
| 87 | + | set autoindent " always set autoindenting on |
| 88 | - | |
| 88 | + | |
| 89 | - | endif " has("autocmd") |
| 89 | + | endif " has("autocmd")
|
| 90 | - | |
| 90 | + | |
| 91 | - | set number |
| 91 | + | set number |
| 92 | - | iab vehilce vehicle |
| 92 | + | iab vehilce vehicle |
| 93 | - | iab vehilces vehicles |
| 93 | + | iab vehilces vehicles |
| 94 | - | set showmode |
| 94 | + | set showmode |
| 95 | - | set nowrap |
| 95 | + | set nowrap |
| 96 | - | set laststatus=2 |
| 96 | + | set laststatus=2 |
| 97 | - | set statusline=[%n]\ %<%f\ %((%1*%M%*%R%Y)%)\ %=%-19(\LINE\ [%3l/%3L]\ COL\ [%02c%03V]%)\ ascii['%02b']\ %P |
| 97 | + | set statusline=[%n]\ %<%f\ %((%1*%M%*%R%Y)%)\ %=%-19(\LINE\ [%3l/%3L]\ COL\ [%02c%03V]%)\ ascii['%02b']\ %P |
| 98 | - | imap jj <Esc> |
| 98 | + | imap jj <Esc> |
| 99 | - | vmap <silent> g/y/=substitute(escape(@", '\\/.*$^~[]'), '\n','\\n','g') |
| 99 | + | vmap <silent> g/y/=substitute(escape(@", '\\/.*$^~[]'), '\n','\\n','g') |
| 100 | - | |
| 100 | + | |
| 101 | - | "set fdm=syntax |
| 101 | + | "set fdm=syntax |
| 102 | - | set backupdir=~/.vim/backup |
| 102 | + | set backupdir=~/.vim/backup |
| 103 | - | "---------------------------------------- |
| 103 | + | "---------------------------------------- |
| 104 | - | " Highlight a particular csv column (put in .vimrc) |
| 104 | + | " Highlight a particular csv column (put in .vimrc) |
| 105 | - | function! CSVH(x) |
| 105 | + | function! CSVH(x) |
| 106 | - | execute 'match Keyword /^\([^,]*,\)\{'.a:x.'}\zs[^,]*/' |
| 106 | + | execute 'match Keyword /^\([^,]*,\)\{'.a:x.'}\zs[^,]*/'
|
| 107 | - | execute 'normal ^'.a:x.'f,' |
| 107 | + | execute 'normal ^'.a:x.'f,' |
| 108 | - | endfunction |
| 108 | + | endfunction |
| 109 | - | command! -nargs=1 Csv :call CSVH(<args>) |
| 109 | + | command! -nargs=1 Csv :call CSVH(<args>) |
| 110 | - | " call with |
| 110 | + | " call with |
| 111 | - | ":Csv 5 : highlight fifth column |
| 111 | + | ":Csv 5 : highlight fifth column |
| 112 | - | autocmd BufRead *.erb set filetype=eruby |
| 112 | + | autocmd BufRead *.erb set filetype=eruby |
| 113 | - | set wildmenu |
| 113 | + | set wildmenu |
| 114 | - | set wildmode=list:longest,full |
| 114 | + | set wildmode=list:longest,full |
| 115 | - | silent! ruby nil |
| 115 | + | silent! ruby nil |
| 116 | - | |
| 116 | + | |
| 117 | - | "for HTML.vim to use lower case tags |
| 117 | + | "for HTML.vim to use lower case tags |
| 118 | - | :let g:html_tag_case = 'lowercase' |
| 118 | + | :let g:html_tag_case = 'lowercase' |
| 119 | - | set autoread |
| 119 | + | set autoread |
| 120 | - | colorscheme vividchalk |
| 120 | + | colorscheme vividchalk |
| 121 | - | let g:GetLatestVimScripts_allowautoinstall=1 |
| 121 | + | let g:GetLatestVimScripts_allowautoinstall=1 |
| 122 | cmap w!! w !sudo tee % >/dev/null<CR>:e!<CR><CR> |