-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
280 lines (234 loc) · 6.43 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
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'chemzqm/vim-jsx-improve'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'w0rp/ale'
Plug 'rhysd/devdocs.vim'
Plug 'ton/vim-bufsurf'
Plug 'scrooloose/nerdcommenter'
Plug 'christoomey/vim-tmux-navigator'
Plug 'easymotion/vim-easymotion'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'flowtype/vim-flow'
Plug 'terryma/vim-smooth-scroll'
" Snippets
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
" Color Schemes
Plug 'altercation/vim-colors-solarized'
Plug 'robertmeta/nofrils'
Plug 'https://bitbucket.org/kisom/eink.vim.git'
Plug 'xero/blaquemagick.vim'
Plug 'beigebrucewayne/skull-vim'
Plug 'wolverian/minimal'
Plug 'elmindreda/vimcolors'
Plug 'MidnaPeach/neonwave.vim'
Plug 'vim-scripts/ibmedit.vim'
Plug 'vim-scripts/Shades-of-Amber'
Plug 'dgraham/xcode-low-key-vim'
Plug 'vim-scripts/mayansmoke'
"Clojure dev
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'guns/vim-clojure-static', { 'for': 'clojure' }
"PHP
Plug '2072/PHP-Indenting-for-VIm'
Plug 'StanAngeloff/php.vim'
" Initialize plugin system
call plug#end()
let mapleader = "\<Space>"
imap jk <Esc>
imap kj <Esc>
nmap gq :ALEFix<CR>
nnoremap <Leader>w :w<CR>
" TYPO FIX
map q: :q
" Copy file path
nmap cp :let @" = expand("%")<CR>
set tm=900
" set relativenumber
set smartindent
set nu
set guioptions=
set mouse=a
set ttyfast
set lazyredraw
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set number
set relativenumber
set hidden
set backupcopy=yes
" set synmaxcol=120
" if has("gui_macvim")
" set guifont=InputMono\ Light:h14
" set linespace=3
" else
" set guifont=Input\ Mono\ Light\ 12
" set linespace=1
" endif
"
if has("gui_running")
if has("gui_gtk2") || has("gui_gtk3")
set guifont=Input\ Mono\ 11
elseif has("gui_photon")
set guifont=Input\ Mono:s11
elseif has("x11")
set guifont=-*-liberation\ mono-bold-*-*-*-*-*-*-*-*-*-*-*
else
set guifont=Input_Mono:h11:cDEFAULT
endif
endif
" Nofril
let g:nofrils_heavylinenumbers=1
let g:nofrils_strbackgrounds=1
syntax enable
if &diff
set background=light
colorscheme xcode-low-key
else
set background=dark
colorscheme mayansmoke
endif
" highlight Cursor guifg=white guibg=black
" hi Search guibg=black guifg=yellow
hi Search guibg=yellow guifg=black
hi Search cterm=NONE ctermfg=black ctermbg=yellow
let g:vim_markdown_folding_disabled = 1
" ----------- BUFFERS ----------- "
nmap <Leader>l :BufSurfForward<cr>
nmap <Leader>h :BufSurfBack<cr>
if bufwinnr(1)
map + <C-W>+
map - <C-W>-
map <c-n> <c-w>5<
map <c-m> <c-w>5>
endif
nmap <Leader>b :ls<cr> :b<space>
" ----------- FILE TYPES ------- "
au BufNewFile,BufRead *.ejs set filetype=javascript
au FileType php setl sw=4 ts=4 et
let php_html_load=0
let php_html_in_heredoc=0
let php_html_in_nowdoc=0
let php_sql_query=0
let php_sql_heredoc=0
let php_sql_nowdoc=0
au FileType javascript setl sw=4 sts=4 et
" ----------- SEARCH ----------- "
set wildignore+=**/node_modules/*
nmap <Leader>s :grep -r --ignore-dir node_modules --ignore-dir vendor --ignore-dir php-app/fc/cdn_js/out --vimgrep --ignore tags "" ./<left><left><left><left>
set hlsearch
" ---------- FLOW ---------- "
" Vim Flow
let g:flow#enable = 0
"Use locally installed flow
let local_flow = finddir('node_modules', '../') . '/.bin/flow'
if executable(local_flow)
let g:flow#flowpath = local_flow
endif
" DEVDOCS
nmap K <Plug>(devdocs-under-cursor)
" NERDCommenter
let g:NERDSpaceDelims = 1
map <Leader>/ <Leader>c<Leader>
" ------------- Smooth Scrolling ------------
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 16)<CR>
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 16)<CR>
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 16)<CR>
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 16)<CR>
let g:jsx_ext_required = 0
let g:javascript_plugin_jsdoc = 1
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_path_nolim = 1
let g:ctrlp_working_path_mode = 0
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
" vp doesn't replace paste buffer
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
vmap <silent> <expr> p <sid>Repl()
" ALE
filetype off
let &runtimepath.=',~/.vim/bundle/ale'
filetype plugin indent on
let g:ale_fixers = {
\ 'javascript': [
\ 'eslint'
\ ],
\ 'php': [
\ 'php_cs_fixer'
\ ]
\}
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_delay = 500
" let g:ale_javascript_eslint_options = '-c ../.eslintrc'
let g:ale_statusline_format = ['X %d', '? %d', '']
let g:ale_echo_msg_format = '%linter% says %s'
nnoremap gan :ALENextWrap<cr>
nnoremap gap :ALEPreviousWrap<cr>
" Hack fix enter being bound wrong
nnoremap <cr> <cr>
function! HlIndent()
let currLine = getline('.')
let matchs = matchstrpos(currLine, '^\(\s\+\)')
let regex = '^\s\{' . matchs[2] . '}'
execute 'normal! /' . regex . '<CR>'
endfunction
function! LineWidth()
execute("vertical resize " . (strlen(getline(".")) + 20))
endfunction
nmap gl :call LineWidth()<cr>
nmap <Leader>r :%s //g<left><left>
nmap gno :NERDTreeToggle<cr>
nmap gnf :NERDTreeFind<cr>
function! FlowGen()
execute("!glow gen-flow-files % > %:p:h/../lib/%:t.flow 2> flowlog.txt")
endfunction
function! Wipeout()
" list of *all* buffer numbers
let l:buffers = range(1, bufnr('$'))
" what tab page are we in?
let l:currentTab = tabpagenr()
try
" go through all tab pages
let l:tab = 0
while l:tab < tabpagenr('$')
let l:tab += 1
" go through all windows
let l:win = 0
while l:win < winnr('$')
let l:win += 1
" whatever buffer is in this window in this tab, remove it from
" l:buffers list
let l:thisbuf = winbufnr(l:win)
call remove(l:buffers, index(l:buffers, l:thisbuf))
endwhile
endwhile
" if there are any buffers left, delete them
if len(l:buffers)
execute 'bwipeout' join(l:buffers)
endif
finally
" go back to our original tab page
execute 'tabnext' l:currentTab
endtry
endfunction