-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
363 lines (284 loc) · 10.1 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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
"this must be first, because it changes other options as a side effect.
set nocompatible " This setting prevents vim from emulating the original vi's bugs and limitations.
" add utf-8 support
set fileencodings=utf-8,latin2
set number
"set background=light
"syntax enable
"colorscheme SolarizedDark
"let g:solarized_termcolors=256
"
"" Clipboard Stuff
" always use system clipboard
set clipboard+=unnamedplus
" Mouse Stuff
" use mouse integration
set mouse=a
"let &runtimepath.=',~/.vim/bundle/ale'
set bs=2 " allow backspacing over everything in insert mode
set ai " always set autoindenting on
"set backup " keep a backup file
"set viminfo='20,\"50 " read/write a .viminfo file, don't store more than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set tabstop=2 " ts
set expandtab
set noet "automatically convert tab chars into spaces
set shiftwidth=2 " sw
set softtabstop=2 " sts
set expandtab " added 2012.03.20
set smarttab
set showmatch
set nowrapscan
set nowrap
set nohlsearch
set incsearch
set ignorecase
set nohlsearch
set noswapfile
set wmnu
set list
set iskeyword+=-
set lcs=tab:+-
set splitright
"set guifont=8x13bold
;
" Disable annoying beeping
:set noerrorbells
:set novisualbell
:set errorbells
if has('nvim')
nmap <BS> <C-W>h
endif
nmap <silent> ,/ :nohlsearch<CR> " clear highlighted searches instead of /asdf
xnoremap p pgvy
" Nerd Tree specific
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let g:ctrlp_dont_split = 'NERD_tree_2'
"" skip the c-w
nnoremap <C-j> <C-W><C-J>
nnoremap <C-k> <C-W><C-K>
nnoremap <C-l> <C-W><C-L>
nnoremap <C-h> <C-W><C-H>
nnoremap <c-j> <C-W><C-J>
nnoremap <c-k> <C-W><C-K>
nnoremap <c-l> <C-W><C-L>
nnoremap <c-h> <C-W><C-H>
"nnoremap :set paste! "avoid staircase affect when pasting mulitple lines
"nnoremap <F5> :set invpaste paste?<Enter>
map <F5> :set invpaste paste?<Enter>
imap <F5> <C-O><F5>
set pastetoggle=<F5> " hit F5 before and after pasting
nnoremap <F2> :NERDTreeToggle<CR>
imap cll console.log();<Esc>==f(a
vmap clc console.log('%c ', 'background: #222; color: #bada55');<Esc>==F%ela
" UPDATED 2010.08.05
set complete=.,w,b,u,t,i,k " keyword completion with CTRL-P or N
" :help options -> left off at line 2570
autocmd BufRead *.asp set smartindent cinwords=if,elsif,else,for,while,try,except,finally,sub,class,switch,case
autocmd BufRead *.htx set smartindent cinwords=if,elsif,else,for,while,try,except,finally,sub,class,switch,case
autocmd BufRead *.js set smartindent cinwords=if,else,for,while,try,except,finally,function,switch,case
autocmd BufRead *.pl set smartindent cinwords=if,elsif,else,for,while,try,except,finally,sub,class,switch,case
autocmd BufRead *.php set smartindent cinwords=if,elseif,else,for,while,try,except,finally,function,class,switch,case
autocmd BufRead *.phpx set smartindent cinwords=if,elseif,else,for,while,try,except,finally,function,class,switch,case
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
"Remove White space
autocmd BufWritePre *.py :%s/\s\+$//e
" / END UPDATED 2010.08.05
let g:ale_sign_error = '⚠'
let g:ale_sign_warning = '✗'
let g:ale_lint_on_text_changed = 'never'
" Eslint vs. Standard
" " " ----------------------------------------------------------------------------
function! CheckForEslintPkgJson() abort
let packagejsonpath = findfile('package.json', '.;')
if packagejsonpath !=# ''
let packagejson = join(readfile(packagejsonpath), '')
return has_key(JSON#parse(packagejson), 'eslintConfig')
else
return 0
endif
endfunction
function! CheckForEslint()
" @see: https://vimhelp.appspot.com/editing.txt.html#file-searching
let eslintconfig =
\ findfile('.eslintrc', '.;', -1) +
\ findfile('.eslintrc.js', '.;', -1) +
\ findfile('.eslintrc.json', '.;', -1) +
\ findfile('.eslintrc.yaml', '.;', -1) +
\ findfile('.eslintrc.yml', '.;', -1)
if len(eslintconfig) > 0
return 1
else
return CheckForEslintPkgJson()
endif
endfunction
if CheckForEslint()
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ }
else
let g:ale_linters = {
\ 'javascript': ['standard'],
\ }
endif
" Don't use Ex mode, use Q for formatting
map Q gq
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
"" Switch syntax highlighting on, when the terminal has colors
"" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" In text files, always limit the width of text to 78 characters
"autocmd BufRead *.txt set tw=78
augroup cprog
" Remove all cprog autocommands
au!
" When starting to edit a file:
" For C and C++ files set formatting of comments and set C-indenting on.
" For other files switch it off.
" Don't change the order, it's important that the line with * comes first.
autocmd FileType * set formatoptions=tcql nocindent comments&
autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
augroup END
augroup gzip
" Remove all gzip autocommands
au!
" Enable editing of gzipped files
" set binary mode before reading the file
autocmd BufReadPre,FileReadPre *.gz,*.bz2 set bin
autocmd BufReadPost,FileReadPost *.gz call GZIP_read("gunzip")
autocmd BufReadPost,FileReadPost *.bz2 call GZIP_read("bunzip2")
autocmd BufWritePost,FileWritePost *.gz call GZIP_write("gzip")
autocmd BufWritePost,FileWritePost *.bz2 call GZIP_write("bzip2")
autocmd FileAppendPre *.gz call GZIP_appre("gunzip")
autocmd FileAppendPre *.bz2 call GZIP_appre("bunzip2")
autocmd FileAppendPost *.gz call GZIP_write("gzip")
autocmd FileAppendPost *.bz2 call GZIP_write("bzip2")
" After reading compressed file: Uncompress text in buffer with "cmd"
fun! GZIP_read(cmd)
" set 'cmdheight' to two, to avoid the hit-return prompt
let ch_save = &ch
set ch=3
" when filtering the whole buffer, it will become empty
let empty = line("'[") == 1 && line("']") == line("$")
let tmp = tempname()
let tmpe = tmp . "." . expand("<afile>:e")
" write the just read lines to a temp file "'[,']w tmp.gz"
execute "'[,']w " . tmpe
" uncompress the temp file "!gunzip tmp.gz"
execute "!" . a:cmd . " " . tmpe
" delete the compressed lines
'[,']d
" read in the uncompressed lines "'[-1r tmp"
set nobin
execute "'[-1r " . tmp
" if buffer became empty, delete trailing blank line
if empty
normal Gdd''
endif
" delete the temp file
call delete(tmp)
let &ch = ch_save
" When uncompressed the whole buffer, do autocommands
if empty
execute ":doautocmd BufReadPost " . expand("%:r")
endfun
" After writing compressed file: Compress written file with "cmd"
fun! GZIP_write(cmd)
if rename(expand("<afile>"), expand("<afile>:r")) == 0
execute "!" . a:cmd . " <afile>:r"
endif
endfun
" Before appending to compressed file: Uncompress file with "cmd"
fun! GZIP_appre(cmd)
execute "!" . a:cmd . " <afile>"
call rename(expand("<afile>:r"), expand("<afile>"))
endfun
augroup END
" This is disabled, because it changes the jumplist. Can't use CTRL-O to go
" back to positions in previous files more than once.
if 0
" When editing a file, always jump to the last cursor position.
" This must be after the uncompress commands.
autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
endif
endif " has("autocmd")
au BufNewFile,BufRead *.php,*.php3,*.inc,*.module,*.info,*.install set ft=php
au BufNewFile,BufRead *.nqc,*.cpp,*.c,*.as set ft=cpp
au BufNewFile,BufRead *.cgi,*.plx,*.pl set ft=perl
au BufNewFile,BufRead *.scss set ft=scss
" MY ADDITIONS : 2008.12.11
" Shortcuts for moving between tabs.
" Alt-j to move to the tab to the left
noremap <A-j> gT
" Alt-k to move to the tab to the right
noremap <A-k> gt
" tComment
"map <leader>c <c-_><c-_>
" http://www.vim.org/scripts/script.php?script_id=2540
filetype off
filetype indent plugin on
" ---------------- Plugins
" ----------------
" ----------------
" ----------------
" ----------------
" ----------------
" ----------------
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'w0rp/ale'
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-fugitive'
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
let g:gist_clip_command = 'pbcopy'
let g:gist_show_privates = 1
Bundle 'pangloss/vim-javascript'
Bundle 'leshill/vim-json'
Bundle 'nono/vim-handlebars'
" Bundle 'othree/html5.vim'
" Includes scss/sass
Bundle 'tpope/vim-haml'
Bundle 'airblade/vim-gitgutter'
" Snipmate with dependancies
" Snippets are here : https://github.com/honza/vim-snippets
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/vim-snippets"
Bundle "garbas/vim-snipmate"
Bundle "justinmk/vim-sneak"
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'tpope/vim-vinegar'
autocmd vimenter * if !argc() | NERDTree | endif
Bundle 'maksimr/vim-jsbeautify'
Bundle 'einars/js-beautify'
" set path to js-beautify file
" let g:jsbeautify_file = fnameescape(fnamemodify(expand("<sfile>"),
" ":h")."/bundle/js-beautify/beautify.js")
" CtrlP File Finder
Bundle 'kien/ctrlp.vim'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " Linux/MacOSX
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|node_modules\|\node_modules\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
Bundle 'dracula/vim'
" All of your Plugins must be added before the following line
call vundle#end() " required