-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigs.vim
More file actions
207 lines (166 loc) · 4.88 KB
/
configs.vim
File metadata and controls
207 lines (166 loc) · 4.88 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
" -----------------------------
" Backups, Tmp Files, and Undo
" -----------------------------
set backup
set backupdir=~/.vim/.backup
set directory=~/.vim/.swap
if v:version >= 703
"undo settings
set undodir=~/.vim/.undofiles
set undofile
"set colorcolumn=+1 "mark the ideal max text width
endif
" ---------------
" UI
" ---------------
set showcmd "show incomplete cmds down the bottom
set showmode "show current mode down the bottom
set number "show line numbers
"display tabs and trailing spaces
set list
set listchars=tab:▷\ ,trail:⋅,nbsp:⋅
"some stuff to get the mouse going in term
set mouse=a
set ttymouse=xterm2
"tell the term has 256 colors
set t_Co=256
"hide buffers when not displayed
set hidden
"line is too long
"set colorcolumn=100
set cursorline
"set cursorcolumn
" always show statusline
set laststatus=2
" colorscheme
"syntax enable
"set background=dark
"colorscheme wombat
" set guifont
if has("gui_running")
set guifont=Droid\ Sans\ Mono\ 14
"set guifontwide=Droid\ Sans\ Mono\ 14
endif
" ---------------
" Text Format
" ---------------
"default indent settings
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set smarttab
set autoindent
" ---------------
" Searching
" ---------------
set ignorecase " Case insensitive search
set smartcase " Non-case sensitive search
set incsearch
set hlsearch
set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,.svn,.hg,.bzr,.git,
\.sass-cache,*.class,*.scssc,*.cssc,sprockets%*,*.lessc"
" ---------------
" Behaviors
" ---------------
"turn on syntax highlighting
syntax on
"allow backspacing over everything in insert mode
set backspace=indent,eol,start
"store lots of :cmdline history
set history=1000
set wrap "wrap lines
set linebreak "wrap lines at convenient points
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
set wildmode=list:longest "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set formatoptions-=o "dont continue comments when pushing o/O
"vertical/horizontal scroll off settings
set scrolloff=3
set sidescrolloff=7
set sidescroll=1
" add html matchpairs
set matchpairs+=<:>
" auto add tags file updirs
map <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
set tags+=/usr/include/tags
set tags+=/usr/lib/gcc
set tags+=./tags
set tags+=tags;/
if filereadable("tags")
set tags+=tags
endif
" File encoding
set fileencoding=utf8
" detect file encodings list below:
" gb18030 should be before UTF-8
set fileencodings=utf-8,gb18030,default
" Vim支持在编辑文本时自动折行,但默认对中文折行的支持并不理想,建议添加如下两个设置:
" 如遇Unicode值大于255的文本,不必等到空格再折行。
set formatoptions+=m
" " 合并两行中文时,不在中间加空格:
set formatoptions+=B
" save before jump to other buf
set autowriteall
"visual search mappings
function! s:VSetSearch()
let temp = @@
norm! gvy
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
let @@ = temp
endfunction
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
" completation
" let Vim's popup menu like other IDE(ref: VimTip1228)
set completeopt+=longest
set completeopt-=preview
" close popup menu window when leave insert mode
autocmd InsertLeave * if pumvisible()==0|pclose|endif
" select current item when press <CR>
inoremap <expr> <CR> pumvisible()?"\<C-y>":"\<CR>"
" ---------------
" Plugin settings
" ---------------
"nerdtree settings
let g:NERDTreeMouseMode = 2
let g:NERDTreeWinSize = 40
"dont load csapprox if we no gui support - silences an annoying warning
if !has("gui")
let g:CSApprox_loaded = 1
endif
"http://vimcasts.org/episodes/fugitive-vim-browsing-the-git-object-database/
"hacks from above (the url, not jesus) to delete fugitive buffers when we
"leave them - otherwise the buffer list gets poluted
"
"add a mapping on .. to view parent tree
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd BufReadPost fugitive://*
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
let yankring_manual_clipboard_check=0
set foldlevel=10
" avoid hit-enter prompts caused by file messages
set shortmess=a
" ---------------
" Sounds
" ---------------
set noerrorbells
set novisualbell
set t_vb=
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8
colorscheme default
"let g:Powerline_colorscheme='solarized256'
"开启路径补全"
"let g:neocomplete#enable_at_startup = 1
"打开vim背景透明"
hi Normal ctermfg=252 ctermbg=none