-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_.vimrc
288 lines (257 loc) · 13.9 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
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
if empty(glob('~/.vim/autoload/plug.vim'))
!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
let g:python_host_prog='/usr/bin/python2'
call plug#begin('~/.vim/plugged')
Plug 'rust-lang/rust.vim' " Rust plugin
Plug 'scrooloose/nerdcommenter' " Comment fast and professionally
Plug 'scrooloose/nerdtree' , {'on': 'NERDTreeToggle'} " Proper file explorer inside vim
Plug 'flazz/vim-colorschemes' " All popular Colorscheme
Plug 'tpope/vim-surround' " Quick Surround with tags or Brackets
Plug 'octol/vim-cpp-enhanced-highlight' " Enhanced syntax highlight for CPP files
Plug 'Lokaltog/vim-easymotion' " Quick jumping between lines
Plug 'myusuf3/numbers.vim' " Auto Toggle between relative and normal numbering
Plug 'sjl/gundo.vim' " Graphical undo tree
Plug 'marcweber/vim-addon-mw-utils' " Vim Addons
Plug 'garbas/vim-snipmate' " Snippets for reusable code
Plug 'tpope/vim-fugitive' " Git Wrapper
Plug 'tomtom/tlib_vim' " Needed for SnipMate :(
Plug 'honza/vim-snippets' " snippets
"Plug 'auto-pairs-gentle' " Auto insert matching brackets
"Plug 'autoswap.vim' " Make vim stop with swap messages intelligently
Plug 'godlygeek/tabular' " Beautiful Alignment when needed
Plug 'plasticboy/vim-markdown' " Better Markdown support for vim (NEEDS TABULAR)
Plug 'jceb/vim-orgmode' " Add OrgMode support like Emacs
"Plug 'cmdalias.vim' " Set up alias for accidental commands
"Plug 'Python-Syntax-Folding' " Proper syntax folding for python
Plug 'nvie/vim-flake8' " Point out PEP8 inconsistencies
Plug 'bling/vim-airline' " Who doesn't know about vim airline plugin
Plug 'kien/ctrlp.vim' " Fast fuzzy file searching
Plug 'terryma/vim-multiple-cursors' " Multiple Cursors like Sublime Text
Plug 'kchmck/vim-coffee-script' " Highlighting and syntax for coffeescript
Plug 'fatih/vim-go' " Go completion and features
Plug 'KabbAmine/zeavim.vim' " Direct documentation access
"Plug 'Superbil/llvm.vim', { 'for': 'llvm' } " LLVM highlighting
Plug 'kh3phr3n/python-syntax'
Plug 'LnL7/vim-nix', { 'for': 'nix' }
Plug 'rhysd/vim-clang-format'
"Plug '~/new_proj/vim/autorun'
Plug 'SirVer/ultisnips' " nice plus
Plug 'ludovicchabant/vim-gutentags'
Plug 'skywind3000/gutentags_plus'
"Plug 'neoclide/coc.nvim', {'branch': 'release'} " Use release branch (recommend)
call plug#end() " Vundle ends here
"ActivateAddons vim-snippets snipmate " assuming you want to use snipmate snippet engine
let g:snipMate = { 'snippet_version' : 1 }
" enable gtags module
let g:gutentags_modules = ['ctags', 'gtags_cscope']
" config project root markers.
let g:gutentags_project_root = ['.root']
" generate datebases in my cache directory, prevent gtags files polluting my project
let g:gutentags_cache_dir = expand('~/.cache/tags')
" change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1
syntax on
filetype plugin indent on
colorscheme jellybeans " Set active Colorscheme
nnoremap ,; ;
" start commands with ; not :
nnoremap ; :
" Turn word to uppercase in insert mode
inoremap <c-u> <Esc>viwUea
" Toggle NERDTree without python compile files
inoremap <F2> <Esc>:NERDTreeToggle<CR>a
" Toggle NERDTree without python compile files
nnoremap <F2> :NERDTreeToggle<CR>
" Turn on/off wrapping
nnoremap <F4> :set wrap!<CR>
" Show open buffers and help in quick switching
nnoremap <F5> :buffers<CR>:buffer<Space>
" Turn on/off current line highlight
nnoremap <F9> :set cul!<CR>
" Indent everything in insert mode
inoremap <F10> <Esc>mmgg=G`ma
" Indent everything in normal mode
nnoremap <F10> <Esc>mmgg=G`m
" comment current line with //
nmap // <leader>ci
" comment current selection with //
vmap // <leader>ci
" w!! force write with sudo even if forgot sudo vim
cmap w!! w !sudo tee > /dev/null %
" Easy Motion shortcut. Try it!
nmap ,, <leader><leader>s
inoremap jk <Esc>
nnoremap <CR> o<Esc>
nnoremap <silent> <tab> mq:bnext<CR>`q
nnoremap <silent> <s-tab> mq:bprevious<CR>`q
" Switch buffers with Tab and Shift-Tab
inoremap <// </<C-X><C-O><C-[>m'==`'
nnoremap Q !!sh<CR>
" Replace current line with output of shell
" --------------------------------CONFIGS----------------------------- "
filetype plugin on
set shellslash
filetype indent on
let g:tex_flavor='latex'
let NERDTreeIgnore=['\.pyc$', '__pycache__'] " Ignoring .pyc files and __pycache__ folder
let g:go_fmt_command = "goimports" " Rewrite go file with correct imports
set wildignore+=*/bin/*,main,*/__pycache__/*,*.pyc,*.swp
set backspace=indent,eol,start " Make backspace work with end of line and indents
set foldmethod=syntax " Auto Add folds - Trigger with za
set foldlevel=9999 " Keep folds open by default
set scrolloff=10 " Scroll Offset below and above the cursor
set expandtab " Replace tab with spaces
set tabstop=2 " Tab = 4 Space
set softtabstop=2 " Act like there are tabs not spaces
set shiftwidth=2 " << and >> shift by 4 space
set hidden " Hide abandoned buffers without message
set wildmenu " Tab command completion in vim
set ignorecase " Ignore case while searching
set smartcase " Case sensitive if Capital included in search
set incsearch " Incremental Searching - Search as you type
set autoindent " Self explained
set smartindent
"set relativenumber " relative numbering (Current line in line 0)
set number " Line numbers - Hybrid mode when used with rnu
set nowrap " I don't like wrapping statements
set nornu " relative numbering (Current line in line 0)
set laststatus=2 " Show status line for even 1 file
set mouse=nv " Allow mouse usage in normal and visual modes
set nohlsearch " Do not highlight all search suggestions.
set modeline " Turn on modeline
let g:airline_powerline_fonts = 1 " Powerline fonts
let g:airline#extensions#tabline#enabled = 1 " Show buffers above
"set cscopetag " For CTAG function navigation
" enable gtags module
let g:gutentags_modules = ['ctags', 'gtags_cscope']
" config project root markers.
let g:gutentags_project_root = ['.root']
" generate datebases in my cache directory, prevent gtags files polluting my project
let g:gutentags_cache_dir = expand('~/.cache/tags')
" change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1
"
let g:UltiSnipsExpandTrigger="<tab>"
"Use tab to switch the next trigger point, shit + tab on a trigger point
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
"Vertical splitting of the screen when using the UltiSnips Edit command
let g:UltiSnipsEditSplit="vertical"
" Lint Configs
let g:clang_format#style_options = {
\ "AccessModifierOffset" : 2,
\ "IndentWidth" : 2,
\ "TabWidth" : 2,
\ "AllowShortIfStatementsOnASingleLine" : "false",
\ "AllowShortBlocksOnASingleLine" : "false",
\ "SortIncludes" : "false",
\ "AllowShortLoopsOnASingleLine" : "false",
\ "AlwaysBreakTemplateDeclarations" : "true",
\ "Standard" : "Auto",
\ "ContinuationIndentWidth" : 2,
\ "BinPackParameters" : "false",
\ "BinPackArguments" : "false",
\ "IndentCaseLabels" : "true",
\ "AllowAllParametersOfDeclarationOnNextLine" : "false"}
"---------------------------SMART CLIPBOARD----------------------------"
vnoremap ,y "+y
nnoremap ,y "+yy
vnoremap ,d "+d
nnoremap ,d "+dd
vnoremap ,p "+p
nnoremap ,p "+p
vnoremap ,P "+P
nnoremap ,P "+P
"----------------------------ABBREVIATIONS-----------------------------"
iabbrev @@g [email protected]
iabbrev @@i [email protected]
iabbrev @@c [email protected]
"----------------------------GVIM SPECIFIC-----------------------------"
set directory=.,$TEMP " Gets rid of a windows specific error
set guioptions-=m " remove menu bar
set guioptions-=T " remove toolbar
set guioptions-=r " remove right-hand scroll bar
set guioptions-=L " remove left-hand scroll bar
set guifont=Source\ Code\ Pro\ for\ Powerline\ 12
"--------------------------------HOOKS---------------------------------"
augroup filetype_tex
autocmd!
autocmd FileType tex nnoremap <F3> mm:w<CR>:!pdflatex<Space>%<CR><CR><Return>`m
augroup END
augroup filetype_compile
autocmd!
autocmd BufWritePre *.c,*.cpp,*.objc,*.h ClangFormat
augroup END
autocmd FileType python inoremap # X<c-h>#
"---------------------------Rajz ITEMS---------------------------"
function! NumberToggle()
if(&rnu == 1)
set nornu
else
set rnu
endif
endfunc
nnoremap <C-l> :call NumberToggle()<cr>
"auto close {
function! s:CloseBracket()
let line = getline('.')
if line =~# '^\s*\(struct\|class\|enum\) '
return "{\<Enter>};\<Esc>O"
elseif searchpair('(', '', ')', 'bmn', '', line('.'))
" Probably inside a function call. Close it off.
return "{\<Enter>});\<Esc>O"
else
return "{\<Enter>}\<Esc>O"
endif
endfunction
inoremap <expr> {<Enter> <SID>CloseBracket()
"Compile cpp file and run
nnoremap <silent> <F8> :!clear;g++ % -o %:r && ./%:r<CR>
" INSERT TIME
nmap <F3> i<C-R>=strftime("%a, %d-%b-%Y, %T %Z")<CR><Esc>
imap <F3> <C-R>=strftime ("%a, %d-%b-%Y, %T %Z")<CR>
"---------------------------OPERATOR-PENDING---------------------------"
" Operate inside next block
onoremap in( :<c-u>normal! f(vi(<CR>
onoremap in{ :<c-u>normal! f{vi{<CR>
onoremap in" :<c-u>normal! f"vi"<CR>
onoremap in' :<c-u>normal! f'vi'<CR>
onoremap in` :<c-u>normal! f`vi`<CR>
" Operate inside previous block
onoremap ip( :<c-u>normal! F)vi(<CR>
onoremap ip{ :<c-u>normal! F}vi{<CR>
onoremap ip" :<c-u>normal! F"vi"<CR>
onoremap ip' :<c-u>normal! F'vi'<CR>
onoremap ip` :<c-u>normal! F`vi`<CR>
" Operate around next block
onoremap an( :<c-u>normal! f(va(<CR>
onoremap an{ :<c-u>normal! f{va{<CR>
onoremap an" :<c-u>normal! f"va"<CR>
onoremap an' :<c-u>normal! f'va'<CR>
onoremap an` :<c-u>normal! f`va`<CR>
" Operate around previous block
onoremap ap( :<c-u>normal! F)va(<CR>
onoremap ap{ :<c-u>normal! F}va{<CR>
onoremap ap" :<c-u>normal! F"va"<CR>
onoremap ap' :<c-u>normal! F'va'<CR>
onoremap ap` :<c-u>normal! F`va`<CR>
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
" place ''~/.nvimrc''
" vim: nowrap: