-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
267 lines (231 loc) · 6.7 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
" Default setting
if filereadable("/etc/vim/vimrc")
source /etc/vim/vimrc
endif
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/Users/napo/.cache/dein/repos/github.com/Shougo/dein.vim
" Required:
call dein#begin('/Users/napo/.cache/dein')
" Let dein manage dein
" Required:
call dein#add('/Users/napo/.cache/dein/repos/github.com/Shougo/dein.vim')
if !has('nvim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
call dein#add('Shougo/vimshell')
call dein#add('vim-scripts/AnsiEsc.vim')
call dein#add('banyan/recognize_charcode.vim')
call dein#add('Shougo/neocomplcache')
call dein#add('itchyny/lightline.vim')
call dein#add('scrooloose/nerdtree')
call dein#add('airblade/vim-gitgutter')
call dein#add('Shougo/unite.vim')
call dein#add('scrooloose/syntastic')
call dein#add('sheerun/vim-polyglot')
call dein#add('jonathanfilip/vim-lucius')
endif
" Required:
call dein#end()
" Required:
filetype plugin indent on
syntax enable
"
" Global configuration
"
set ambiwidth=double
set laststatus=2
set showcmd
set showmatch
set matchtime=1
set ignorecase
set smartcase
set ruler
set number
set notitle
set autowrite
set hidden
set scrolloff=5
set history=1000
set autoread
set incsearch
set hlsearch
set nowrap
set t_ut=y
set t_Co=256
set wildmenu
set wildchar=<tab>
set wildmode=list:full
set complete+=k
set guifont=Ricty\ 15
set clipboard+=unnamed
set lazyredraw
set ttyfast
set ttyscroll=3
set undodir=~/.vim/undo
set undofile
set colorcolumn=100
set virtualedit=all
nmap <ESC><ESC> ;nohlsearch<CR><ESC>
set cursorline
augroup cch
autocmd! cch
autocmd WinLeave * set nocursorline
autocmd WinEnter,BufRead * set cursorline
augroup END
if has('virtualedit') && &virtualedit =~# '\<all\>'
nnoremap <expr> <SID>($-if-right-of-$) (col('.') >= col('$') ? '$' : '')
nnoremap <SID>(noremap-p) p
nmap p <SID>($-if-right-of-$)<SID>(noremap-p)
endif
"
" Indentation
"
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
"
" Key remap
"
nnoremap ; :
"set virtualedit=block
set backspace=indent,eol,start
set t_kD=[3~
set list
set listchars=tab:›\ ,eol:\ ,trail:~
"
" Move to last edited line
"
au BufWritePost * mkview
autocmd BufReadPost * loadview
"
" File handling
"
set fileencodings=utf-8
set fileformats=unix,dos
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932
set fileformat=unix
filetype plugin on
au BufRead,BufNewFile *.ru set ft=ruby
au BufRead,BufNewFile *.twig set ft=jinja.html
au BufRead,BufNewFile *.less set ft=less
au BufRead,BufNewFile *.slim set ft=slim
au BufRead,BufNewFile *.json set ft=json
au BufRead,BufNewFile *.bowerrc set ft=json
au BufRead,BufNewFile *.txt set ft=markdown
au BufRead,BufNewFile *.txt set foldmethod=marker
au BufRead,BufNewFile *.scala set ft=java.scala
au BufRead,BufNewFile *.yml set foldmethod=syntax
au BufRead,BufNewFile /etc/nginx/* set ft=nginx
au BufRead,BufNewFile /etc/nginx/configs/* set ft=nginx
au BufRead,BufNewFile Procfile set ft=ruby
autocmd BufWritePre * :%s/\s\+$//ge
"
" Module configuration
"
cnoremap <C-p> <Up>
cnoremap <Up> <C-p>
cnoremap <C-n> <Down>
cnoremap <Down> <C-n>
nnoremap <silent> ,is :VimShell<CR>
let g:unite_enable_start_insert = 1
let g:unite_enable_ignore_case = 1
let g:unite_enable_smart_case = 1
nnoremap <silent> ,g :<C-u>Unite grep:. -buffer-name=search-buffer<CR>
nnoremap <silent> ,cg :<C-u>Unite grep:. -buffer-name=search-buffer<CR><C-R><C-W>
noremap <silent> ,r :<C-u>UniteResume search-buffer<CR>
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
let g:unite_source_grep_recursive_opt = ''
endif
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
inoremap <expr><Up> neocomplcache#close_popup()."\<Up>"
inoremap <expr><Down> neocomplcache#close_popup()."\<Down>"
inoremap <expr><Left> neocomplcache#close_popup()."\<Left>"
inoremap <expr><Right> neocomplcache#close_popup()."\<Right>"
"
" Lightline
"
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode',
\ },
\ }
function! MyModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! MyReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? 'u' : ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
function! MyFugitive()
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
let _ = fugitive#head()
return strlen(_) ? ' '._ : ''
endif
return ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! MyFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! MyMode()
return winwidth(0) > 60 ? lightline#mode() : ''
endfunction
autocmd FileType quickrun AnsiEsc
"
" Coloring
"
syntax enable
set background=dark
colorscheme lucius
function! ActivateInvisibleIndicator()
hi SpecialKey cterm=NONE ctermfg=darkgray guifg=darkgray
hi ZenkakuSpace cterm=underline ctermfg=red gui=underline guifg=#FF0000
match ZenkakuSpace / /
endfunction
augroup InvisibleIndicator
autocmd!
autocmd BufEnter * call ActivateInvisibleIndicator()
augroup END
filetype plugin indent on
" brew
eval "$(/opt/homebrew/bin/brew shellenv)"