-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
276 lines (233 loc) · 7.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
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
call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-haml', { 'for': 'haml' }
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-commentary'
Plug 'scrooloose/syntastic'
Plug 'ervandew/supertab'
Plug 'andrewcohen/tomorrow-theme', {'rtp': 'vim/'}
Plug 'airblade/vim-gitgutter'
Plug 'kchmck/vim-coffee-script', { 'for': 'coffeescript' }
Plug 'mustache/vim-mustache-handlebars', { 'for': 'handlebars' }
Plug 'bling/vim-airline'
" Plug 'matchit.zip'
Plug 'rizzatti/dash.vim'
Plug 'kien/rainbow_parentheses.vim', { 'for': 'clojure' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'guns/vim-clojure-static', { 'for': 'clojure' }
Plug 'guns/vim-clojure-highlight', { 'for': 'clojure' }
" Plug 'paredit.vim', { 'for': 'clojure' }
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'skwp/greplace.vim'
Plug 'sjl/gundo.vim'
" Plug 'SirVer/ultisnips'
Plug 'szw/vim-ctrlspace'
Plug 'christoomey/vim-tmux-navigator'
Plug 'goatslacker/mango.vim'
Plug 'nanotech/jellybeans.vim'
Plug 'w0ng/vim-hybrid'
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
" Plug 'flowtype/vim-flow', { 'for': 'javascript' }
Plug 'mxw/vim-jsx'
Plug 'cespare/vim-toml', { 'for': 'toml' }
Plug 'chase/vim-ansible-yaml', { 'for': 'yaml' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'elixir-lang/vim-elixir', { 'for': ['elixir', 'eelixir'] }
Plug 'slashmili/alchemist.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'kassio/neoterm'
Plug 'lambdatoast/elm.vim'
Plug 'morhetz/gruvbox'
Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
Plug 'ervandew/supertab'
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py --racer-completer' }
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
call plug#end()
syntax on
filetype plugin indent on
"" general settings
set visualbell t_vb=
set hidden
set backspace=indent,eol,start
let mapleader = "\<Space>"
set nowrap
set autoread
set history=1000
if has("gui_running")
set guioptions=egmt
set guicursor+=a:blinkon0
endif
set backupdir=~/.vimtmp
set directory=~/.vimtmp
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
"" statusline settings
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_left_sep=' '
let g:airline_right_sep=' '
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#show_tab_type = 1
let g:airline#extensions#tabline#left_sep=' '
let g:airline#extensions#tabline#left_alt_sep='|'
let g:airline#extensions#tabline#right_sep=' '
let g:airline#extensions#tabline#right_alt_sep='|'
let g:airline#extensions#tabline#show_buffers = 0
let g:airline_exclude_preview = 1
""" indentation settings
set autoindent
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
""" tab completion settings
set wildmenu
set wildmode=list:longest,full
""" vim command settings
set ignorecase
set smartcase
""" mappings
imap jj <esc>
imap jk <esc>
imap kj <esc>
map Y y$
nmap <leader>s :%s/
vmap <leader>s :s/
vmap <leader>y "+y
nnoremap <leader>S :%s/\<<C-r><C-w>\>/
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
""" look and feel (margins, colors, etc)
set background=dark
set number
set cul
set termguicolors
colorscheme gruvbox
set guifont=Inconsolata-dz\ for\ Powerline:h13
set colorcolumn=120
set synmaxcol=240
set textwidth=100
set wrapmargin=0
set list listchars=trail:·
set fillchars=vert:\|,stl:\ ,stlnc:\
set listchars=tab:~\ ,extends:#,nbsp:.
"" search settings
set incsearch
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
nmap <leader><Space> :nohlsearch<Bar>:echo<CR>
"" terminal / neoterm
" enter terminal in insert mode
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
" enable esc to exit insert mode in terminal
tnoremap <Esc> <C-\><C-n>
" break out of terminal insert mode with window movements
tnoremap <c-w>j <c-\><c-n><c-w>j
tnoremap <c-w>k <c-\><c-n><c-w>k
tnoremap <c-w>h <c-\><c-n><c-w>h
noremap <c-w>l <c-\><c-n><c-w>l
noremap <c-w>J <c-\><c-n><c-w>J
tnoremap <c-w>K <c-\><c-n><c-w>K
tnoremap <c-w>H <c-\><c-n><c-w>H
tnoremap <c-w>L <c-\><c-n><c-w>L
tnoremap <c-w>x <c-\><c-n><c-w>x
nnoremap <silent> <leader>tn :TREPLSend<cr>
nnoremap <silent> <leader>tf :TREPLSendFile<cr>
nnoremap <silent> <leader>rt :call neoterm#test#run('all')<cr>
nnoremap <silent> <leader>rf :call neoterm#test#run('file')<cr>
nnoremap <silent> <leader>rn :call neoterm#test#run('current')<cr>
nnoremap <silent> <leader>rr :call neoterm#test#rerun()<cr>
" hide/close terminal
nnoremap <silent> <leader>th :call neoterm#close()<cr>
" clear terminal
nnoremap <silent> <leader>tl :call neoterm#clear()<cr>
" kills the current job (send a <c-c>)
nnoremap <silent> <leader>tc :call neoterm#kill()<cr>
"" automatically strip trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
"" NERDTree plugin configuration
nmap <leader>n :NERDTreeToggle<CR>
nmap <leader>N :NERDTreeFind<CR>
let NERDTreeShowHidden=1
"" close nerdtree if its the only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
function! HashReformat()
%s/:\(\w\+\)\(\s*=>\s*\)/\1: /gce
endfunction
command! HashReformat call HashReformat()
com! FormatJSON %!python -m json.tool
map <silent> <D-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
map <leader>C :let @* = expand("%").":".line(".")<CR>:echo "Copied: ".expand("%").":".line(".")<CR>
"" copy to system clipboard
map <leader>cc "*y
let g:syntastic_disabled_filetypes = ['scss', 'sass', 'hbs', 'handlebars.html']
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
""" FZF
let g:fzf_layout = { 'up': '30%' }
nnoremap <C-P> :FZF<CR>
"" Git gutter
highlight clear SignColumn
" Write all writeable buffers when changing buffers or losing focus.
set autowriteall " Save when doing various buffer-switching things.
autocmd BufLeave,FocusLost * silent! wall " Save anytime we leave a buffer or MacVim loses focus.
"
"Clojure
autocmd Filetype clojure RainbowParenthesesActivate
autocmd Filetype clojure RainbowParenthesesLoadRound
autocmd Filetype clojure RainbowParenthesesLoadSquare
autocmd Filetype clojure RainbowParenthesesLoadBraces
let g:rbpt_max = 9
map <leader>v :vsplit <CR>
autocmd Filetype clojure nmap <leader>r :Require <CR>
" autocmd go
autocmd filetype go set nolist
let g:go_fmt_command = "goimports"
set grepprg=ack
let g:grep_cmd_opts = '--noheading'
let g:SuperTabDefaultCompletionType = "context"
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
let g:SuperTabClosePreviewOnPopupClose = 1
let g:tmuxline_powerline_separators = 0
let g:jsx_ext_required = 0
" rust racer completion
let g:racer_cmd = "~/.cargo/bin/racer"
let $RUST_SRC_PATH="/usr/local/src/rust/src/"
let g:ycm_rust_src_path="/usr/local/src/rust/src/"
let g:deoplete#enable_at_startup = 1
autocmd filetype cpp set shiftwidth=4
autocmd filetype cpp set softtabstop=4
autocmd filetype cpp set tabstop=4
" Setup Terminal Colors For Neovim:
" Necessary until https://github.com/morhetz/gruvbox/pull/93 is resolved
if has('nvim')
" dark0 + gray
let g:terminal_color_0 = "#282828"
let g:terminal_color_8 = "#928374"
" neurtral_red + bright_red
let g:terminal_color_1 = "#cc241d"
let g:terminal_color_9 = "#fb4934"
" neutral_green + bright_green
let g:terminal_color_2 = "#98971a"
let g:terminal_color_10 = "#b8bb26"
" neutral_yellow + bright_yellow
let g:terminal_color_3 = "#d79921"
let g:terminal_color_11 = "#fabd2f"
" neutral_blue + bright_blue
let g:terminal_color_4 = "#458588"
let g:terminal_color_12 = "#83a598"
" neutral_purple + bright_purple
let g:terminal_color_5 = "#b16286"
let g:terminal_color_13 = "#d3869b"
" neutral_aqua + faded_aqua
let g:terminal_color_6 = "#689d6a"
let g:terminal_color_14 = "#8ec07c"
" light4 + light1
let g:terminal_color_7 = "#a89984"
let g:terminal_color_15 = "#ebdbb2"
endif