-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
184 lines (154 loc) · 4.92 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
set nocompatible
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'majutsushi/tagbar'
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'preservim/nerdcommenter'
Plug 'godlygeek/tabular'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'tpope/vim-surround'
Plug 'tommcdo/vim-exchange'
Plug 'tpope/vim-repeat'
Plug 'Raimondi/delimitMate'
Plug 'vim-syntastic/syntastic'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'kana/vim-operator-user'
Plug 'rhysd/vim-clang-format'
" Markdown
Plug 'reedes/vim-pencil'
Plug 'plasticboy/vim-markdown'
Plug 'junegunn/limelight.vim'
" Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'mracos/mermaid.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'octol/vim-cpp-enhanced-highlight'
" Initialize plugin system
call plug#end()
"Jim's config
filetype on
filetype indent on
filetype plugin on
autocmd FileType c,cpp set number
autocmd FileType c,cpp set cindent
autocmd FileType python set number
autocmd FileType python set smartindent
set autoread
set mouse=a
set nofoldenable
" workaround backspace not work
set backspace=2
set number
colorscheme desert
syntax enable
syntax on
set cindent
set smartindent
set autoindent
set tabstop=2
set shiftwidth=2
set incsearch
set hlsearch
set ruler
set showmatch
set showcmd
set nowrap
" 解决中文乱码
set guifont="Sauce Code Powerline:h12"
set encoding=utf-8
set termencoding=utf-8
" key map configs
let mapleader = ','
let g:mapleader = ','
" NERDTree config
nmap <silent> <leader>n :NERDTreeToggle <CR>
let NERDTreeShowHidden=1
" tagbar config
nmap <silent> <leader>ta :TagbarToggle <CR>
" vim airline config
set laststatus=2
set t_Co=256
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_powerline_fonts = 1
let g:Powerline_symbols = 'fancy'
" switch buffer
nnoremap [b :bp<CR>
nnoremap ]b :bn<CR>
" leaderf config
nmap <silent> <leader>fi :Leaderf file<CR>
nmap <silent> <leader>ft :Leaderf gtags<CR>
nmap <silent> <leader>ff :Leaderf function<CR>
nmap <silent> <leader>tg :Leaderf gtags --update<CR>
let g:Lf_Gtagslabel = 'native'
let g:Lf_Gtagsconf = expand('.globalrc')
let g:Lf_PreviewInPopup = 1
let g:Lf_WindowPosition = 'popup'
let g:Lf_PopupPosition = [65535, 0]
let g:Lf_PopupColorscheme = 'default'
let g:Lf_RootMarkers = ['.root']
let g:Lf_GtagsAutoGenerate = 1
let g:Lf_GtagsAutoUpdate = 1
let g:Lf_GtagsSkipUnreadable = 1
let g:Lf_GtagsStoreInRootMarker = 1
let g:Lf_AutoResize = 1
let g:Lf_MaxCount = 10000000
let g:Lf_PreviewResult = { 'gtags': 1 }
nmap <leader>csd :Leaderf gtags -d <C-R>=expand("<cword>")<CR><CR>
nmap <leader>csr :Leaderf gtags -r <C-R>=expand("<cword>")<CR><CR>
nmap <leader>css :Leaderf gtags -s <C-R>=expand("<cword>")<CR><CR>
nmap <leader>csg :Leaderf gtags -g <C-R>=expand("<cword>")<CR><CR>
" nerdcommenter config -- use the default config
let g:NERDCreateDefaultMappings = 1
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDDefaultAlign = 'left'
let g:NERDCustomDelimiters = { 'c': { 'left': '/*','right': '*/' } }
" let g:NERDCustomDelimiters = { 'c': { 'left': '//','right': '' } }
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:NERDToggleCheckAllLines = 1
" tabular config
nmap <leader>a :Tabularize /
" syntastic config
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
" clang-format config
nmap <silent> <leader>cf :ClangFormat<cr>
let g:clang_format#code_style = "google"
let g:clang_format#style_options = {
\ 'Language' : 'Cpp',
\ 'BasedOnStyle' : 'Google',
\ 'AlignConsecutiveMacros' : 'true',
\ 'AlignConsecutiveAssignments' : 'true',
\ 'AlignConsecutiveBitFields' : 'true',
\ 'AlignConsecutiveDeclarations' : 'true',
\ 'AlignTrailingComments' : 'true',
\ 'BreakBeforeBraces' : 'Linux',
\ }
" Limelight
let g:limelight_conceal_ctermfg=244
" Markdown Preview
let g:mkdp_auto_close=0
let g:mkdp_refresh_slow=1
let g:mkdp_markdown_css='~/.github-markdown.css'
nmap <silent> <leader>mdp :MarkdownPreview<CR>
nmap <silent> <leader>mdps :MarkdownPreviewStop<CR>
" insert date and time as my blog needs
nmap <silent> <leader>mtime "=strftime("%Y-%m-%d %H:%M:%S %z")<CR>P
" buffer switch
nmap <silent> <leader>bp :bp<CR>
nmap <silent> <leader>bn :bn<CR>