forked from beiyuu/vimfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_vimrc
executable file
·189 lines (153 loc) · 4.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
set nocompatible "不要兼容vi
filetype off "必须的设置:
"Color Settings {
set colorcolumn=85 "彩色显示第85行
set t_Co=256 "设置256色显示
set background=dark "使用color solarized
set cursorline "设置光标高亮显示
set cursorcolumn "光标垂直高亮
set ttyfast
set ruler
set backspace=indent,eol,start
colorscheme solarized
let g:solarized_termtrans = 1
let g:solarized_termcolors = 256
let g:solarized_contrast = "high"
let g:solarized_visibility = "high"
"}
"tab setting {
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
"}
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set scrolloff=3
set fenc=utf-8
set autoindent
set hidden
"set encoding=utf-8
"set laststatus=2
"set number "显示行号
"set undofile "无限undo
"set nowrap "禁止自动换行
"autocmd! bufwritepost _vimrc source % "自动载入配置文件不需要重启
set relativenumber "相对行号 要想相对行号起作用要放在显示行号后面
set wrap "自动换行
set guifont=Inconsolata:h12 "GUI界面里的字体,默认有抗锯齿
set isk+=- "将-连接符也设置为单词
set ignorecase "设置大小写敏感和聪明感知(小写全搜,大写完全匹配)
set smartcase
"set gdefault
set incsearch
set showmatch
set hlsearch
set numberwidth=4 "行号栏的宽度
"set columns=135 "初始窗口的宽度
"set lines=50 "初始窗口的高度
"winpos 620 45 "初始窗口的位置
set whichwrap=b,s,<,>,[,] "让退格,空格,上下箭头遇到行首行尾时自动移到下一行(包括insert模式)
"插入模式下移动
inoremap <c-j> <down>
inoremap <c-k> <up>
inoremap <c-l> <right>
inoremap <c-h> <left>
"===================================================
"修改leader键为逗号
let mapleader=","
imap jj <esc>
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
"修改vim的正则表达
nnoremap / /\v
vnoremap / /\v
"使用tab键来代替%进行匹配跳转
nnoremap <tab> %
vnoremap <tab> %
"折叠html标签 ,fold tag
nnoremap <leader>ft vatzf
"使用,v来选择刚刚复制的段落,这样可以用来缩进
nnoremap <leader>v v`]
"使用,w来垂直分割窗口,这样可以同时查看多个文件,如果想水平分割则<c-w>s
nnoremap <leader>w <c-w>v<c-w>l
nnoremap <leader>wc <c-w>c
nnoremap <leader>ww <c-w>w
"tab切换
nnoremap <leader>t gt
nnoremap <leader>r gT
"使用<leader>空格来取消搜索高亮
nnoremap <leader><space> :noh<cr>
"html中的js加注释 取消注释
nmap <leader>h I//jj
nmap <leader>ch ^xx
"切换到当前目录
nmap <leader>q :execute "cd" expand("%:h")<CR>
"搜索替换
nmap <leader>s :,s///c
"取消粘贴缩进
nmap <leader>p :set paste<CR>
nmap <leader>pp :set nopaste<CR>
"文件类型切换
nmap <leader>fj :set ft=javascript<CR>
nmap <leader>fc :set ft=css<CR>
nmap <leader>fx :set ft=xml<CR>
nmap <leader>fm :set ft=mako<CR>
"设置隐藏gvim的菜单和工具栏 F2切换
set guioptions-=m
set guioptions-=T
"去除左右两边的滚动条
set go-=r
set go-=L
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
"Indent Guides设置
"let g:indent_guides_guide_size=1
"Vundle Settings {
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
Bundle 'ctrlp.vim'
Bundle 'AutoClose'
Bundle 'ZenCoding.vim'
Bundle 'matchit.zip'
Bundle 'Tabular'
Bundle 'Valloric/YouCompleteMe'
Bundle 'spiiph/vim-space'
Bundle 'terryma/vim-multiple-cursors'
Bundle 'trailing-whitespace'
Bundle '_jsbeautify'
nnoremap <leader>_ff :call g:Jsbeautify()<CR>
Bundle 'EasyMotion'
let g:EasyMotion_leader_key = '<Leader><Leader>'
"Fencview的初始设置
"Bundle 'FencView.vim'
"let g:fencview_autodetect=1
Bundle 'The-NERD-tree'
"设置相对行号
nmap <leader>nt :NERDTree<cr>:set rnu<cr>
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.$','\~$']
let NERDTreeShowLineNumbers=1
let NERDTreeWinPos=1
Bundle 'The-NERD-Commenter'
let NERDShutUp=1
"支持单行和多行的选择,//格式
map <c-h> ,c<space>
Bundle 'UltiSnips'
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
"}
"放置在Bundle的设置后,防止意外BUG
filetype plugin indent on
syntax on