-
Notifications
You must be signed in to change notification settings - Fork 0
/
_gvimrc
301 lines (296 loc) · 9.69 KB
/
_gvimrc
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
function! NumberToggle()
if(&relativenumber == 1)
set number
set norelativenumber
else
set relativenumber
set number
endif
endfunc
if has("gui_running")
" Set a nicer font.
" set guifont=Consolas:h10
set guifont=Hack:h12:cANSI:qCLEARTYPE
" Hide the toolbar.
set guioptions-=T
" Hide file menu
set guioptions-=M
set guioptions-=m
" use vim tabbar
set guioptions-=e
" Hide scrollbars
set guioptions-=r
set guioptions-=l
set guioptions-=L
set guioptions+=c
endif
let g:airline#extensions#tagbar#flags = 'f'
"===============================================================================
"VIM PLUG OPTIONS
"===============================================================================
call plug#begin('$VIMRUNTIME/plugged')
Plug 'PProvost/vim-ps1'
Plug 'yggdroot/indentline'
Plug 'majutsushi/tagbar'
let g:tagbar_ctags_bin = 'C:\utils\ctags.exe'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'Valloric/YouCompleteMe'
Plug 'tpope/vim-unimpaired'
" Plug 'tpope/vim-vinegar'
Plug 'simnalamburt/vim-mundo'
Plug 'justinmk/vim-dirvish'
Plug 'mhinz/vim-startify'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'w0ng/vim-hybrid'
Plug 'tpope/vim-commentary'
Plug 'mileszs/ack.vim'
Plug 'kshenoy/vim-signature' "For marks
Plug 'moll/vim-bbye' "For deleting buffers without closing splits
Plug 'pjkack/vim-ctrlp-tjump'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Plug 'blueyed/vim-diminactive'
" Plug 'unblevable/quick-scope'
"Plug 'colepeters/spacemacs-theme.vim'
call plug#end()
let c_no_curly_error=1
"quick-scope options"
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
"===============================================================================
"vim-dirvish OPTIONS
"===============================================================================
let g:dirvish_mode = ':sort ,^.*[\/],'
"change the dirvish suffix highlighting to Tag so it is more visible
highlight! default link DirvishSuffix Tag
"===============================================================================
"ctrlpvim OPTIONS
"===============================================================================
let g:ctrlp_extensions = ['tag']
"===============================================================================
"YOUCOMPLETEME OPTIONS
"===============================================================================
let g:ycm_path_to_python_interpreter="C:/python27/python.exe"
"let g:ycm_global_ycm_extra_conf = "$VIMRUNTIME/.ycm_extra_conf.py"
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_complete_in_comments = 1
let g:ycm_key_invoke_completion = '<C-Space>'
set background=dark
let g:hybrid_reduced_contrast = 1
"===============================================================================
"TAGBAR OPTIONS
"===============================================================================
"disable tagbar sorting
let g:tagbar_sort = 0
" Tell tagbar to keep focus after opening it
let g:tagbar_autofocus = 1
set tags=./tags;
"show line numbers based on global line numbers style
let g:tagbar_show_linenumbers = -1
"===============================================================================
"COLORS/STYLES/THEMES OPTIONS
"===============================================================================
" colorscheme codeschool
if (has("termguicolors"))
set termguicolors
endif
colorscheme hybrid
"highlight line cursor is on
set cursorline
"change color of line number
highlight cursorline guibg=#34374f
"add full pat to vim airline
set encoding=utf-8
"AIRLINE SETTINGS
let g:airline#extensions#tagbar#flags = 'f'
let g:airline_section_c = airline#section#create(['%F'])
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='dark'
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" VIM specific options
"disable swapfile
set noswapfile
"put temp files in tmp folder
set backupdir-=.
set backupdir^=$TEMP
" line number in bottom ruler
set ruler
set number
syntax enable
set incsearch "find the next match as we type the search
set hlsearch "hilight searches by default
" case insensitive searching unless you include an uppercase letter, in which case it becomes case sensitive
set smartcase
set ignorecase
"default indent settings
set shiftwidth=4
set softtabstop=4
set tabstop=4
" Use spaces instead of tabs
set expandtab
set autoindent
set laststatus=2 " status bar always
set backspace=indent,eol,start
set smartindent
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" show tab bar always
set showtabline=2
" vim position and size
set sessionoptions+=resize,winpos
" disable auto comment leaders on newline and o
set formatoptions-=c
set formatoptions-=r
set formatoptions-=o
"show tags
"set showfulltag
"enable folding on syntax
"set foldmethod=syntax
"don't fold everything by default on load
set nofoldenable
" set autochdir
" set vim hybrid number mode by enabling relative and absolute numbering modes
set relativenumber
set number
" auto command to open quickfix window when using lvimgrep
autocmd QuickFixCmdPost *lvimgrep* below lwindow
" auto command to open quickfix window when using vimgrep
autocmd QuickFixCmdPost vimgrep* below cwindow
" make splits more natural by forcing new vsplits to open to the right, and
" hsplits to the bottom
set splitbelow
set splitright
"maximize window on start Use ~x on an English Windows version or ~n for French.
au GUIEnter * simalt ~x
"change search highlight text to red
highlight Search guifg=red
"don't grep this shit
set wildignore+=*.obj,*.tmh,*.tmf,*.pdb*,*.map,*.dll,*.lib,*.exe
let g:ycm_filetype_blacklist={'notes': 1, 'markdown': 1, 'unite': 1, 'tagbar': 1, 'pandoc': 1, 'qf': 1, 'vimwiki': 1, 'text': 1, 'infolog': 1, 'mail': 1, 'vim' : 1}
" Map // in visual mode to search for visual term
vnoremap // y/<C-R>"<CR>
" disable whitespace checking
autocmd VimEnter * AirlineToggleWhitespace
" set map leader to ,
let mapleader=","
set viminfo+=nc:\\users\\mofidulj\\_viminfo
set undofile
set undodir=c:\\users\\mofidulj\\vimundo
"enable cursor column (shows highlights the column the cursor is currently
set cursorcolumn
" Disable Arrow keys in Escape mode
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
"map ctrl hjkl to arrow keys in insert mode
imap <C-l> <right>
imap <C-h> <left>
imap <C-k> <up>
imap <C-j> <down>
"map shift-space to esc
nmap <S-space> <esc>
vmap <S-space> <esc>
imap <S-space> <esc>
"===============================================================================
"LEADER MAPPINGS
"DONT MAP KEYS TO START WITH h,j,k,l since i reserve those for split
"navication and i don't want the input delay
"===============================================================================
"map <leader>q to Bdelete (plugin)
:nnoremap <leader>q :Bdelete<CR>
"map <leader>cdc (currently ,cdc) to change directory to current file and
"print result
nnoremap <leader>cdc :cd %:p:h<CR>:pwd<CR>
"map <leader>ldc (currently ,ldc) to change local directory to current file and
"print result
nnoremap <leader>cdl :lcd %:p:h<CR>:pwd<CR>
"full screen
nnoremap <leader>fs :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
"ctrpl-buffer search
nnoremap <leader>cb :CtrlPBuffer <CR>
nnoremap <leader>cf :CtrlPCurFile<CR>
nnoremap <leader>cw :CtrlPCurWD<CR>
nnoremap <leader>cm :CtrlPMRU<CR>
nnoremap <leader>ct :CtrlPtjump<CR>
"map ,w to ctrl-w for windows commands
nmap <leader>w <C-W>
"map ,j ,k ,h ,l to window movement keys
nmap <leader>j <C-W>j
nmap <leader>k <C-W>k
nmap <leader>h <C-W>h
nmap <leader>l <C-W>l
"map ,r to toggle relative numbers
nmap <leader>r :call NumberToggle()<CR>
"map + and - to increment/decrement number
"nnoremap <kPlus> <C-a>
"nnoremap <kMinus> <C-x>
"map ,s to :w, ,as to :wall (save/save all)
nnoremap <leader>s :w<CR>
nnoremap <leader>as :wall<CR>
"map ,to to tab open
noremap <leader>to :tabnew
nnoremap <leader>tc :tabclose<CR>
" Map tagbar to ,d
nmap <leader>d :Tagbar<CR>
" Map ,tn and ,tp to next tag/prev tag in tagbar (kind of hacky)
nmap <leader>tp :TagbarOpenAutoClose<CR>k<CR>
nmap <leader>tn :TagbarOpenAutoClose<CR>j<CR>
"Map ,b to switch to previous buffer
nmap <leader>b :b#<cr>
"map ,p to switch to previous window/split
nmap <leader>p <C-W>p
"map ,e to open explorer window at current file directory
nmap <leader>e :!start explorer /select,%:p<CR>
"map ,pe to p4 edit current file
nmap <leader>pe :!p4 edit %<CR>
highlight LineNr guifg=#7a848a
highlight signcolumn none
highlight signcolumn ctermfg=237 guifg=#425059