public
Description: caffo's dotfiles
Homepage:
Clone URL: git://github.com/caffo/dotfiles.git
dotfiles / vimrc
100644 69 lines (57 sloc) 1.609 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
set autoindent
set background=dark
set backspace=indent,eol,start
set expandtab
set ignorecase
set incsearch
set incsearch
set mouse=a
set nocompatible
set number
set path+=lib,lib/**/*
set ruler
set shiftwidth=2
set smartcase
set t_Co=256
set visualbell
set wildmenu
set wrap
 
match error /.\%>78v\|\s\+$/
 
function RubyEndToken ()
  let current_line = getline( '.' )
  let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
  let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|module\|while\|until\|def\)'
  let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
 
  if match(current_line, braces_at_end) >= 0
    return "\<CR>}\<C-O>O"
  elseif match(current_line, stuff_without_do) >= 0
    return "\<CR>end\<C-O>O"
  elseif match(current_line, with_do) >= 0
    return "\<CR>end\<C-O>O"
  else
    return "\<CR>"
  endif
endfunction
 
if has("autocmd")
  filetype plugin indent on
 
  augroup vimrcEx
    autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$") |
      \ exe "normal! g`\"" |
      \ endif
 
  augroup ruby
    autocmd FileType ruby setlocal path+=lib,lib/**/* softtabstop=2 shiftwidth=2
    autocmd FileType ruby imap <buffer> <CR> <C-R>=RubyEndToken()<CR>
 
  augroup markdown
    autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
    autocmd BufRead *.markdown set ai formatoptions=tcroqn2 comments=n:>
 
  augroup end
endif
 
command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
     \ | wincmd p | diffthis
 
map <C-l> :noh<CR>
imap <C-l> <ESC>:noh<CR>
 
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif