-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
153 lines (133 loc) · 4.88 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
" let Vundle manage Vundle
set rtp+=$HOME/.vim/bundle/vundle/
call vundle#rc()
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'Markdown'
Bundle 'snipMate'
Bundle 'jQuery'
Bundle 'JavaScript-syntax'
Bundle 'git://github.com/kien/ctrlp.vim'
Bundle 'git://github.com/scrooloose/nerdtree'
Bundle 'git://github.com/mattn/emmet-vim'
"Bundle 'git://github.com/Lokaltog/vim-powerline'
Bundle 'git://github.com/bronson/vim-trailing-whitespace'
Bundle 'yonchu/accelerated-smooth-scroll'
Bundle 'git://github.com/tpope/vim-fugitive.git'
Bundle 'junegunn/vim-easy-align'
Bundle 'git://github.com/tomtom/tcomment_vim'
Bundle 'bling/vim-airline'
Bundle 'git://github.com/scrooloose/syntastic'
" 判断是否处于GUI界面
if has("gui_running")
let g:isGUI = 1
else
let g:isGUI = 0
endif
" 对部分语言设置单独的缩进
au FileType ruby,eruby,slim,coffee,sh set shiftwidth=2
au FileType ruby,eruby,slim,coffee,sh set tabstop=2
au FileType php,javascript,html,css set shiftwidth=4
au FileType php,javascript,html,css set tabstop=4
" 根据后缀名指定文件类型
au BufRead,BufNewFile *.h setlocal ft=c
au BufRead,BufNewFile *.sql setlocal ft=mysql
au BufRead,BufNewFile *.txt setlocal ft=txt
if g:isGUI
colorscheme molokai
set guifont=Monaco
else
colorscheme tango2
set guifont=Monaco
endif
set helplang=cn " 中文帮助
set expandtab " 将Tab自动转化成空格 [需要输入真正的Tab键时,使用 Ctrl + V + Tab]
set backspace=2 " 设置退格键可用
set tabstop=4 " 设置tab键的宽度
set shiftwidth=4 " 换行时行间交错使用4个空格
set autoindent " 自动对齐
set ai! " 设置自动缩进
set smartindent " 智能自动缩进
set autoread " 当文件在外部被修改时自动更新该文件
set tags=tags;
set autochdir
set mouse=a " 启用鼠标
set nowrap " 不自动换行
set hlsearch " 高亮显示结果
set incsearch " 在输入要搜索的文字时,vim会实时匹配
set nu! " 显示行号
set nocompatible " 关闭兼容模式
syntax enable " 打开语法高亮
syntax on " 开启文件类型侦测
filetype indent on " 针对不同的文件类型采用不同的缩进格式
filetype plugin on " 针对不同的文件类型加载对应的插件
filetype plugin indent on " 启用自动补全
" 设置文件编码和文件格式
set fenc=utf-8
set encoding=utf-8
set fileencodings=utf-8,gbk,cp936,latin-1
set fileformat=unix
set fileformats=unix,dos,mac
set enc=utf-8
set tenc=utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
" 使用GUI界面时的设置
if g:isGUI
" 启动时自动最大化窗口
au GUIEnter * simalt ~x
"winpos 20 20 " 指定窗口出现的位置,坐标原点在屏幕左上角
"set lines=20 columns=90 " 指定窗口大小,lines为高度,columns为宽度
set guioptions+=c " 使用字符提示框
set guioptions-=m " 隐藏菜单栏
set guioptions-=T " 隐藏工具栏
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
"set showtabline=0 " 隐藏Tab栏
set cursorline " 突出显示当前行
endif
set dictionary+=~/.vim/dict/mywords
set dictionary+=/usr/share/dict/words
set isk+=-
let NERDChristmasTree=1
let NERDTreeAutoCenter=1
nnoremap <silent> <F5> :NERDTree<CR>
"CtrlP
set runtimepath^=$HOME/.vim/bundle/ctrlp.vim
set runtimepath^=$HOME/.vim/bundle/rails.vim
"SnipMate
let g:snippets_dir = '$HOME/.vim/bundle/snipMate/snippets/'
"Emmet
let g:user_emmet_expandabbr_key='<c-e>'
let g:user_emmet_complete_tag=1
"Ctags
map <C-F12> :!ctags -R --fields=+iaS --extra=+q .<CR>
":set ff=unix
map <C-S-F1> :%s/\r\+$//e <CR>
map <C-S-F2> :1,$,%s/ / /g <CR>
"Git
autocmd Filetype gitcommit setlocal spell textwidth=72
set laststatus=2 "show the status line
set statusline=%-10.3n "buffer number
"PowerLine
"let g:Powerline_symbols = 'fancy'
"set laststatus=2
"Airline
let g:airline#extensions#tabline#enabled = 1
let Powerline_symbols='compatible'
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
let g:airline#extensions#syntastic#enabled = 1
"EasyAlign
vnoremap <silent> <Enter> :EasyAlign<Enter>
noremap <silent> <C-Left> :bp<CR>
noremap <silent> <C-Right> :bn<CR>