/
vimrc_fancy
289 lines (257 loc) · 8.51 KB
/
vimrc_fancy
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
" File: .vimrc
" Version: 4
" Author: Jacob Reinhold
" use Vim settings
" set nocompatible
" filetype off
"
" set rtp+=~/.vim/bundle/vundle/
" call vundle#begin()
"
" Bundle 'gmarik/vundle'
" Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim'}
" Bundle 'tpope/vim-fugitive'
" Bundle 'scrooloose/nerdtree'
" Bundle 'klen/python-mode'
" Bundle 'rizzatti/dash.vim'
" "Bundle 'xuhdev/vim-latex-live-preview'
" "Bundle 'Raimondi/delimitMate'
" Bundle 'jiangmiao/auto-pairs'
" Bundle 'kien/rainbow_parentheses.vim'
" Bundle 'Shougo/neocomplete.vim'
" Bundle 'Shougo/neoyank.vim'
" Bundle 'Shougo/unite.vim'
" Bundle 'rstacruz/vim-fastunite'
" Bundle 'ervandew/supertab'
" Bundle 'Konfekt/FastFold'
" Bundle 'Sirver/ultisnips'
" Bundle 'honza/vim-snippets'
" Bundle 'reedes/vim-pencil'
" Bundle 'davidhalter/jedi-vim'
" Bundle 'gi1242/vim-tex-autoclose'
"
" " Better vim navigation.
" Bundle 'kshenoy/vim-signature'
" Bundle 'tpope/vim-surround'
" Bundle 'tpope/vim-commentary'
" call vundle#end()
" filetype plugin indent on
syntax on
" indenting settings
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
"set autoindent
" show line number
set number
" show cmd in bottom bar
set showcmd
" highlight current line
set cursorline
" select when using mouse
set selectmode=mouse
" backup
set backup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backupskip=/tmp/*,/private/tmp/*
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set writebackup
set t_Co=256
" disk write settings
" set updatetime=2000
" folding
set foldenable
set foldlevelstart=10
set foldnestmax=10
nnoremap <space> za
set foldmethod=indent
" display current mode
set showmode
" allow backspacing in insert
set backspace=indent,eol,start
" silent
set noerrorbells
" remap ;; to escape
" inoremap ;; <Esc>
" remap \pp to latex live-preview
" nmap \pp :LLPStartPreview<CR>
" keep old command because use to it
"nmap \pp :silent execute "!latexmk -lualatex -quiet % && latexmk -c -quiet" \| :redraw!<CR>
nmap \pp :silent execute "!latexmk -lualatex -latexoption='--shell-escape' %" \| :redraw!<CR>
" Searching
set incsearch
set hlsearch
" This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>
" ignore case in search
set ignorecase
" word wrap default off
set nowrap
" show matching part for [] {} ()
set showmatch
"" enable all Python syntax highlighting features
" let python_highlight_all = 1
"
" line width restriction (highlight past col 120)
augroup vimrc_autocmds
autocmd!
autocmd FileType python highlight Excess ctermbg=Blue guibg=Blue
autocmd FileType python match Excess /\%120v.*/
autocmd FileType python set nowrap
augroup END
"Python-mode
" Activate rope
" Keys:
" K Show python docs
" <Ctrl-Space> Rope autocomplete
" <Ctrl-c>g Rope goto definition
" <Ctrl-c>d Rope show documentation
" <Ctrl-c>f Rope find occurrences
" <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
" [[ Jump on previous class or function (normal, visual, operator modes)
" ]] Jump on next class or function (normal, visual, operator modes)
" [M Jump on previous class or method (normal, visual, operator modes)
" ]M Jump on next class or method (normal, visual, operator modes)
" let g:pymode_rope = 1
"
"" Documentation
" let g:pymode_doc = 1
" let g:pymode_doc_key = 'K'
"
"" Linting
" let g:pymode_lint = 1
" let g:pymode_lint_checker = "pyflakes,pep8"
"" Auto check on save
" let g:pymode_lint_write = 1
"
"" Support virtualenv
" let g:pymode_virtualenv = 1
"
"" Enable breakpoints plugin
" let g:pymode_breakpoint = 1
" let g:pymode_breakpoint_bind = '<leader>b'
"
"" syntax highlighting
" let g:pymode_syntax = 1
" let g:pymode_syntax_all = 1
" let g:pymode_syntax_indent_errors = g:pymode_syntax_all
" let g:pymode_syntax_space_errors = g:pymode_syntax_all
"
"" Don't autofold code
" let g:pymode_folding = 0
"
"" nerdtree setup
" nmap <F2> :NERDTreeToggle<CR>
"
"" powerline setup
" set guifont=Inconsolata\ for\ Powerline\:h15
" set laststatus=2
let g:tex_flavor = "latex"
" latex live preview
" let g:livepreview_previewer = 'open -a Preview'
" let g:Tex_DefaultTargetFormat='pdf'
" let g:Tex_MultipleCompileFormats='pdf'
" let g:UltiSnipsUsePythonVersion = 3
" "let g:UltiSnipsSnippetsDir = "~/.vim/UltiSnips"
"" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
" let g:UltiSnipsExpandTrigger="<tab>"
" let g:UltiSnipsJumpForwardTrigger="<CR>"
" let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"
"" NeoComplete bindings.
"let g:neocomplete#enable_at_startup = 1
"let g:neocomplete#enable_smart_case = 1
"let g:neocomplete#sources#syntax#min_keyword_length = 3
"
"" Define Dictionary.
"let g:neocomplete#sources#dictionary#dictionaries = {
" \ 'default': '',
" \ }
"
"" Tab completion.
"" Plugin key-mappings.
"inoremap <expr><C-g> neocomplete#undo_completion()
"inoremap <expr><C-l> neocomplete#complete_common_string()
"" Recommended key-mappings.
"" <CR>: close popup and save indent.
"inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
"function! s:my_cr_function()
" return neocomplete#close_popup() . "\<CR>"
" " For no inserting <CR> key.
" return pumvisible() ? neocomplete#close_popup() : "\<CR>"
" endfunction
"" <TAB>: completion.
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"" <C-h>, <BS>: close popup and delete backword char.
"inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
"inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
"inoremap <expr><C-y> neocomplete#close_popup()
"inoremap <expr><C-e> neocomplete#cancel_popup()
"" Close popup by <Space>.
"inoremap <expr><CR> pumvisible() ? neocomplete#close_popup() :"\<CR>"
"
"" Omnicompletion.
"if !exists('g:neocomplete#force_omni_input_patterns')
" let g:neocomplete#force_omni_input_patterns = {}
"endif
"autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
"autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
"autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType python setlocal omnifunc=jedi#completions
"let g:jedi#completions_enabled = 0
"let g:jedi#auto_vim_configuration = 0
"let g:jedi#popup_on_dot = 0
"let g:neocomplete#force_omni_input_patterns.python =
"\ '\%([^. \t]\.\|^\s*@\|^\s*from\s.\+import \|^\s*from \|^\s*import \)\w*'
"
"" Enable heavy omni completion.
"if !exists('g:neocomplete#sources#omni#input_patterns')
" let g:neocomplete#sources#omni#input_patterns = {}
"endif
"
"" }}}
"
"augroup pencil
" autocmd!
" autocmd FileType markdown,mkd call pencil#init()
"augroup END
au Filetype python setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80
" syntax highlighting for odd extensions
au BufNewFile,BufRead *.cls set filetype=tex
au Filetype plaintex,tex,latex setlocal tabstop=2 softtabstop=2 shiftwidth=2 textwidth=80
" rainbowparens
"au VimEnter * RainbowParenthesesToggle
"au Syntax * RainbowParenthesesLoadRound
"au Syntax * RainbowParenthesesLoadSquare
"au Syntax * RainbowParenthesesLoadBraces
"
"" Unite bindings.
"nnoremap <C-p> :Unite file_rec/async -start-insert -no-split<CR>
"nnoremap <space>/ :Unite grep:. -no-split<CR>
"nnoremap <C-y> :Unite history/yank<CR> " masks scroll up motion.
"nnoremap <C-e> :Unite -quick-match buffer -no-split<CR>
"" Custom mappings for the unite buffer
"autocmd FileType unite call s:unite_settings()
"function! s:unite_settings()
" " Play nice with supertab
" let b:SuperTabDisabled=1
" " Enable navigation with control-j and control-k in insert mode
" imap <buffer> <C-j> <Plug>(unite_select_next_line)
" imap <buffer> <C-k> <Plug>(unite_select_previous_line)
"endfunction
"
"" supertab direction fixes
"let g:SuperTabDefaultCompletionType = "<c-n>"
" emphasize current splits.
set colorcolumn=81 cul " on startup, since below is on WinEnter.
augroup BgHighlight
autocmd!
autocmd WinEnter * set colorcolumn=81 cul
autocmd WinLeave * set colorcolumn=0 nocul
augroup END
" still need 256 colors, assumes black background
highlight ColorColumn ctermbg=DarkGray" Grey7
"highlight CursorLine ctermbg=DarkGray" Grey7
" Setting mark column color.
highlight SignColumn ctermbg=0