This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvimrc
250 lines (215 loc) · 6.12 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
call plug#begin('~/.vim/plugins')
" Utilities
Plug 'bling/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'Lokaltog/vim-easymotion'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
Plug 'Shougo/vimproc.vim'
Plug 'bronson/vim-trailing-whitespace'
Plug 'ryanoasis/vim-devicons'
Plug 'wincent/ferret'
Plug 'docteurklein/php-getter-setter.vim'
Plug 'schickling/vim-bufonly'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'ervandew/supertab'
Plug 'tpope/vim-surround'
Plug 'Raimondi/delimitMate'
Plug 'gcmt/taboo.vim'
" NeoVim wraps sensible by default
if !has('nvim')
Plug 'tpope/vim-sensible'
endif
" Auto-completion
if has('nvim')
Plug 'Shougo/deoplete.nvim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
else
Plug 'Shougo/neocomplete.vim'
Plug 'ctrlpvim/ctrlp.vim', { 'on': 'CtrlPCurWD' }
endif
" Color schemes
Plug 'morhetz/gruvbox'
" Syntax highlight
Plug 'StanAngeloff/php.vim', { 'for': 'php' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'elzr/vim-json', { 'for': 'json' }
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'lunaru/vim-less', { 'for': 'less' }
call plug#end()
syntax on
filetype plugin indent on
" }}}
" Basic configuration {{{
set nowrap
set number
set hidden
set nocursorline
set lazyredraw
set novisualbell
set showtabline=2
set nobackup noswapfile
set synmaxcol=120 cc=100
set completeopt=longest,menuone
set expandtab tabstop=4 softtabstop=4 shiftwidth=4
set wildignore+=*/.git/*,*/node_modules/*,*/.sass-cache/*,*/vendor/*
if !has('nvim')
set autoread
set scrolljump=25
set backspace=indent,eol,start
set hlsearch incsearch
set wildmenu
else
set relativenumber
endif
if has("unix")
set shell=/bin/bash
endif
" }}}
" Graphical User Interface configuration {{{
if has("gui_running")
" Remove all toolbars and scroll bars
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
" Set default lines and columns
set lines=50 columns=98
" Detect unix operating system
if has("unix")
" Retrieve the operating system name
let s:uname = system("uname -s")
" Set font according to system
if s:uname == "Darwin"
set guifont=Monaco\ for\ Powerline\ Plus\ Nerd\ File\ Types:h13
else
set guifont=Monaco\ for\ Powerline\ Plus\ Nerd\ File\ Types:h13
endif
endif
endif
" }}}
" Reset leader key to comma
let mapleader=","
let maplocalleader="\\"
" Color scheme configuration
set t_Co=256
set background=dark
colorscheme gruvbox
" Map vimrc files edition
map <leader>ev :e $MYVIMRC<cr>
map <leader>eg :e $MYGVIMRC<cr>
map <leader>sv :source $MYVIMRC<cr>
map <leader>sg :source $MYGVIMRC<cr>
" Remap shift on homerow
map H ^
map L $
map J G
map K gg
" Tab configuration
nnoremap th :tabprev<CR>
nnoremap tl :tabnext<CR>
nnoremap tn :tabnew<CR>
" Airline configuration
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
" Gotta stop cheating (disabled arrow mapping for my own good)
noremap <Up> <nop>
noremap <Left> <nop>
noremap <Down> <nop>
noremap <Right> <nop>
inoremap <Up> <nop>
inoremap <Left> <nop>
inoremap <Down> <nop>
inoremap <Right> <nop>
" Map to remove search highlight
map <leader><esc> :nohlsearch<cr>
" EasyMotion configuration
let g:EasyMotion_leader_key = '<Leader>'
" SuperTab configuration
let g:SuperTabDefaultCompletionType = "<c-n>"
" Neocomplete/Deoplete configuration
if has('nvim')
let g:deoplete#enable_at_startup = 1
else
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#min_keyword_length = 3
endif
"" FZF configuration
if has('nvim')
let g:fzf_action = { 'enter': 'tab split' }
let g:fzf_height = '25%'
endif
" CtrlP configuration
if has('nvim')
map <leader>t :FZF --reverse<cr>
else
map <leader>t :CtrlPCurWD<cr>
if has("unix")
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
endif
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': [],
\ 'AcceptSelection("t")': ['<cr>', '<c-m>'],
\ }
endif
" Fugitive configuration
map <leader>ga :silent Git add %<cr>
map <leader>gw :Gwrite<cr>
map <leader>gs :Gstatus<cr>
map <leadeR>gc :Gcommit<cr>
map <leader>gd :Gdiff<cr>
map <leader>gp :Gpull<cr>
map <leader>gg :Gpush<cr>
map <leader>gm :Git mergetool<cr>
" Syntastic configuration
let g:syntastic_enable_balloons = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_error_symbol = '❗️'
let g:syntastic_warning_symbol = '🔸'
" GitGutter configuration
let g:gitgutter_sign_modified_removed = '*'
hi GitGutterAdd guibg=#282828 ctermbg=237 guifg=#b8bb26 ctermfg=142
hi GitGutterChange guibg=#282828 ctermbg=237 guifg=#8ec07c ctermfg=108
hi GitGutterDelete guibg=#282828 ctermbg=237 guifg=#fb4934 ctermfg=167
hi GitGutterChangeDelete guibg=#282828 ctermbg=237 guifg=#8ec07c ctermfg=108
autocmd BufEnter * execute 'GitGutterAll'
autocmd BufEnter * sign define DefaultColumnSign
autocmd BufEnter * execute 'sign place 9999 line=1 name=DefaultColumnSign buffer=' . bufnr('')
" NERDCommenter configuration
map <leader>c :NERDComToggleComment<cr>
" Erase trailing line at the end of file
autocmd BufWritePre *.php,*.py,*.js,*.css,*.txt,*.md,*.rb :call <SID>StripEOFLines()
function! <SID>StripEOFLines()
let _s=@/
let l = line(".")
let c = col(".")
%s/\($\n\s*\)\+\%$//e
let @/=_s
call cursor(l, c)
endfunction
" Lazy var dumps
nmap <leader>v ivar_dump(); die;<esc>6hi
imap <leader>v var_dump(); die;<esc>6hi
" Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
" Remove mouse support
:set mouse=