|
| 1 | +" John Lam's .vimrc file |
| 2 | + |
| 3 | +" Start maximized |
| 4 | +au GUIEnter * simalt ~x |
| 5 | + |
| 6 | +" Use CUA keystrokes for clipboard: CTRL-X, CTRL-C, CTRL-V and CTRL-z |
| 7 | +source $VIMRUNTIME/mswin.vim |
| 8 | + |
| 9 | +syntax on |
| 10 | +set nocompatible |
| 11 | +filetype on |
| 12 | +filetype indent on |
| 13 | +filetype plugin on |
| 14 | + |
| 15 | +" General options |
| 16 | +set incsearch |
| 17 | +set ignorecase smartcase |
| 18 | + |
| 19 | +" Use four space tabs |
| 20 | +set tabstop=4 |
| 21 | +set shiftwidth=4 |
| 22 | +set expandtab |
| 23 | + |
| 24 | +" Setup 120 column word wrap |
| 25 | +set wrap |
| 26 | +set linebreak |
| 27 | +set textwidth=120 |
| 28 | + |
| 29 | +" No menus and no toolbar |
| 30 | +"set guioptions-=m |
| 31 | +"set guioptions-=T |
| 32 | + |
| 33 | +" Consolas 15 point, ansi character set |
| 34 | +set guifont=Consolas:h13:cANSI |
| 35 | + |
| 36 | +highlight Normal guifg=White guibg=Black |
| 37 | +highlight Cursor guifg=Black guibg=Yellow |
| 38 | +highlight Keyword guifg=#FF6600 |
| 39 | +highlight Define guifg=#FF6600 |
| 40 | +highlight Comment guifg=#9933CC |
| 41 | +highlight Type guifg=White gui=NONE |
| 42 | +highlight rubySymbol guifg=#339999 gui=NONE |
| 43 | +highlight Identifier guifg=White gui=NONE |
| 44 | +highlight rubyStringDelimiter guifg=#66FF00 |
| 45 | +highlight rubyInterpolation guifg=White |
| 46 | +highlight rubyPseudoVariable guifg=#339999 |
| 47 | +highlight Constant guifg=#FFEE98 |
| 48 | +highlight Function guifg=#FFCC00 gui=NONE |
| 49 | +highlight Include guifg=#FFCC00 gui=NONE |
| 50 | +highlight Statement guifg=#FF6600 gui=NONE |
| 51 | +highlight String guifg=#66FF00 |
| 52 | +highlight Search guibg=White |
| 53 | + |
| 54 | +function RubyEndToken () |
| 55 | + let current_line = getline( '.' ) |
| 56 | + let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$' |
| 57 | + let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|module\|while\|until\|def\)' |
| 58 | + let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$' |
| 59 | + |
| 60 | + if match(current_line, braces_at_end) >= 0 |
| 61 | + return "\<CR>}\<C-O>O" |
| 62 | + elseif match(current_line, stuff_without_do) >= 0 |
| 63 | + return "\<CR>end\<C-O>O" |
| 64 | + elseif match(current_line, with_do) >= 0 |
| 65 | + return "\<CR>end\<C-O>O" |
| 66 | + else |
| 67 | + return "\<CR>" |
| 68 | + endif |
| 69 | +endfunction |
| 70 | + |
| 71 | +function UseRubyIndent () |
| 72 | + setlocal tabstop=8 |
| 73 | + setlocal softtabstop=2 |
| 74 | + setlocal shiftwidth=2 |
| 75 | + setlocal expandtab |
| 76 | + |
| 77 | + imap <buffer> <CR> <C-R>=RubyEndToken()<CR> |
| 78 | +endfunction |
| 79 | + |
| 80 | +autocmd FileType ruby,eruby call UseRubyIndent() |
| 81 | + |
| 82 | +map ,# :s/^/#/<CR> |
| 83 | +map <M-]> :tabnext<CR> |
| 84 | +map <M-[> :tabprevious<CR> |
| 85 | +map <M-t> :tabnew<CR> |
| 86 | +imap <M-]> :tabnext<CR> |
| 87 | +imap <M-[> :tabprevious<CR> |
| 88 | +imap <M-t> :tabnew<CR> |
| 89 | +
|
| 90 | + |
| 91 | +set nocompatible |
| 92 | +source $VIMRUNTIME/vimrc_example.vim |
| 93 | +source $VIMRUNTIME/mswin.vim |
| 94 | +behave mswin |
| 95 | + |
| 96 | +set diffexpr=MyDiff() |
| 97 | +function MyDiff() |
| 98 | + let opt = '-a --binary ' |
| 99 | + if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif |
| 100 | + if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif |
| 101 | + let arg1 = v:fname_in |
| 102 | + if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif |
| 103 | + let arg2 = v:fname_new |
| 104 | + if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif |
| 105 | + let arg3 = v:fname_out |
| 106 | + if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif |
| 107 | + let eq = '' |
| 108 | + if $VIMRUNTIME =~ ' ' |
| 109 | + if &sh =~ '\<cmd' |
| 110 | + let cmd = '""' . $VIMRUNTIME . '\diff"' |
| 111 | + let eq = '"' |
| 112 | + else |
| 113 | + let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' |
| 114 | + endif |
| 115 | + else |
| 116 | + let cmd = $VIMRUNTIME . '\diff' |
| 117 | + endif |
| 118 | + silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq |
| 119 | +endfunction |
| 120 | + |
| 121 | +set nobackup |
0 commit comments