-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
261 lines (248 loc) · 7.81 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
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
" {{{ Global configuration
syntax on
filetype on
if has("autocmd")
filetype plugin indent on
endif
set nocompatible
" set guifont=Consolas
" set number
set relativenumber
set nobackup
set noswapfile
set ignorecase
set smartcase
set incsearch
set hlsearch
set autoindent
set cindent
set wildmenu
set viminfo='100,f1
set background=dark
set foldcolumn=3
set laststatus=2
set tabstop=4
set shiftwidth=4
set expandtab
" enable the feature to put modified buffer in background
set hidden
" set default foldmethod to marker {{{,}}}
set foldmethod=marker
let mapleader = ","
if exists("+autochdir")
set autochdir
endif
set guitablabel="%r%m%t"
" fix issue about backspace doesn't work in insert mode
set backspace=2
" disable preview window (annoying 'Scratch')
set completeopt-=preview
set encoding=UTF-8
" for linux to display colors for powerline, this also affect indent-guides under msys
set t_ut=
set t_Co=256
" }}}
" {{{ Identifies gvim
if has("win32") && has("gui_running")
winpos 840 0
set lines=62
set columns=110
" maximize the window
au GUIEnter * simalt ~X
" hide menu bar
set guioptions -=m
" hide toolbar
set guioptions -=T
" hide right-hand scrollbar
set guioptions -=r
" hide left-hand scrollbar
set guioptions -=L
let g:pathogen_disabled = []
call add(g:pathogen_disabled, 'DBGPavim')
else
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
endif
" }}}
" {{{ Key bindings
inoremap jk <esc>
inoremap kj <esc>
"" make < > shifts keep selection
"vnoremap < <gv
"vnoremap > >gv
" Tab management
" \e to open a new tab as the first one
silent! nnoremap <unique> <silent> <Leader>e :0tabnew<CR>
" Commands
" \n to call :noh
silent! nnoremap <unique> <silent> <Leader>n :noh<CR>
" Plugins
" \N to open :NerdTree
silent! nnoremap <unique> <silent> <Leader>N :NERDTree<CR>
" \cpb to open CtrlP using buffer
silent! nnoremap <unique> <silent> <Leader>cpb :CtrlPBuffer<CR>
" \cpm to open CtrlP using MRU file mode
silent! nnoremap <unique> <silent> <Leader>cpm :CtrlPMixed<CR>
" \cpc to open customized path
silent! nnoremap <unique> <Leader>cpc :CtrlP<Space>
" \fdi to set fold method to indent
silent! nnoremap <unique> <Leader>fdi :set foldmethod=indent<CR>
" \fdm to set fold method to manual
silent! nnoremap <unique> <Leader>fdm :set foldmethod=manual<CR>
",tt to toggle vimwiki todo
nmap <Leader>tt <Plug>VimwikiToggleListItem<CR>
" }}}
" {{{ Plugins configurations
let g:ctrlp_clear_cache_on_exit = 0
let g:solarized_termcolors=256
let NERDTreeDirArrows = 1
" let NERDTreeQuitOnOpen = 1
" Configure relativenumber for NerdTree:
" bundle/nerdtree/ftplugin/nerdtree.vim: setlocal relativenumber (with this line and this line only)
" vim-airline to display full path of current file
let g:airline_section_c='%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#'
let g:vimwiki_global_ext = 0
let g:vimwiki_ext2syntax = {}
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
autocmd FileType vimwiki set filetype=markdown
"}}}
" {{{ cscope
if has('cscope')
set cscopetag cscopeverbose
if has('quickfix')
set cscopequickfix=s-,c-,d-,i-,t-,e-
endif
cnoreabbrev csa cs add
cnoreabbrev csf cs find
cnoreabbrev csk cs kill
cnoreabbrev csr cs reset
"cnoreabbrev css cs show
cnoreabbrev csh cs help
endif
" {{{ autoloading for cscope
function! LoadCscope()
let db = findfile("cscope.out", ".;")
if (!empty(db))
let path = strpart(db, 0, match(db, "/cscope.out$"))
set nocscopeverbose " suppress 'duplicate connection' error
" exe "cs add " . db . " " . path . " -C"
exe "cs add " . db . " " . path
set cscopeverbose
endif
endfunction
" }}}
" }}}
" {{{ Random color scheme
com! DCS exec ':colorscheme desert'
com! RCS exec 'let randcolor=[
\"solarized",
\"desert256",
\"molokai",
\"rdark-terminal",
\"jellybeans",
\"mint",
\"navajo-night",
\"wombat"
\] | exe "colo " . randcolor[localtime() % len(randcolor)] | unlet randcolor'
com! RRCS exec 'let mycolors=split(globpath(&rtp,"**/colors/*.vim"),"\n") | exe "so " . mycolors[localtime() % len(mycolors)] | unlet mycolors'
" }}}
" {{{ Startup commands
"autocmd BufWinLeave * silent! mkview
"autocmd BufWinEnter * silent! loadview
"autocmd BufEnter * call LoadCscope()
"autocmd VimEnter * call LoadCscope()
" }}}
" {{{ Custom Functions
fu! ToggleCurline ()
if &cursorline && &cursorcolumn
set nocursorline
set nocursorcolumn
else
set cursorline
set cursorcolumn
endif
endfunction
map <silent><leader>cl :call ToggleCurline()<CR>
" }}}
""" {{{ TODO: local config
""" make sure this line is added as the first line before source this vimrc
""" Config Zone start
""let g:phrepopath='/Users/philia/Documents/repo/philia.test'
""let g:tempdir='/Users/philia/Documents/tmp'
""" Config Zone end, DO NOT MODIFY ANYTHING BELOW!!
""
""" Uncomment these lines to enable plugins and customized config
""if !isdirectory(g:tempdir.'/vim.view')
"" call mkdir(g:tempdir.'/vim.view')
""endif
""if !isdirectory(g:tempdir.'/vim.tmp')
"" call mkdir(g:tempdir.'/vim.tmp')
""endif
""
""" Vundle default configurations
""set nocompatible " be iMproved, required
""filetype off " required
""
""" set the runtime path to include Vundle and initialize
""set shell=/bin/sh
"" set rtp+=~/mnt/philia.test/modules/Vundle.vim
"""execute 'set rtp+='.g:phrepopath.'/modules/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-surround'
""Plugin 'bumaociyuan/vim-matchit'
""Plugin 'Lokaltog/vim-easymotion'
""Plugin 'kien/ctrlp.vim'
""Plugin 'scrooloose/nerdtree'
""Plugin 'bling/vim-airline'
""Plugin 'flazz/vim-colorschemes'
""Plugin 'luochen1990/rainbow'
""Plugin 'godlygeek/tabular'
""Plugin 'vimwiki/vimwiki'
""
"""" 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.
"""Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
"""" Avoid a name conflict with L9
"""Plugin 'user/L9', {'name': 'newL9'}
""
""" 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
""
""""if has("gui_running")
"""" set transparency=10
""""endif
""""
""execute "source ".g:phrepopath."/vimrc"
""""" DCS " Random select a default color scheme (in randcolor list)
""colo molokai
""highlight Visual cterm=reverse ctermbg=NONE
""" }}}