-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
276 lines (207 loc) · 7.75 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" @copyright: Enrique Paredes
" @licensing:
" <MIT License>http://www.opensource.org/licenses/mit-license.php
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
filetype off
" Autoinstall vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plug')
Plug 'Lokaltog/vim-easymotion'
Plug 'tpope/vim-surround'
" Plug 'Shougo/neocomplete.vim'
" Make Vim play nicely with iTerm 2 and tmux
" Plug 'akracun/vitality.vim'
Plug 'chase/vim-ansible-yaml'
" Handles bracketed-paste-mode in vim (aka. automatic `:set paste`)
Plug 'ConradIrwin/vim-bracketed-paste'
" Plug 'davidhalter/jedi-vim'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
let g:go_fmt_command = "goimports"
autocmd FileType go nmap <leader>t <Plug>(go-test)
autocmd FileType go nmap <leader>b <Plug>(go-build)
autocmd FileType go nmap <leader>r <Plug>(go-run)
Plug 'joeytwiddle/vim-multiple-cursors'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
nmap <C-p> :FZF --reverse --inline-info<cr>
Plug 'mattn/emmet-vim'
" Plug 'majutsushi/tagbar'
" map <leader>m :TagbarToggle<CR>
Plug 'rking/ag.vim'
Plug 'sheerun/vim-polyglot'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'bling/vim-airline'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#left_sep = ''
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_powerline_fonts=1
let g:bufferline_echo=0
Plug 'godlygeek/tabular'
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
Plug 'Shougo/vimfiler.vim'
let g:vimfiler_as_defaut_explorer = 1
let g:vimfiler_safe_mode_by_default = 0
map - :VimFiler<cr>
Plug 'Shougo/Unite.vim'
Plug 'w0rp/ale'
let g:ale_sign_error = '▸'
let g:ale_sign_warning = '⚠'
let g:airline#extensions#ale#enabled = 1
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'go': ['gofmt', 'goimports']
\}
let g:ale_linters = {
\ 'python': ['flake8'],
\ 'go': ['golangci-lint']
\}
call plug#end()
filetype plugin indent on
" EOF Plug conf
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sane Defaults FTW!
syntax enable
set shortmess+=I
set autoread " Update when changed from outside
set autowriteall " Writes on file change
set autoindent " Indenting options
set smartindent
set ruler " always show the cursor position
set ts=4 sts=4 sw=4 expandtab " Default tab flavour
set smarttab
set laststatus=2 " Always show status in bar
set nowrap
set backspace=indent,eol,start " Normalize backspacing between os
" set mouse=a " Mouse Configuration
" set mousefocus
colorscheme Tomorrow-Night-Eighties
set colorcolumn=120,80
match ErrorMsg '\%<131v.\%>130v'
set t_Co=256 " Coloring Options
set background=dark
hi Normal ctermbg=None
hi NonText ctermbg=None
set encoding=utf-8
set scrolloff=5
set sidescrolloff=5
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set nocursorline
set ttyfast
set number
set relativenumber
set nomodeline " disable commands inside files
set modelines=0
set ttimeout " Set time to check commands
set ttimeoutlen=100
set incsearch " Search Options
set smartcase
set display+=lastline
set foldmethod=indent
set foldnestmax=3
set foldlevel=99
set ofu=syntaxcomplete#Complete " Onmi Completion options
" set complete-=i " disable onmi to search in current path
set hlsearch " Highlight search things
set wildignore=*.obj,*.exe,*.pyc,*.pyo,*.pyx,*.*~,*.sw*,node_modules,bower_components,coverage,__pycache__
set list
set listchars=tab:▸\ ,eol:¬,nbsp:⍽ " Use the nice symbols for tabstops and EOL
" set visualbell
" set errorbells
set undofile " Persistent undo
set undodir=$HOME/.vim/undo " folder to store changes
set undolevels=1000 " changes that can be undone
set undoreload=10000 " lines to save on a buffer reload
set nobackup " No backups, It should be in CVS.
set noswapfile
set nowritebackup
if has("autocmd")
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vim/vimrc
" help last-position-jump
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" | endif
" start in a scratch buffer
autocmd VimEnter * if empty(expand('%')) | set buftype=nofile | endif
" Treat .rss files as XML
autocmd BufNewFile,BufRead *.rss setfiletype xml
" Syntax of these languages is fuzzy over tabs Vs spaces
autocmd FileType bash setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType cucumber setlocal ts=4 sw=4 sts=4 expandtab
" Customizations
autocmd FileType html setlocal nowrap
autocmd FileType netrw setl bufhidden=delete
autocmd FileType netrw setl bufhidden=wipe
endif
" Graphical editor running
if has("gui_running")
set guioptions-=T
set guioptions-=m
set guioptions-=r
set guifont=Hack
set linespace=-1
endif
runtime! macros/matchit.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Keyboard Mappings
" enhance sometimes dumb fingers overriding ex commands
nnoremap ; :
" Ex mode hurts more times that it's useful
nnoremap Q <nop>
" Treat long lines as break lines (breaks relativenumber count)
" nmap j gj
" nmap k gk
"Leader configuration
let mapleader = ","
let g:mapleader = ","
" window management
nmap <leader>s <C-w>s<C-w>j
nmap <leader>v <C-w>v<C-w>l
" buffer cycling
nmap <C-j> :bn<cr>
nmap <C-k> :bp<cr>
"Shortcut to paste from outside vim
nmap <leader>p "+p<CR>
"rapid .vimrc edit
nmap <leader>V :edit ~/.vim/vimrc<CR>
" Normalized escape
imap <C-c> <esc>
imap <C-\> <esc>:w<CR>
map <C-\> <esc>:w<CR>
"delayed super cow powers
cmap w!! %!sudo tee > /dev/null %
" Close the current buffer
nmap <leader>d :bdelete!<CR>
nmap <leader>q :qall!<CR>
" Close all the buffers
nmap <leader>ba :1,300 bd!<cr>
nnoremap <leader><leader> <c-^>