-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.old
282 lines (236 loc) · 7.57 KB
/
vimrc.old
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
scriptencoding utf-8
"=============================================
" Initialization
"=============================================
" declare ruby path
let g:ruby_path = system('echo $HOME/.asdf/shims/ruby')
" Start .vimrc
set nocompatible
filetype plugin indent on
" minpac
packadd minpac
if exists('*minpac#init')
call minpac#init({'verbose': 3})
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('airblade/vim-gitgutter')
call minpac#add('altercation/vim-colors-solarized')
call minpac#add('ctrlpvim/ctrlp.vim')
call minpac#add('itchyny/lightline.vim')
call minpac#add('jgdavey/tslime.vim')
call minpac#add('jgdavey/vim-turbux')
call minpac#add('mattn/emmet-vim')
call minpac#add('mileszs/ack.vim')
call minpac#add('nathanaelkane/vim-indent-guides')
call minpac#add('pangloss/vim-javascript')
call minpac#add('posva/vim-vue')
call minpac#add('prettier/vim-prettier')
call minpac#add('tpope/vim-bundler')
call minpac#add('tpope/vim-commentary')
call minpac#add('tpope/vim-endwise')
call minpac#add('tpope/vim-eunuch')
call minpac#add('tpope/vim-fugitive')
call minpac#add('tpope/vim-markdown')
call minpac#add('tpope/vim-ragtag')
call minpac#add('tpope/vim-rails')
call minpac#add('tpope/vim-rake')
call minpac#add('tpope/vim-repeat')
call minpac#add('tpope/vim-surround')
call minpac#add('vim-ruby/vim-ruby')
call minpac#add('vim-scripts/matchit.zip')
" minpac utility commands
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
command! PackStatus call minpac#status()
" use solarized for colorscheme
if isdirectory($HOME . "/.vim/pack/minpac/start/vim-colors-solarized")
set background=dark
" set background=light
colorscheme solarized
endif
" lightline
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\ 'left': [['mode', 'paste'], ['gitbranch', 'readonly', 'filename', 'modified']]
\ },
\ 'component': { 'lineinfo': ' %3l:%-2v' },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ }
" Prettier: run before saving (async)
" let g:prettier#autoformat = 0
" autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
" Prettier: print spaces between brackets
let g:prettier#config#bracket_spacing = 'true'
" Prettier: single quotes over double quotes
let g:prettier#config#single_quote = 'true'
endif
"=============================================
" Options
"=============================================
" Enable utf-8
set encoding=utf-8
" Color
set t_Co=256
syntax on
" Highlight breakpoints
au BufEnter *.rb syn match error contained "\<binding.pry\>"
" Turn off error bells
set noerrorbells
set visualbell
set t_vb=
" Search
set ignorecase
set smartcase
set hlsearch
set incsearch
" Tab completion
set wildmode=list:longest,full
set wildignore=*.swp,*.o,*.so,*.exe,*.dll
set wildmenu
" Scroll
set scrolloff=3
" Tab settings
set ts=2
set sw=2
set expandtab
" Hud
set ruler
set number
set cursorline
set laststatus=2 " Always show status bar
set nowrap
set colorcolumn=100
" Buffers
set hidden
" History
set history=1000
set undolevels=1000
" Backup Directories
set backupdir=~/.vim/backups,.
set directory=~/.vim/swaps,.
if exists('&undodir')
set undodir=~/.vim/undo,.
endif
" Fix backspace
set backspace=indent,eol,start
" Highlight unwanted spaces
set list listchars=tab:»·,trail:·
" Preserve indentation while pasting text from the OS X clipboard
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
" Remove delay when pressing esc when in insert mode
set noesckeys
" Set tags file search order
set tags=./tags;
"=============================================
" Remaps
"=============================================
let mapleader=','
let maplocalleader=','
" No arrow keys
map <Left> :echo "ಠ_ಠ"<cr>
map <Right> :echo "ಠ_ಠ"<cr>
map <Up> :echo "ಠ_ಠ"<cr>
map <Down> :echo "ಠ_ಠ"<cr>
" Jump key
nnoremap ` '
nnoremap ' `
" Change pane
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Turn off search highlight
nnoremap <localleader>/ :nohlsearch<CR>
" Trim trailing whitespace
nnoremap <localleader>ws m`:%s/\s\+$//e<CR>``
"=============================================
" Autocommands
"=============================================
" Remove trailing whitespace on save of ruby files
au BufWritePre *.rb :%s/\s\+$//e
" edit MacOS crontab in-place
autocmd FileType crontab setlocal nowritebackup
"=============================================
" Additional Config Files
"=============================================
" Load user settings
if filereadable(expand('~/.vimrc.local'))
source ~/.vimrc.local
endif
"=============================================
" Rails.vim projections
"=============================================
if !exists('g:rails_projections')
let g:rails_projections = {}
endif
call extend(g:rails_projections, {
\ "app/presenters/*.rb": {
\ "command": "presenter",
\ "test": "spec/presenter/%s_spec.rb",
\ "alternate": "spec/presenter/%s_spec.rb",
\ "template": "class %S\nend" },
\ "app/services/*.rb": {
\ "command": "service",
\ "test": "spec/service/%s_spec.rb",
\ "alternate": "spec/service/%s_spec.rb",
\ "template": "class %S\nend" },
\ "app/workers/*.rb": {
\ "command": "worker",
\ "template": "class %S\nend" }
\ }, 'keep')
if !exists('g:rails_gem_projections')
let g:rails_gem_projections = {}
endif
call extend(g:rails_gem_projections, {
\ "active_model_serializers": {
\ "app/serializers/*_serializer.rb": {
\ "command": "serializer",
\ "template": "class %SSerializer < ActiveModel::Serializer\nend",
\ "affinity": "model"}},
\ "rspec": {
\ "spec/support/*.rb": {
\ "command": "support"}},
\ "cucumber": {
\ "features/*.feature": {
\ "command": "feature",
\ "template": "Feature: %h"},
\ "features/support/*.rb": {
\ "command": "support"},
\ "features/support/env.rb": {
\ "command": "support"},
\ "features/step_definitions/*_steps.rb": {
\ "command": "steps"}},
\ "carrierwave": {
\ "app/uploaders/*_uploader.rb": {
\ "command": "uploader",
\ "template": "class %SUploader < CarrierWave::Uploader::Base\nend"}},
\ "draper": {
\ "app/decorators/*_decorator.rb": {
\ "command": "decorator",
\ "affinity": "model",
\ "template": "class %SDecorator < ApplicationDecorator\nend"}},
\ "fabrication": {
\ "spec/fabricators/*_fabricator.rb": {
\ "command": ["fabricator", "factory"],
\ "alternate": "app/models/%s.rb",
\ "related": "db/schema.rb#%p",
\ "test": "spec/models/%s_spec.rb",
\ "template": "Fabricator :%s do\nend",
\ "affinity": "model"}},
\ "factory_bot": {
\ "spec/factories/*.rb": {
\ "command": "factory",
\ "alternate": "app/models/%s.rb",
\ "related": "db/schema.rb#%p",
\ "test": "spec/models/%s_spec.rb",
\ "template": "FactoryBot.define do\n factory :%s do\n end\nend",
\ "affinity": "model"},
\ "spec/factories.rb": {
\ "command": "factory"},
\ "test/factories.rb": {
\ "command": "factory"}}
\ }, 'keep')