-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
250 lines (180 loc) · 4.92 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
set tabstop=2 softtabstop=1 expandtab shiftwidth=2 smarttab
syntax on
set smartcase
set ignorecase
set termguicolors
" hides buffers instead of closing them
set hidden
" autoreads files editted outside vim
set autoread
" disables swapfiles
set noswapfile
" shows whitespace chars
set list
set noshowmode
set mouse=a
set suffixesadd=js,jsx,ts,tsx
" shift happens
cnoreabbrev W w
" NERDTree opens with Ctrl m
map <silent> <C-k>b :NERDTreeToggle<CR>
map <silent> <C-k>f :NERDTreeFind<CR>
" disables comment auto insertion
autocmd FileType * setlocal formatoptions-=cro
" removes trailing whitespace
" autocmd BufWritePre * %s/\s\+$//e
au BufRead,BufNewFile *.handlebars set filetype=html
let g:python3_host_prog = '/Users/ruiramos/.nvim-venv/bin/python'
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
let mapleader=","
nnoremap <leader>el :ElmEvalLine<CR>
vnoremap <leader>es :<C-u>ElmEvalSelection<CR>
nnoremap <leader>em :ElmMakeCurrentFile<CR>
" open todos file
nnoremap <leader>ed :vsp ~/.scratch/todo.md<CR>
nnoremap <leader>es :vsp ~/.scratch/sprint.md<CR>
if executable('rg')
let g:ctrlp_user_command = 'rg --files %s'
let g:ctrlp_use_caching = 0
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_switch_buffer = 'et'
let g:ackprg = "rg\ --vimgrep\ --no-heading\ --smart-case"
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
set grepformat+=%f:%l:%c:%m
endif
" bind K to grep word under cursor
nnoremap K :grep! "<C-R><C-W>"<CR>:cw<CR>
" bind \ (backward slash) to grep shortcut
nnoremap \ :Ack<SPACE>
" ctrlp - set mru as default
let g:ctrlp_cmd = 'CtrlPMRU'
let g:ctrlp_mruf_relative = 1
" let g:ctrlp_prompt_mappings = {
" \ 'AcceptSelection("h")': ['<c-i>', '<2-LeftMouse>'],
" \ 'AcceptSelection("v")': ['<c-s>', '<RightMouse>'],
" \ }
let g:ale_fixers = {
\ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'eslint'],
\ 'typescriptreact': ['prettier', 'eslint'],
\ 'javascriptreact': ['prettier', 'eslint'],
\ 'rust': ['rustfmt'],
\ 'reason': ['refmt'],
\ 'python': ['black']
\ }
let g:ale_linters = {'rust': ['analyzer'], 'python': ['flake8', 'pylsp', 'bandit', 'mypy']}
let g:ale_fix_on_save = 1
let g:ale_python_auto_pipenv = 1
let g:ale_completion_enabled = 1
highlight clear ALEWarningSign
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/plugged')
" cores bonitas
Plug 'junegunn/seoul256.vim'
" git stuff
Plug 'tpope/vim-fugitive'
" file finder
Plug 'ctrlpvim/ctrlp.vim'
" git diffs
Plug 'airblade/vim-gitgutter'
" javascript
Plug 'pangloss/vim-javascript'
Plug 'elzr/vim-json'
"Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'maxmellon/vim-jsx-pretty'
" less
Plug 'groenewege/vim-less'
" linting
Plug 'w0rp/ale'
" andar pros lados
Plug 'christoomey/vim-tmux-navigator'
" emmet
Plug 'mattn/emmet-vim'
" surround stuff in other stuff
Plug 'tpope/vim-surround'
" unimpaired - ] [ mappings
Plug 'tpope/vim-unimpaired'
" tree
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" colorful bar at the bottom
Plug 'vim-airline/vim-airline'
" elixir
Plug 'elixir-lang/vim-elixir'
" editor config
Plug 'editorconfig/editorconfig-vim'
" expand selection
Plug 'terryma/vim-expand-region'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
" elm
Plug 'ElmCast/elm-vim'
" reason
Plug 'reasonml-editor/vim-reason-plus'
" solidity
Plug 'tomlion/vim-solidity'
Plug 'godlygeek/tabular'
" auto detect ident settings
Plug 'tpope/vim-sleuth'
Plug 'rust-lang/rust.vim'
Plug 'elzr/vim-json'
Plug 'haya14busa/vim-asterisk'
Plug 'mileszs/ack.vim'
call plug#end()
let g:seoul256_background = 234
let g:seoul256_light_background = 256
colo seoul256
" fancy font
let g:airline_powerline_fonts = 1
" edit / source vimrc
nnoremap gev :e $MYVIMRC<CR>
nnoremap gsv :so $MYVIMRC<CR>
set statusline+=%#warningmsg#
set statusline+=%*
" completion
filetype plugin on
set number
hi cursorline ctermbg=none
hi cursorlinenr ctermfg=red
" editor config
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" Get running OS
let os = ""
if has("win32")
let os="win"
else
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
let os="mac"
else
let os="unix"
endif
endif
endif
" uses the system clipboard
set clipboard=unnamed
if os == 'unix'
set clipboard=unnamedplus
endif
" run rust fmt on save
let g:rustfmt_autosave = 1
nnoremap <silent> gd :ALEGoToDefinition<CR>
nnoremap <silent> <leader>h :ALEHover<CR>
nmap =j :%!python -m json.tool<CR>
" vim-asterisk
map * <Plug>(asterisk-*)
map # <Plug>(asterisk-#)
map g* <Plug>(asterisk-g*)
map g# <Plug>(asterisk-g#)
map z* <Plug>(asterisk-z*)
map gz* <Plug>(asterisk-gz*)
map z# <Plug>(asterisk-z#)
map gz# <Plug>(asterisk-gz#)