-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
232 lines (204 loc) · 7.29 KB
/
.vimrc
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
syntax on
colorscheme pyte
set ts=4 sw=4 et
let g:indent_guides_start_level = 1
let g:indent_guides_guide_size = 1
set wildmenu
set nocompatible
set history=999
set encoding=utf-8
set nobackup
set hidden
" for vundle
set rtp+=~/.vim/vundle/
call vundle#rc()
filetype plugin on
Bundle 'Shougo/unite.vim'
Bundle 'Shougo/neocomplcache'
"Bundle 'Shougo/vimfiler'
Bundle 'Shougo/vimshell'
Bundle 'sjl/gundo.vim'
Bundle 'chrismetcalf/vim-yankring'
Bundle 'scrooloose/nerdcommenter'
Bundle 'tpope/vim-surround'
Bundle 'thinca/vim-quickrun'
Bundle 'thinca/vim-ref'
Bundle 'kana/vim-fakeclip'
Bundle 'mattn/zencoding-vim'
Bundle 'mattn/calendar-vim'
Bundle 'itspriddle/vim-javascript-indent'
Bundle 'hotchpotch/perldoc-vim'
Bundle 'petdance/vim-perl'
Bundle 'scrooloose/nerdtree'
"Bundle 'jimsei/winresizer'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'scrooloose/syntastic'
Bundle 'ShowMarks'
"Bundle 'css.vim'
"Bundle 'css_color.vim'
"Bundle 'javaScriptLint.vim'
"Bundle 'NERD_tree_ACK.vim'
" 表示系
set number
set tabstop=4
set expandtab
set scrolloff=5
set showmatch
set laststatus=2
set ruler
set title
set showcmd
set showmode
set statusline=%<%F\ %r%h%w%y%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%4v(ASCII=%03.3b,HEX=%02.2B)\ %l/%L(%P)%m
set list
set listchars=tab:>-
set wildmode=list:longest
set showtabline=2
nnoremap <Space>t t
nnoremap <Space>T T
nnoremap t <Nop>
nnoremap <silent> tc :<C-u>tabnew<LF>:tabmove<LF>
nnoremap <silent> tk :<C-u>tabclose<LF>
nnoremap <silent> tn :<C-u>tabnext<LF>
nnoremap <silent> tp :<C-u>tabprevious<LF>
nnoremap <silent> <C-w><C-n> :vnew<LF>
"status line changes background color when it is insert mode
let g:hi_insert = 'highlight StatusLine guifg=darkblue guibg=darkyellow gui=none ctermfg=blue ctermbg=yellow cterm=none'
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_color_change_percent = 10
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=black guibg=black ctermbg=1 "インデントの色
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=darkgrey guibg=darkgrey ctermbg=2 "二段階目のインデントの色
let g:indent_guides_auto_colors = 0
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
if has('syntax')
augroup InsertHook
autocmd!
autocmd InsertEnter * call s:StatusLine('Enter')
autocmd InsertLeave * call s:StatusLine('Leave')
augroup END
endif
let s:slhlcmd = ''
function! s:StatusLine(mode)
if a:mode == 'Enter'
silent! let s:slhlcmd = 'highlight ' . s:GetHighlight('StatusLine')
silent exec g:hi_insert
else
highlight clear StatusLine
silent exec s:slhlcmd
endif
endfunction
function! s:GetHighlight(hi)
redir => hl
exec 'highlight '.a:hi
redir END
let hl = substitute(hl, '[\r\n]', '', 'g')
let hl = substitute(hl, 'xxx', '', '')
return hl
endfunction
" 保存時に行末の空白を除去する
" autocmd BufWritePre * :%s/\s\+$//ge
" " 保存時にtabをスペースに変換する
" autocmd BufWritePre * :%s/\t/ /ge
"compliler
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=2
"autocmd FileType perl,cgi :compiler perl
"autocmd FileType css :compiler css
"compliler:perl
au BufReadPost,BufNewFile *.t :setl filetype=perl
nnoremap <C-B> :NERDTreeToggle<Return>
" 検索
set ignorecase
set smartcase
set noincsearch
set hlsearch
nmap <Esc><Esc> :nohlsearch<LF><Esc>
imap <C-@> <C-[>
set backspace=indent,eol,start
if has("syntax")
syntax on
function! ActivateInvisibleIndicator()
syntax match InvisibleJISX0208Space " " display containedin=ALL
highlight InvisibleJISX0208Space term=underline ctermbg=Blue guifg=#999999 gui=underline
syntax match InvisibleTrailedSpace "[ ]\+$" display containedin=ALL
highlight InvisibleTrailedSpace term=underline ctermbg=Red guifg=#FF5555 gui=underline
syntax match InvisibleTab "\t" display containedin=ALL
highlight InvisibleTab term=underline ctermbg=Cyan guibg=#555555
endf
augroup invisible
autocmd! invisible
autocmd BufNew,BufRead * call ActivateInvisibleIndicator()
augroup END
endif
"autocmd FileType php set tags=$HOME/.vim/tags/perl.tags,$HOME/.vim/tags/perl_app.tags
nmap ,U :set encoding=utf-8<LF>
nmap ,E :set encoding=euc-jp<LF>
map ,S :set encoding=cp932<LF>
" unite.vim
let g:unite_source_file_mru_time_format = ''
let g:unite_enable_split_vertically=1
let g:unite_enable_start_insert = 1
let g:unite_source_file_mru_ignore_pattern='.*\/$\|.*Application\ Data.*'
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()
imap <buffer> jj <Plug>(unite_insert_leave)
imap <buffer> <C-j> <Plug>(unite_exit)
imap <buffer> <ESC> <Plug>(unite_exit)
imap <buffer> <C-o> <Plug>(unite_insert_leave):<C-u>call unite#mappings#do_action('above')<LF>
endfunction
autocmd FileType vimshell call s:vimshell_my_settings()
function! s:vimshell_my_settings()
inoremap <buffer> <C-x> <ESC><C-w>h:on<LF>
inoremap <buffer> <silent> <C-n> <ESC>:<C-u>Unite buffer <LF>
inoremap <buffer> <silent> <C-r> <ESC>:<C-u>Unite file_mru <LF>
nnoremap <buffer> <LF> Go$
imap <buffer> <C-x> <ESC><C-w>h:on<LF>
nnoremap <buffer><silent> <C-n> :<C-u>Unite buffer <LF>
inoremap <C-v> <C-R>+
inoremap <buffer><expr><C-h> pumvisible() ? "\<C-y>\<C-h>" : "\<C-h>"
imap <buffer> <C-o> <Plug>(vimshell_enter)
inoremap <buffer> <C-l> <C-y>
imap <buffer> <C-s> <Plug>(vimshell_history_complete_whole)
NeoComplCacheAutoCompletionLength 3
endfunction
" バッファ一覧
noremap <silent> <C-U><C-B> :Unite buffer<LF>
" ファイル一覧
noremap <silent> <C-U><C-F> :UniteWithBufferDir -buffer-name=files file<LF>
" レジスタ一覧
noremap <silent> <C-U><C-R> :Unite -buffer-name=register register<LF>
" 最近使用したファイル一覧
noremap <silent> <C-U><C-M> :Unite file_mru<LF>
" 常用セット
noremap <silent> <C-U><C-Y> :Unite buffer file_mru<LF>
" 全部乗せ
noremap <silent> <C-U><C-M> :UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<LF>
" ウィンドウを分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-j> unite#do_action('split')
au FileType unite inoremap <silent> <buffer> <expr> <C-j> unite#do_action('split')
" ウィンドウを縦に分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit')
au FileType unite inoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit')
" ESCキーを2回押すと終了する
au FileType unite nnoremap <silent> <buffer> <ESC><ESC> q
au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>q
"neocomplcache(http://vim-users.jp/2010/10/hack177/ or http://vim-users.jp/2010/11/hack185/)
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_snippets_dir = $HOME.'/.vim/snippets'
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
"vimfilter
"let g:vimfiler_as_default_explorer = 1
set cursorline