-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
298 lines (240 loc) · 8.54 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
set nocompatible
set shell=bash
"Plugin list to 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()
Plug 'Xuyuanp/nerdtree-git-plugin'
" Shows git marks on numbers panel
Plug 'airblade/vim-gitgutter'
Plug 'altercation/vim-colors-solarized'
Plug 'bling/vim-airline'
Plug 'chase/vim-ansible-yaml'
Plug 'ctrlpvim/ctrlp.vim'
" Python completion
Plug 'davidhalter/jedi-vim'
Plug 'ervandew/supertab'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries'}
Plug 'mbodock/molokai'
Plug 'hynek/vim-python-pep8-indent'
Plug 'jelera/vim-javascript-syntax'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'kien/rainbow_parentheses.vim'
" Plug 'klen/python-mode'
Plug 'mzlogin/vim-markdown-toc'
Plug 'nvie/vim-flake8'
Plug 'plasticboy/vim-markdown'
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'terryma/vim-expand-region'
Plug 'terryma/vim-multiple-cursors'
Plug 'tmhedberg/matchit'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline-themes'
" Plug 'vim-syntastic/syntastic'
Plug 'w0rp/ale'
call plug#end()
set wildmenu " shows menu when tab is pressed
set wildignore=*/htmlcov/*,*/functional*,*.swp,*.bak,*.pyc,*.class,*/node_modules/*,*/bower_components/*
set title " change the terminal's title
set cursorline " Highline the current line
set cc=80
set encoding=utf8
set showtabline=1 " only show tablines with two or more tabs
" Swap implementations of ` and ' jump to markers
" By default, ' jumps to the marked line, ` jumps to the marked line and
" column, so swap them
nnoremap ' `
nnoremap ` '
" Use shift-H and shift-L for move to beginning/end
nnoremap H 0
nnoremap L $
" Strip all trailing whitespace from a file, using \W
nnoremap <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
" Makes W write like w bot don't affect Word
cnoreabbrev W w
" Alias
command Sortline call setline('.', join(sort(split(getline('.'), ' ')), " "))
" Uses tab and shift+tab to change tabs
map <Tab> :tabnext<cr>
map <S-Tab> :tabprevious<cr>
" xmllit current document
nnoremap <c-h><c-x> :silent %!xmllint --format -<cr>
" Show numbers on vim
set number
" Misc
set directory=/tmp
set exrc
set secure
set expandtab " Tab inteligentes
set autoindent " Auto ident after LB
set shiftwidth=4
set shiftround
set tabstop=4
set softtabstop=4
set hlsearch
set incsearch
set ignorecase
set smartcase "If has uppercase chars search for inogres ignnorecase
set backspace=indent,eol,start
set completeopt=longest,menuone
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <C-c> <Esc><Esc>
map 0 ^
set splitright
set splitbelow
set laststatus=2
" set mouse=a
set noshowmode
nnoremap / /\v
vnoremap / /\v
" Show invisible chars
map <leader>c :set list!<CR>
set listchars=tab:▸\ ,space:·,eol:¬
" Always tell me the number of lines changed by a command
set report=0
" When wrapping text, if a line is so long that not all of it can be shown on
" the screen, show as much as possible anyway; by default Vim fills the left
" column with @ symbols instead, which I don't find very helpful
set display=lastline
" Don't wrap by default, but use \w to toggle it on or off quickly
set nowrap
nnoremap <leader>w :set wrap!<CR>
" bodocks =D
nmap <leader>o :NERDTreeToggle<cr>
nmap <leader>O :NERDTreeTabsToggle<cr>
nmap <F3> :noh<cr>
nmap <leader>k ddkkp
nmap <leader>j ddp
nmap <F8> :lnext<cr>
" Removendo lag ao sair do modo de inserção
set ttimeoutlen=50
" Disable arrow movement, resize splits instead.
nnoremap <Up> :resize +2<CR>
nnoremap <Down> :resize -2<CR>
nnoremap <Left> :vertical resize +2<CR>
nnoremap <Right> :vertical resize -2<CR>
" Multiple cursors
let g:multi_cursor_exit_from_visual_mode = 1
let g:multi_cursor_quit_key='<C-z>'
" If a file named ~/.vimrc.local exists, source its configuration; this is
" useful for defining filetype rules on systems which happen to have files of
" a known type with atypical suffixes or locations
if filereadable(glob('~/.vimrc.local'))
source ~/.vimrc.local
endif
" Remove folding on plasticboy/vim-markdown
let g:vim_markdown_folding_disabled=1
" Snippets
iabbrev eenc # encoding: utf-8
" PyMode: https://github.com/klen/python-mode
let g:pymode_options_max_line_length = 100
let g:pymode_folding = 0
let g:pymode_rope_rename_bind = '<C-h>rr'
let g:pymode_rope_organize_imports_bind = '<C-h>ri'
let g:pymode_rope_autoimport = 1
let g:pymode_rope_autoimport_bind = '<C-h>ra'
if isdirectory(expand($HOME . '/.vim/plugged/'))
if isdirectory(expand($HOME . '/.vim/plugged/vim-colors-solarized/'))
set background=dark
let g:solarized_termcolors=256
set t_Co=256
" Disabled to test molokai
" colorscheme solarized
endif
" Vim-airline configs
if isdirectory(expand($HOME . '/.vim/plugged/vim-airline/'))
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_theme = 'powerlineish'
let g:airline#extensions#branch#enabled = 1
set laststatus=2
endif
if isdirectory(expand($HOME . '/.vim/plugged/vim-airline/'))
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_aggregate_errors = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_highlighting = 1
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '⚠'
let g:syntastic_python_checkers = ['flake8']
endif
if isdirectory(expand($HOME . '/.vim/plugged/jedi-vim/'))
let g:jedi#use_tabs_not_buffers = 1
let g:jedi#show_call_signatures = 2
endif
if isdirectory(expand($HOME . '/.vim/plugged/ultisnips/'))
let g:UltiSnipsExpandTrigger="<c-k>"
let g:UltiSnipsJumpForwardTrigger="<c-l>"
endif
if isdirectory(expand($HOME . '/.vim/plugged/rainbow_parentheses.vim/'))
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
endif
if isdirectory(expand($HOME . '/.vim/plugged/vim-go/'))
let g:go_fmt_fail_silently = 1
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_rename_command = 'gopls'
let g:go_auto_type_info = 1
let g:go_textobj_include_function_doc = 0
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_function_calls = 0
let g:go_highlight_functions = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_string_spellcheck = 1
let g:go_highlight_format_strings = 1
" let g:go_debug=['lsp'] " Use to debug gopls problems
nnoremap <leader>i :GoSameIdsToggle<cr>
nnoremap <leader>r :GoRename<cr>
endif
if isdirectory(expand($HOME . '/.vim/plugged/molokai'))
let g:rehash256 = 1
let g:molokai_original = 1
colorscheme molokai
endif
if isdirectory(expand($HOME . '/.vim/plugged/ale/'))
let g:ale_linters = {
\ 'go': ['gopls', 'golint'],
\}
endif
if isdirectory(expand($HOME . '/.vim/plugged/supertab/'))
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc']
endif
if isdirectory(expand($HOME . '/.vim/plugged/ctrlp.vim/'))
let g:ctrlp_custom_ignore = 'env'
endif
endif
" Use The Silver Searcher over grep, iff possible
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
endif
" Fix text background color
hi Normal ctermbg=NONE
autocmd FileType js setlocal ts=2 sts=2 sw=2
autocmd FileType yml setlocal ts=2 sts=2 sw=2
autocmd FileType yaml setlocal ts=2 sts=2 sw=2
autocmd FileType jsx setlocal ts=2 sts=2 sw=2
autocmd FileType html setlocal ts=2 sts=2 sw=2
autocmd FileType javascript setlocal ts=2 sts=2 sw=2
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
autocmd VimEnter,FocusGained * silent !tmux set status off
autocmd VimLeave,FocusLost * silent !tmux set status on