-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc-win
261 lines (228 loc) · 6.85 KB
/
.vimrc-win
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
"Leader key and my own key settings
let mapleader = ","
"For Vundle
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=$HOME/vimfiles/bundle/Vundle.vim
call vundle#begin('$HOME/vimfiles/bundle')
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
" Plugin 'tpope/vim-surround'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'jeetsukumaran/vim-buffergator'
Plugin 'lifepillar/vim-solarized8'
"Plugin 'dikiaap/minimalist'
"Plugin 'craigemery/vim-autotag'
"Plugin 'Valloric/YouCompleteMe'
"Plugin 'vim-syntastic/syntastic'
"Plugin 'majutsushi/tagbar'
" Plugin 'matze/vim-tex-fold'
" 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
""""""-----------PLUGIN CONFIGS-------------------
" For Airline
let g:airline_theme='simple'
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" " Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
"For CtrlP
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
nmap <leader>p :CtrlP<cr>
nmap <leader>bb :CtrlPBuffer<cr>
nmap <leader>bm :CtrlPMixed<cr>
nmap <leader>bs :CtrlPMRU<cr>
nmap <leader>tg :CtrlPTag<cr>
"For Buffergator
let g:buffergator_suppress_keymaps = 1
" View the entire list of buffers open
nmap <leader>bl :BuffergatorOpen<cr>
nmap <leader>gt :BuffergatorMruCycleNext<cr>
nmap <leader>gT :BuffergatorMruCyclePrev<cr>
nmap <leader>tt :edit
" For fugitive (Git)
nmap <leader>ga :Git add %:p<CR><CR>
nmap <leader>gs :Gstatus<CR>
nmap <leader>gc :Gcommit -v -q<CR>
nmap <leader>gd :Gdiff<CR>
nmap <leader>gl :Git local
nmap <leader>gw :Gwrite<CR>
nmap <leader>gr :Gread<CR>
set diffopt+=vertical
"For YouCompleteMe
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_python_binary_path = 'python3'
let g:ycm_global_ycm_extra_conf = '~/dotfiles/ycm_extra_conf.py'
map <leader> gd :YcmCompleter GoToDefinitionElseDeclaration<CR>
set omnifunc=syntaxcomplete#Complete
"For Tagbar
let g:tagbar_left = 1
let g:tagbar_autoclose = 1
let g:tagbar_autofocus = 1
nnoremap <leader>tb :TagbarToggle<CR>
" Color scheme (via plugin)
colorscheme solarized8
""""""-----------END OF PLUGIN CONFIGS-------------------
" For spellchecking
nmap <leader>sc :setlocal spell spelllang=en_us<CR>
nmap <leader>ns :setlocal nospell<CR>
" For Browser
let g:netrw_liststyle=3
let g:netrw_banner=0
let g:netrw_browse_split=4 " Open in previous buffer
let g:netrw_winsize=15
let g:netrw_altrv = 1
nmap <leader>nv :Vex<CR>
"Filetype indents
set tabstop=4
set shiftwidth=4
set expandtab
"2 space indents
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
autocmd Filetype yaml setlocal ts=2 sw=2 expandtab
autocmd Filetype tex,text,markdown setlocal ts=2 sw=2 expandtab
autocmd Filetype nim setlocal ts=2 sw=2 expandtab
"4 space indents
"autocmd Filetype python setlocal ts=4 sw=4 expandtab
" Google Style guide
" autocmd Filetype cpp setlocal ts=2 sw=2 expandtab
"8 space indents (Linux Kernel style)
autocmd Filetype c setlocal ts=8 sw=8 expandtab
" Gofmt uses tabs
autocmd Filetype go setlocal ts=4 sw=4 sts=4 noet
"In general
syntax enable
set bg=dark
set textwidth=80
set autoindent
set smartindent
set number
set cursorline
set hidden "For buffers
set formatoptions-=cro
set splitright
set backspace=indent,eol,start
set ff=dos
set encoding=utf-8
let python_highlight_all=1
set tags=tags;/ "Look for tags upwards
set clipboard=unnamed "Use system clipboard
set mouse=a "Use the mouse
"Wrapping
set wrap
set wrapmargin=0
set textwidth=80
set linebreak
set nolist " Turn it on manually when needed
set lcs+=space:⋅
set lcs+=trail:·
set lcs+=tab:░\
set lcs+=trail:·
set lcs+=extends:»
set lcs+=precedes:«
set lcs+=nbsp:⣿
autocmd Filetype tex,text,markdown setlocal textwidth=0
"Case insensitive search for lowercase query, case sensitive for mixed case
set incsearch "Start searching with incomplete tag
set ignorecase
set smartcase
set hlsearch
" Enable folding
set foldmethod=syntax
autocmd Filetype python,html,nim setlocal foldmethod=indent
"autocmd BufWinLeave *.* mkview
"autocmd BufWinEnter *.* silent loadview
" Edit this file
nnoremap <leader>ev :split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" C++ includes
iabbrev #a #include <algorithm>
iabbrev #d #include <deque>
iabbrev #c #include <cmath>
iabbrev #i #include <iostream>
iabbrev #l #include <limits>
iabbrev #n #include <numeric>
iabbrev #q #include <queue>
iabbrev #r #include <random>
iabbrev #u #include <utility>
iabbrev #m #include <unordered_map>
iabbrev #v #include <vector>
iabbrev iuns using namespace std;
iabbrev imain int main(int argc, char **argv) {<cr> return 0;<cr>}
" Get off my lawn
nnoremap <Left> <C-W>5<
nnoremap <Right> <C-W>5>
nnoremap <Up> <C-W>3-
nnoremap <Down> <C-W>3+
" Movement
noremap <C-H> <C-W>h
noremap <C-L> <C-W>l
noremap <C-J> <C-W>j
noremap <C-K> <C-W>k
noremap <C-N> gT
noremap <C-M> gt
"Mapping keys
command! -nargs=1 Silent
\ execute 'silent !' . <q-args>
\ | execute 'redraw!'
map <Leader>ll :Silent pdflatex -synctex=1 -interaction=nonstopmode -output-directory %:p:h %:p<CR>
map <Leader>run :!%:p
"Remapping of Actual Keys
"Remapping of Actual Keys
"Note: Made a major change. Now, carriage return returns a newline
imap jj <Esc>
inoremap <S-Tab> <C-d>
nnoremap <CR> o<Esc>
nnoremap 0 ^
nnoremap ^ 0
nnoremap <Space> za
nnoremap <C-n> :nohl<CR>
nmap S ciw
nmap Y y$
command! W write
command! Q quit
command! WQ wq
command! Wq wq
"Macros
let @b='i\begin{homeworkProblem}\end{homeworkProblem}jjkkA '
let @e='i\begin{enumerate}[(a)]\item\item\end{enumerate}^xkk$a'
let @c='i\[f(x) = \begin{cases}0 &\text{ if } x \leq 0\\x &\text{ if } x > 0\end{cases}\]'
let @a='o\begin{align*}a &= b\\\end{align*}jjkk0'
let @m='\left(\begin{smallmatrix} a&b \\ c&d \end{smallmatrix} \right)'
let @d='\frac{du}{dt}'
let @p='o\begin{proof}\end{proof}jjO'
"Pasting shortcuts
let @s=' \text{ s.t. } '
let @i='^{-1}'