-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc
More file actions
262 lines (206 loc) · 8.23 KB
/
Copy pathvimrc
File metadata and controls
262 lines (206 loc) · 8.23 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
""set mouse=a
" 定义临时文件的位置
""set backupdir=./.backup,.,/tmp
""set directory=.,./.backup,/tmp
"" fuzzyfinder
" {
map ,, :FufCoverageFile!<cr>
" 查找项目的文件
map ,. :FufBuffer!<cr>
" 查找bufferr的文件
let g:fuf_coveragefile_exclude = '\v\~$|\.(o|exe|DS_Store|dll|bak|orig|swp)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|(tmp|log|db/migrate)'
let g:fuf_enumeratingLimit = 5000
let g:fuf_coveragefile_prompt = ':'
let g:fuf_buffer_prompt = ':'
"} fuzzyfinder
" Example Vim configuration.
" Copy or symlink to ~/.vimrc or ~/_vimrc.
set nocompatible " Must come first because it changes other options.
"silent! call pathogen#runtime_append_all_bundles()
execute pathogen#infect()
""syntax on
""filetype plugin indent on
syntax enable " Turn on syntax highlighting.
filetype plugin indent on " Turn on file type detection.
runtime macros/matchit.vim " Load the matchit plugin.
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
"set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
set title " Set the terminal's title
set visualbell " No beeping.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set directory=$HOME/.vim/tmp//,. " Keep swap files in one location
" UNCOMMENT TO USE
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
"set laststatus=2 " Show the status line all the time
" Useful status information at bottom of screen
"set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{fugitive#statusline()}%{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
" Tab mappings.
"map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabnext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmove
" Uncomment to use Jamis Buck's file opening plugin
"map <Leader>t :FuzzyFinderTextMate<Enter>
" Controversial...swap colon and semicolon for easier commands
"nnoremap ; :
"nnoremap : ;
"vnoremap ; :
"vnoremap : ;
" Automatic fold settings for specific files. Uncomment to use.
"autocmd FileType ruby setlocal foldmethod=syntax
autocmd FileType ruby set foldmethod=syntax
"autocmd FileType css setlocal foldmethod=indent shiftwidth=2 tabstop=2
"let ruby_fold=0 " Ruby
set foldlevel=20
set foldlevelstart=20
" For the MakeGreen plugin and Ruby RSpec. Uncomment to use.
autocmd BufNewFile,BufRead *_spec.rb compiler rspec
"let g:langpair="en|cn"
set helplang=cn
"format css like textmate
"before brew install csstidy
"G =
autocmd filetype css setlocal equalprg=csstidy\ -\ --silent=true
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m1=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" 显示indent
" Usage \ig
let g:indent_guides_auto_colors = 0
set ts=1 sw=2 et
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 1
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#303030 ctermbg=1
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#191919 ctermbg=1
set autoindent
set showtabline=2
" surround map
map <leader>= vs=
map <leader>- vs-
map <leader># vs#
"<%= %> <C-S-s-=>
"<% %> <C-S-s-->
"<%# %> <C-S-s-#>
"Run vim in irb
if has("autocmd")
" Enable filetype detection
filetype plugin indent on
" Restore cursor position
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif
if &t_Co > 2 || has("gui_running")
" Enable syntax highlighting
syntax on
endif
nmap <leader>n :NERDTreeToggle<CR>
" Vim UI {
"set cursorline " highlight current line
if has('cmdline_info')
set ruler " show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set showcmd " show partial commands in status line and
" selected characters/lines in visual mode
endif
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
set backspace=indent,eol,start " backspace for dummies
set linespace=0 " No extra spaces between rows
" set nu " Line numbers on
set showmatch " show matching brackets/parenthesis
set incsearch " find as you type search
set hlsearch " highlight search terms
set winminheight=0 " windows can be 0 line high
set ignorecase " case insensitive search
set smartcase " case sensitive when uc present
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
set foldenable " auto fold code
set list
set listchars=tab:,.,trail:.,extends:#,nbsp:. " Highlight problematic whitespace
" }
set encoding=utf-8 " Necessary to show Unicode glyphs
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
" 输入法解决
"se imd
"au InsertEnter * se noimd
"au InsertLeave * se imd
"au FocusGained * se imd
let g:Powerline_symbols = 'fancy'
" 显示 Ruby/Rails/Rspec 文档
"
"打开浏览器
let g:ruby_doc_command='open'
let g:ruby_doc_ruby_host='http://apidock.com/ruby/'
"使用方法, 光标在单词上面 然后大写"
"RB for Ruby
"RS for RSpec
"RR for Rails
" Or use vividchalk
"colorscheme topfunky-light
"colorscheme vibrantink
"colorscheme solarized
"colorscheme sunburst
""colorscheme vividchalk
""colorscheme codeschool
colorscheme github
""let g:codeschool_termcolors=256
vmap <C-c><C-c> <Plug>SendSelectionToTmux
nmap <C-c><C-c> <Plug>NormalModeSendToTmux
nmap <C-c>r <Plug>SetTmuxVars
"let g:no_turbux_mappings = 1
"set noshowmode
" Format CSS
""map <C-c>f call CssPretty()<CR>
" Format Javascript
map <c-f> :call JsBeautify()<cr>
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
autocmd BufEnter *.c call SourceTagsVim()
let g:EclimCompletionMethod = 'omnifunc'