forked from omerdagan84/myrcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
281 lines (242 loc) · 7.13 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
set shell=/bin/bash
" not-compatible mode - allow for VIM enhencments
set nocp
execute pathogen#infect()
" Vundle setup
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Bundle 'Valloric/YouCompleteMe'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
call vundle#end()
filetype plugin indent on
let python_highlight_all=1
syntax on
" set color scheme of editor
colorscheme monokai
" allow for autocompletion of commands
set wildmenu
" show command in last line of screen inclding the # of charecters and lines
set showcmd
syn on se title
"set the tab to be 4-space
set tabstop=4
set softtabstop=4
"when using auto-indent sets the TAB size
set shiftwidth=4
set noexpandtab
set hlsearch
set smarttab
" #set incsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
"set autoindent
set nostartofline
set ruler
set laststatus=2
set showmatch
set matchtime=5
au BufNewFile,BufRead *.py
\ set tabstop=4|
\ set softtabstop=4|
\ set shiftwidth=4|
\ set textwidth=79|
\ set expandtab|
\ set autoindent|
\ set fileformat=unix|
" if has('mouse')
" set mouse=a " all mode
" set mousehide " hide mouse when typing
" endif
set cmdheight=2
set nu
"set textwidth=80
" My mappings
map <C-n> :NERDTreeToggle<CR>
" Back and forward in tags
map <M-Left> <C-T>
map <M-Right> <C-]>
map <F8> :TlistToggle<CR>
map <F9> :Hexmode<CR>
noremap <leader>st :SyntasticToggleMode<CR>
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
"
"
"let g:airline_powerline_fonts = 1
" Automatic tag loading
set tags=./tags;/
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
set cscopeverbose
endif
endfunction
au BufEnter /* call LoadCscope()
let NERDTreeIgnore=['\.pyc$', '\~$']
" ----------------------------------------
" Enhanced commentify binding and settings
" ----------------------------------------
let g:EnhCommentifyFirstLineMode='yes'
let g:EnhCommentifyRespectIndent='yes'
let g:EnhCommentifyUseBlockIndent='yes'
let g:EnhCommentifyAlignRight = 'yes'
let g:EnhCommentifyPretty = 'yes'
let g:EnhCommentifyBindInNormal = 'no'
let g:EnhCommentifyBindInVisual = 'no'
let g:EnhCommentifyBindInInsert = 'no'
" -----------------------------------------
" Default size for NerdTree and Taglist
" -----------------------------------------
let g:NERDTreeWinSize=50
let g:Tlist_WinWidth=50
" -----------------------------------------
" Snippets mapping
" -----------------------------------------
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
" ------------------
" YCM Configuration
" ------------------
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'qf' : 1,
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'unite' : 1,
\ 'text' : 1,
\ 'vimwiki' : 1,
\ 'pandoc' : 1,
\ 'tree' : 1,
\ 'mail' : 1
\}
" -------------------------------------------
" Make YCM and Ultisnips work together nicely
" -------------------------------------------
"let g:ycm_key_list_select_completion=[]
"let g:ycm_key_list_previous_completion=[]
"let g:ycm_key_list_select_completion = ["<C-TAB>","<Down>"]
"let g:ycm_key_list_previous_completion = ["<C-S-TAB>", "<Up>"]
"let g:SuperTabDefaultCompletionType = "<C-Tab>"
let g:ycm_key_list_select_completion = ['<C-TAB>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-S-TAB>','<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabContextDefaultCompletionType = "<c-n>"
" NOTE: VisualComment,Comment,DeComment are plugin mapping(start with <Plug>),
" so can't use remap here
vmap <unique> <F10> <Plug>VisualComment
nmap <unique> <F10> <Plug>Comment
imap <unique> <F10> <ESC><Plug>Comment
vmap <unique> <C-F10> <Plug>VisualDeComment
nmap <unique> <C-F10> <Plug>DeComment
imap <unique> <C-F10> <ESC><Plug>DeComment
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
" Hex file adding functionality
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ex command for toggling hex mode - define mapping if desired
command -bar Hexmode call ToggleHex()
" helper function to toggle hex mode
function ToggleHex()
" hex mode should be considered a read-only operation
" save values for modified and read-only for restoration later,
" and clear the read-only flag for now
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
" save old options
let b:oldft=&ft
let b:oldbin=&bin
" set new options
setlocal binary " make sure it overrides any textwidth, etc.
silent :e " this will reload the file without trickeries
"(DOS line endings will be shown entirely )
let &ft="xxd"
" set status
let b:editHex=1
" switch to hex editor
%!xxd
else
" restore old options
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
" set status
let b:editHex=0
" return to normal editing
%!xxd -r
endif
" restore values for modified and read only state
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
"------------------
" Syntactic stuff
" -----------------
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
let g:syntastic_mode_map = { 'mode': 'passive' }
"--------------------------
" Remove trailing whitespace
" --------------------------
function RemoveTrailingWhitespace()
let b:curcol = col(".")
let b:curline = line(".")
silent! %s/\s\+$//
silent! %s/\(\s*\n\)\+\%$//
call cursor(b:curline, b:curcol)
endfunction
"-----------------------
" NerdTree customization
" ----------------------
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
let NERDTreeIgnore=['.*\.o$']
let NERDTreeIgnore+=['.*\.d$']
let NERDTreeIgnore+=['.*\~$']
let NERDTreeIgnore+=['.*\.out$']
let NERDTreeIgnore+=['.*\.so$', '.*\.a$']
" Quit with :Q
command -nargs=0 Quit :qa!
" Session plugin
let g:session_autosave='yes'
let g:session_autoload='yes'
"-----------------------
" Airline customization
" ----------------------
let g:airline_powerline_fonts = 1
"-----------------------
" Ctrl-p customization
" ----------------------
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Python stuff
nnoremap <silent> <F5> :!clear;python3.6 %<CR>
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
"set statusline="%f%m%r%h%w [%Y] [0x%02.2B]%< %F%=%4v,%4l %3p%% of %L"
call pathogen#helptags()