forked from tony/vim-config-framework
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
310 lines (243 loc) · 8.66 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
" http://stackoverflow.com/questions/9990219/vim-whats-the-difference-between-let-and-set
" Borrows from https://github.com/terryma/dotfiles/blob/master/.vimrc
" Borrows from https://github.com/klen/.vim
"" -------------------
" Look and Feel
" -------------------
let g:SESSION_DIR = $HOME.'/.cache/vim/sessions'
" Don't reset twice on reloading - 'compatible' has SO many side effects.
if !exists('s:loaded_my_vimrc')
source ~/.vim/bundles.vim
source ~/.vim/functions.vim
source ~/.vim/settings.vim
source ~/.vim/autocmd.vim
source ~/.vim/unite.vim
source ~/.vim/keymappings.vim
source ~/.vim/ignore.vim
endif
" from functions.vim
com! -nargs=0 SeeTab :call SeeTab()
" Spelling highlights. Use underline in term to prevent cursorline highlights
" from interfering
if !has("gui_running")
hi clear SpellBad
hi SpellBad cterm=underline ctermfg=red
hi clear SpellCap
hi SpellCap cterm=underline ctermfg=blue
hi clear SpellLocal
hi SpellLocal cterm=underline ctermfg=blue
hi clear SpellRare
hi SpellRare cterm=underline ctermfg=blue
endif
" Cursor settings. This makes terminal vim sooo much nicer!
" Tmux will only forward escape sequences to the terminal if surrounded by a DCS
" sequence
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
let g:tagbar_width = 35
"===============================================================================
"" NERDTree
"===============================================================================
" Close nerdtree on file open
let NERDTreeQuitOnOpen = 1
" Highlight the selected entry in the tree
let NERDTreeHighlightCursorline=1
let NERDTreeShowHidden=1
let NERDTreeHijackNetrw=0
" Use a single click to fold/unfold directories and a double click to open
" files
let NERDTreeMouseMode=2
" let NERDTreeIgnore
" See ignore.vim
" Awesome vim {{{
" based off http://stackoverflow.com/questions/7135985/detecting-split-window-dimensions
" command! SplitWindow call s:SplitWindow()
" function! s:SplitWindow()
" let l:height=winheight(0) * 2
" let l:width=winwidth(0)
" if (l:height > l:width)
" :split
" else
" :vsplit
" endif
" endfunction
" " based off http://stackoverflow.com/questions/7135985/detecting-split-window-dimensions
" command! ChangeLayout call s:ChangeLayout()
" function! s:ChangeLayout()
" let l:height=winheight(0) * 2
" let l:width=winwidth(0)
" if (l:height > l:width)
" <C-w> <C-H>
" else
" <C-w> <C-J>
" endif
" endfunction
" JS Beautify options
" let g:jsbeautify = {'indent_size': 2, 'indent_char': ' '}
" let g:htmlbeautify = {'indent_size': 2, 'indent_char': ' ', 'max_char': 78, 'brace_style': 'expand', 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u', '%', '%=', '?', '?=']}
" let g:cssbeautify = {'indent_size': 2, 'indent_char': ' '}
let g:indentLine_color_term = 239
" Set path to js-beautify file
" let s:rootDir = fnamemodify(expand("<sfile>"), ":h")
" let g:jsbeautify_file = fnameescape(s:rootDir."/.vim/vendor/js-beautify.git/beautify.js")
" let g:htmlbeautify_file = fnameescape(s:rootDir."/.vim/vendor/js-beautify.git/beautify-html.js")
" let g:cssbeautify_file = fnameescape(s:rootDir."/.vim/vendor/js-beautify.git/beautify-css.js")
" expand("$HOME/.vim/ may work")
" }}}
"===============================================================================
" Vimfiler
"===============================================================================
" TODO Look into Vimfiler more
" Example at: https://github.com/hrsh7th/dotfiles/blob/master/vim/.vimrc
let g:vimfiler_as_default_explorer = 1
let g:vimfiler_tree_leaf_icon = ' '
let g:vimfiler_tree_opened_icon = '▾'
let g:vimfiler_tree_closed_icon = '▸'
let g:vimfiler_file_icon = '-'
let g:vimfiler_marked_file_icon = '✓'
" let g:vimfiler_readonly_file_icon = ' '
let g:my_vimfiler_explorer_name = 'explorer'
let g:my_vimfiler_winwidth = 30
let g:vimfiler_safe_mode_by_default = 1
let g:vimfiler_directory_display_top = 1
let g:vimfiler_force_overwrite_statusline = 0
" let g:vimfiler_ignore_pattern
" See ignore.vim
autocmd MyAutoCmd FileType vimfiler call s:vimfiler_settings()
function! s:vimfiler_settings()
nmap <buffer><expr><CR> vimfiler#smart_cursor_map("\<PLUG>(vimfiler_expand_tree)", "e")
nunmap <buffer> N
" Traversal
nnoremap <buffer> <C-h> <C-w>h
nnoremap <buffer> <C-j> <C-w>j
nnoremap <buffer> <C-k> <C-w>k
nnoremap <buffer> <C-l> <C-w>l
" nnoremap <C-c> :close<CR>
endfunction
"===============================================================================
" VimShell
"===============================================================================
let g:vimshell_prompt = "% "
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")'
autocmd MyAutoCmd FileType vimshell call s:vimshell_settings()
function! s:vimshell_settings()
call vimshell#altercmd#define('g', 'git')
endfunction
"===============================================================================
" Local Settings
"===============================================================================
try
source ~/.vimrc.local
catch
endtry
" let g:netrw_hide=1
" let g:netrw_list_hide=
" See ignore.vim
" Enable filetype detection
"filetype on
"filetype plugin indent on
let g:NERDCustomDelimiters = {
\ 'sls': { 'left': '#' },
\ }
if !exists('s:loaded_my_vimrc')
let s:loaded_my_vimrc = 1
endif
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
" Execute 'cmd' while redirecting output.
" Delete all lines that do not match regex 'filter' (if not empty).
" Delete any blank lines.
" Delete '<whitespace><number>:<whitespace>' from start of each line.
" Display result in a scratch buffer.
function! s:Filter_lines(cmd, filter)
let save_more = &more
set nomore
redir => lines
silent execute a:cmd
redir END
let &more = save_more
new
setlocal buftype=nofile bufhidden=hide noswapfile
put =lines
g/^\s*$/d
%s/^\s*\d\+:\s*//e
if !empty(a:filter)
execute 'v/' . a:filter . '/d'
endif
0
endfunction
command! -nargs=? Scriptnames call s:Filter_lines('scriptnames', <q-args>
"source ~/.vim/neocompleterc.vim
"{{{2 latex
let g:latex_enabled = 1
let g:latex_viewer = 'mupdf -r 95'
let g:latex_default_mappings = 1
let g:LatexBox_latexmk_async = 1
let g:LatexBox_latexmk_preview_continuously = 1
let g:LatexBox_Folding = 1
let g:LatexBox_viewer = 'mupdf -r 95'
let g:LatexBox_quickfix = 2
let g:LatexBox_split_resize = 1
let g:LatexBox_latexmk_options
\ = "-pdflatex='pdflatex -synctex=1 \%O \%S'"
"au CursorHoldI * stopinsert " go back into normal mode in 4 seconds
let g:riv_auto_format_table = 0
let g:airline_powerline_fonts = 1
" Or instead of gggqG, use <Visual>gq to format only the highlighted lines
" (i.e. gq after using shift-v + cursor moves to set up a linewise visual
" area).
" https://groups.google.com/d/msg/vim_use/XzObYsZpUrQ/svirOL-N0DUJ
let g:pymode_virtualenv=1 " Auto fix vim python paths if virtualenv enabled
let g:pymode_folding=1 " Enable python folding
let g:pymode_rope = 0
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
\ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
let g:jedi#use_tabs_not_buffers = 0
let g:jedi#use_splits_not_buffers = "left"
let g:jedi#documentation_command = "<leader>k"
let g:jedi#usages_command = "<leader>u"
let g:SuperTabLongestHighlight = 0
" https://github.com/davidhalter/jedi-vim/issues/179
let g:jedi#popup_select_first = 0
let g:jedi#auto_vim_configuration = 1
" au FileType python setlocal completeopt-=preview " The reason to deactivate jedi#auto_vim_configuration
let g:ycm_confirm_extra_conf = 0
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_filetype_blacklist =
\ get( g:, 'ycm_filetype_blacklist',
\ get( g:, 'ycm_filetypes_to_completely_ignore', {
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'text' : 1,
\ 'unite' : 1,
\ } ) )
source ~/.vim/colors.vim
if $TMUX == ''
set clipboard+=unnamed
endif
set foldlevelstart=0
function! g:UltiSnips_Complete()
call UltiSnips_ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips_JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsListSnippets="<c-e>"