-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
319 lines (270 loc) · 8.62 KB
/
.vimrc
File metadata and controls
319 lines (270 loc) · 8.62 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
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
" 快捷鍵 | 套件
" -----------|------------
" <F2> | NERDTree
" <F3> | undotree
" <F4> | Tagbar
" <F5> | buffers switch
" <F6> | indentLine
" <F7> | eslite
" <F9>/<F10>| 切換 color scheme
" \t | command-t
" \c<space> | 註解
"
execute pathogen#infect()
set nocompatible " be iMproved, required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" 速寫HTML
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}
" zen coding功能
Plugin 'mattn/emmet-vim'
" 狀態列
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" google color scheme
Plugin 'google/vim-colorscheme-primary'
" javascript Syntax Highlighting Plugin
Plugin 'https://github.com/pangloss/vim-javascript.git'
" snipmate 速寫HTML(換ultisnips)
" Bundle 'MarcWeber/vim-addon-mw-utils'
" Bundle 'tomtom/tlib_vim'
" Bundle 'garbas/vim-snipmate'
" Bundle 'honza/vim-snippets'
Plugin 'ervandew/supertab'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
" taglist 將程式碼當中的變數函數等tag全部顯示在Symbol視窗
" Plugin 'https://github.com/vim-scripts/taglist.vim.git'
" 程式碼自動補字
Plugin 'https://github.com/Valloric/YouCompleteMe.git'
" 可以在vim裡快速尋找外面的文件並打開
Plugin 'https://github.com/kien/ctrlp.vim.git'
" NERDTree
Plugin 'https://github.com/scrooloose/nerdtree.git'
" nerdtree-git-plugin
Plugin 'Xuyuanp/nerdtree-git-plugin'
" 批量註解
Plugin 'scrooloose/nerdcommenter'
" vim-easymotion 快速移動
Plugin 'https://github.com/easymotion/vim-easymotion.git'
" incsearch-fuzzy.vim 全文搜尋工具
Plugin 'haya14busa/incsearch.vim'
Plugin 'haya14busa/incsearch-fuzzy.vim'
" 可對多游標編輯
Plugin 'https://github.com/terryma/vim-multiple-cursors.git'
" 顯示縮排對齊線
Plugin 'Yggdroot/indentLine'
" 符號自動補齊
Plugin 'jiangmiao/auto-pairs'
" 顯示git diff
Plugin 'airblade/vim-gitgutter'
" 紀錄vim編輯紀錄
Plugin 'mbbill/undotree'
" 類似taglist
Plugin 'majutsushi/tagbar'
" 語法檢查
Plugin 'scrooloose/syntastic'
" EJS syntastic heightlight
Bundle 'nikvdp/ejs-syntax'
" color plugin
Plugin 'https://github.com/tomasr/molokai.git'
" color plugin
Plugin 'https://github.com/w0ng/vim-hybrid.git'
" 提供 nerdtree 時有小 icon 以更方便知道檔案類型
" Plugin 'ryanoasis/vim-devicons'
" Plugin 'ryanoasis/vim-webdevicons'
" 可以同時對字串的前後""做修改
Plugin 'https://github.com/tpope/vim-surround.git'
" 顯示 color (ex: yellow #00FFFF)
Bundle 'https://github.com/gorodinskiy/vim-coloresque.git'
" 快速換 heightlight
Plugin 'chxuan/change-colorscheme'
" Renpy vim syntax highlight
Plugin 'chaimleib/vim-renpy'
Plugin 'posva/vim-vue'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" 根據語法折疊
set foldmethod=syntax
" Go to definition else declaration
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
" 主动调用补全
let g:ycm_key_invoke_completion = '<C-a>'
" vim-airline 設定 "
" set status line
set laststatus=2
" enable powerline-fonts
let g:airline_powerline_fonts = 1
" set theme
" let g:airline_theme='light'
" enable tabline
let g:airline#extensions#tabline#enabled = 1
" set left separator
"let g:airline#extensions#tabline#left_sep = ' '
" set left separator which are not editting
"let g:airline#extensions#tabline#left_alt_sep = '|'
" show buffer number
let g:airline#extensions#tabline#buffer_nr_show = 1
" google color scheme
" syntax enable
" set t_Co=256
" set background=dark
" colorscheme primary
" Molokai color
colorscheme molokai
let g:molokai_termcolors=256
set t_Co=256
" vim-hybrid
" set t_Co=256
" set background=dark
" colorscheme hybrid
" enable javascript Syntax Highlighting Plugin
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
set foldmethod=syntax
" 其他設定
"set mouse=a
set encoding=utf8
set number
" set relativenumber
set expandtab
set tabstop=2
set shiftwidth=2
set noeb
set autochdir
set guifont=Hack\ 12
set cursorline
set cursorcolumn
set history=100
nnoremap <F5> :buffers<CR>:buffer<Space>
map <f9> :Tlist<CR>
" inoremap ( ()<LEFT>
" inoremap [ []<LEFT>
" inoremap { {}<LEFT>
" inoremap ' ''<LEFT>
" inoremap " ""<LEFT>
" 加速vim
set ttyfast
set lazyredraw
" switch buffer
nmap <C-b>n :bnext<CR>
nmap <C-b>p :bprev<CR>
" NERD Commenter 註解時多加空格
let g:NERDSpaceDelims=1
" incsearch-fuzzy 全文搜尋
" map z/ <Plug>(incsearch-fuzzy-/)
" map z? <Plug>(incsearch-fuzzy-?)
" map zg/ <Plug>(incsearch-fuzzy-stay)
" map z/ <Plug>(incsearch-fuzzyspell-/)
" map z? <Plug>(incsearch-fuzzyspell-?)
" map zg/ <Plug>(incsearch-fuzzyspell-stay)
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" easymotion更改快捷键
" map f <Plug>(easymotion-prefix)
map ff <Plug>(easymotion-s)
" map fs <Plug>(easymotion-f)
" map fl <Plug>(easymotion-lineforward)
" map fj <Plug>(easymotion-j)
" map fk <Plug>(easymotion-k)
" map fh <Plug>(easymotion-linebackward)
" 忽略大小写
let g:EasyMotion_smartcase = 1
" NERD Tree
nnoremap <silent> <F2> :NERDTree<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
" undotree
nnoremap <F3> :UndotreeToggle<cr>
" Tagbar
nmap <F4> :TagbarToggle<CR>
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_checkers = ['eslint']
" let g:syntastic_javascript_eslint_exec = 'eslint'
nnoremap <F7> :call BTNEslint()<CR>
function! BTNEslint()
if exists("g:qwindow")
:lclose
unlet g:qwindow
else
try
:lopen 6
let g:qwindow = 1
catch
echo "No Errors found!"
endtry
endif
endfunction
" indentLine 顯示縮排對齊線
nmap <F6> :IndentLinesToggle<CR>
" change-colorscheme
map <F10> :NextColorScheme<CR>
imap <F10> <ESC> :NextColorScheme<CR>
map <F9> :PreviousColorScheme<CR>
imap <F9> <ESC> :PreviousColorScheme<CR>
" ctrlp
let g:ctrlp_map = '<leader>p'
let g:ctrlp_cmd = 'CtrlP'
map <leader>f :CtrlPMRU<CR>
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn|rvm)$','file': '\v\.(exe|so|dll|zip|tar|tar.gz|pyc)$', }
let g:ctrlp_working_path_mode=0
let g:ctrlp_match_window_bottom=1
let g:ctrlp_max_height=15
let g:ctrlp_match_window_reversed=0
let g:ctrlp_mruf_max=500
let g:ctrlp_follow_symlinks=1
syntax on
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
au BufNewFile,BufRead *.ejs set filetype=ejs
" au BufNewFile,BufRead *.ejs set filetype=javascript
" au BufNewFile,BufRead *.ejs set filetype=html