-
Notifications
You must be signed in to change notification settings - Fork 0
/
general.rc.vim
81 lines (64 loc) · 1.87 KB
/
general.rc.vim
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
70
71
72
73
74
75
76
77
78
79
80
"---------------------------------------------------------------------------
" General:
"
" Increase history amount.
set history=1000
" Use clipboard register.
if has('unnamedplus')
set clipboard& clipboard+=unnamedplus
else
set clipboard& clipboard+=unnamed
endif
" Display another buffer when current buffer isn't saved.
set hidden
" Auto reload if file is changed.
set autoread
" Use vimgrep.
"set grepprg=internal
" Use grep.
set grepprg=grep\ -inH
if executable('ack')
set grepprg=ack\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow\ $*
set grepformat=%f:%l:%c:%m
endif
if executable('ag')
set grepprg=ag\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow
set grepformat=%f:%l:%c:%m
endif
" Exclude = from isfilename.
set isfname-==
" Reload .vimrc automatically.
autocmd MyAutoCmd BufWritePost .vimrc,vimrc,*.rc.vim
\ NeoBundleClearCache | source $MYVIMRC | redraw
" Search home directory path on cd.
" But can't complete.
" set cdpath+=~
" Keymapping timeout.
set timeout timeoutlen=3000 ttimeoutlen=100
" CursorHold time.
set updatetime=1000
" Set swap directory.
set directory-=.
if v:version >= 703
" Set undofile.
set undofile
let &undodir=&directory
endif
if v:version < 703 || (v:version == 7.3 && !has('patch336'))
" Vim's bug.
set notagbsearch
endif
" Check timestamp more for 'autoread'.
autocmd MyAutoCmd WinEnter * checktime
" Make directory automatically.
" --------------------------------------
" http://vim-users.jp/2011/02/hack202/
autocmd MyAutoCmd BufWritePre *
\ call s:mkdir_as_necessary(expand('<afile>:p:h'), v:cmdbang)
function! s:mkdir_as_necessary(dir, force)
if !isdirectory(a:dir) && &l:buftype == '' &&
\ (a:force || input(printf('"%s" does not exist. Create? [y/N]',
\ a:dir)) =~? '^y\%[es]$')
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
endif
endfunction