-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
193 lines (170 loc) · 5.55 KB
/
vimrc
File metadata and controls
193 lines (170 loc) · 5.55 KB
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
set hlsearch incsearch ignorecase smartcase
set ts=2 sw=2 sts=2 et
set t_Co=256
set hidden
set showcmd
set wildmenu
set wildignore=/**/compiled,/public/javascripts/jst,/public/images
filetype off
set listchars=tab:▸\ ,trail:·
set list
set laststatus=2 " always show the status line
set undodir=~/.vim/undo
set undofile
set diffopt=vertical
set ruler
set backspace=eol,indent,start
set directory=~/.vim/swapfiles
" true color support
set termguicolors
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
set guioptions=
set guifont=Consolas\ 11
" Install vim-plug if not found
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
endif
call plug#begin('~/.vim/bundle')
Plug 'VundleVim/Vundle.vim'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-characterize'
Plug 'tpope/vim-eunuch'
Plug 'vimwiki/vimwiki'
Plug 'vim-scripts/YankRing.vim'
let g:yankring_persist = 0
Plug 'ConradIrwin/vim-bracketed-paste'
"Plug 'CSApprox'
Plug 'kien/rainbow_parentheses.vim'
if v:version > 704
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --ts-completer --go-completer' }
" let g:ycm_log_level = 'debug'
let g:ycm_language_server = [
\ {
\ 'name': 'elixir-ls',
\ 'cmdline': [ expand( '$HOME/opt/elixir-ls/rel/language_server.sh' ) ],
\ 'filetypes': [ 'elixir', 'eelixir' ],
\ },
\ ]
endif
Plug 'mbbill/undotree'
" clojure
Plug 'guns/vim-clojure-static'
Plug 'tpope/vim-fireplace'
"javascript
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
let g:jsx_ext_required = 0
"typescript
Plug 'leafgarland/typescript-vim'
"elixir
Plug 'elixir-editors/vim-elixir'
" colorschemes
Plug 'vim-scripts/molokai'
Plug 'vim-scripts/dusk'
Plug 'vim-scripts/github-theme'
Plug 'nanotech/jellybeans.vim'
Plug 'vim-scripts/pink'
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'dracula/vim'
Plug 'lifepillar/vim-solarized8'
Plug 'NLKNguyen/papercolor-theme'
Plug 'haishanh/night-owl.vim'
Plug 'arcticicestudio/nord-vim'
call plug#end()
" fzf - i wish this was installed with vundle...
" git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
" ~/.fzf/install
set rtp+=~/.fzf
nnoremap <silent> <Leader>t :FZF<cr>
if v:version > 704
packadd! matchit
endif
" maps {{{
nnoremap <silent> <Leader>gu :UndotreeToggle<CR>
" replace caps-lock?
inoremap <leader>u <esc>vawUea
nnoremap <leader>u vawU
inoremap jk <esc>
nnoremap <leader>cn :cn<cr>
" vimrc editing/sourcing
nnoremap <leader>ev :vsp $MYVIMRC<cr>
nnoremap <leader>sv :so $MYVIMRC<cr>
" }}}
set background=dark
color gruvbox
set grepprg=rg\ --vimgrep\ --no-heading
" vim wiki
let g:vimwiki_key_mappings = {'headers': 0}
let g:vimwiki_list = [{'path': '~/.vim/wiki', 'syntax': 'markdown', 'ext': '.md'}]
" filetype specific stuff
au FileType python setlocal ts=4 sw=4 sts=4
augroup ruby
au!
au FileType ruby map <buffer> <Leader>cw :!ruby -cw %<cr>
au FileType ruby map <buffer> <Leader>rr :!ruby %<cr>
augroup END
augroup rails-specs
au!
au User Rails
\ if rails#buffer().relative() =~ "^spec" |
\ map <buffer> <F6>
\ :call VimuxRunCommand("rspec " . expand("%") )<CR>|
\ map <buffer> <F5>
\ :call VimuxRunCommand("rspec ".expand("%").":".line("."))<CR>|
\ elseif rails#buffer().relative() =~ "^test" |
\ map <buffer> <F6>
\ :call VimuxRunCommand("b rails test ".expand("%") )<cr>|
\ map <buffer> <F5>
\ :call VimuxRunCommand("b rails test ".expand("%").":".line("."))<cr>|
\ endif
augroup END
augroup elixir
au!
au FileType elixir setlocal formatprg=mix\ format\ \-
au FileType elixir
\ if expand("%") =~ ".exs$" |
\ map <buffer> <F6>
\ :call VimuxRunCommand("mix test ".expand("%"))<cr>|
\ map <buffer> <F5>
\ :call VimuxRunCommand("mix test ".expand("%").":".line("."))<cr>|
\ endif
au FileType elixir noremap :YcmCompleter GoTo<cr>
augroup END
augroup clojure-rainbow
au!
au FileType clojure RainbowParenthesesActivate
au Syntax clojure RainbowParenthesesLoadRound
au Syntax clojure RainbowParenthesesLoadSquare
au Syntax clojure RainbowParenthesesLoadBraces
augroup END
augroup js
au FileType javascript.jsx,javascript,typescript setlocal formatprg=prettier\ --parser=typescript
au FileType javascript.jsx,javascript,typescript map <buffer> <leader>ff mfgggqG`f<cr>
au FileType javascript.jsx,javascript,typescript noremap <buffer> :YcmCompleter GoTo<cr>
au FileType javascript.jsx,javascript,typescript noremap <buffer> <leader>gti :YcmCompleter GoToImplementation<cr>
au FileType javascript.jsx,javascript,typescript noremap <buffer> <leader>gtr :YcmCompleter GoToReferences<cr>
au FileType javascript.jsx,javascript,typescript map <buffer> K :YcmCompleter GetDoc<cr>
set backupcopy=yes "this fixes webpack's crappy watcher
augroup END
augroup salt
au!
au BufNewFile,BufRead *.sls setf yaml
augroup END
augroup go
au FileType go setlocal listchars=tab:\ \ ,trail:·
au FileType go setlocal noexpandtab
au FileType go setlocal formatprg=gofmt\ -s
au FileTYpe go noremap <buffer> :YcmCompleter GoTo<cr>
au FileTYpe go noremap <buffer> <leader>gti :YcmCompleter GoToImplementation<cr>
au FileTYpe go noremap <buffer> <leader>gtr :YcmCompleter GoToReferences<cr>
au FileType go map <buffer> <leader>ff :YcmCompleter Format<cr>
au FileType go map <buffer> K :YcmCompleter GetDoc<cr>
augroup END