-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
275 lines (221 loc) · 7.86 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
syntax enable " Turn on syntax highlighting allowing local overrides
set encoding=utf-8
" Setup Dein ----------------------------------------------------------{{{
" If Dein is not installed, do it first
if (!isdirectory(expand("$HOME/.dotfiles/vim/repos/github.com/Shougo/dein.vim")))
call system(expand("mkdir -p $HOME/.dotfiles/vim/repos/github.com"))
call system(expand("git clone https://github.com/Shougo/dein.vim $HOME/.dotfiles/vim/repos/github.com/Shougo/dein.vim"))
endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.dotfiles/vim/repos/github.com/Shougo/dein.vim
endif
" Required:
call dein#begin(expand('~/.dotfiles/vim'))
let pluginsExist = 0
" Required:
call dein#add('Shougo/dein.vim')
" Tools
call dein#add('tpope/vim-dispatch')
" Formatting - Colors & Styles
call dein#add('altercation/vim-colors-solarized')
call dein#add('bling/vim-airline')
call dein#add('nathanaelkane/vim-indent-guides')
" Tools - Search & Files
call dein#add('scrooloose/nerdtree')
call dein#add('mileszs/ack.vim')
call dein#add('ctrlpvim/ctrlp.vim')
call dein#add('corntrace/bufexplorer')
"
" " Tools - Formatting
call dein#add('tpope/vim-commentary')
call dein#add('tpope/vim-endwise')
call dein#add('tpope/vim-repeat')
call dein#add('tpope/vim-surround')
" call dein#add('junegunn/vim-easy-align')
" Tools - Git
call dein#add('tpope/vim-git')
call dein#add('tpope/vim-fugitive')
call dein#add('mattn/gist-vim.git')
" Tools - Copy Pasta
" call dein#add("svermeulen/vim-easyclip") " changes vim d an p too much
" call dein#add('vim-scripts/YankRing.vim')
" Tools - Snippets
" call dein#add('Shougo/neosnippet.vim')
" call dein#add('Shougo/neosnippet-snippets')
" Languages
" Langagues - GO
call dein#add('fatih/vim-go.git')
" Lanagues - Text
call dein#add('tpope/vim-markdown.git')
call dein#add('vim-scripts/csv.vim.git')
" Languages - Ruby
call dein#add('tpope/vim-bundler.git')
call dein#add('tpope/vim-rails.git')
call dein#add('thoughtbot/vim-rspec.git')
call dein#add('vim-ruby/vim-ruby.git')
" Languages - HTML / CSS / JS
call dein#add('tpope/vim-haml.git')
call dein#add('kchmck/vim-coffee-script.git')
call dein#add('pangloss/vim-javascript.git')
" call dein#add('cakebaker/scss-syntax.vim.git', { 'directory': 'scss' })
call dein#add('slim-template/vim-slim.git')
"
" call dein#add('ervandew/supertab.git', { 'directory': 'supertab' })
" call dein#add('majutsushi/tagbar.git', { 'directory': 'tagbar' })
" call dein#add('jgdavey/tslime.vim.git', { 'directory': 'tslime_2' })
" call dein#add('jgdavey/vim-turbux.git', { 'directory': 'turbux' })
if dein#check_install()
call dein#install()
endif
call dein#end()
" Required:
filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
" }}}
set number " Show line numbers
set ruler " Show line and column number
set clipboard=unnamed
let mapleader=","
"" Color Scheme
set background=dark
colorscheme solarized
call togglebg#map("<F5>")
" Allow backgrounding buffers without writing them, and remember marks/undo
" for background buffers
set hidden
" Whitespace
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
set colorcolumn=80 " put a line marker at the 80th column
"" List chars
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the first column when wrap is
" off and the line continues beyond the left of the screen
" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
nnoremap <leader><space> :noh<cr> " clear search
" edit mode
map <leader>e :noh<enter>:NERDTreeClose<enter>:ccl<enter><C-w>=
" Removes trailing spaces
function! TrimWhiteSpace()
%s/\s*$//
''
:retab
:endfunction
map <F2> :call TrimWhiteSpace()<CR>
map! <F2> :call TrimWhiteSpace()<CR>
" highlight current line
set cursorline
hi CursorLine cterm=NONE ctermbg=black
""
"" Disable swap files
""
set nobackup
set nowritebackup
set noswapfile
""
"" Tab Completion
""
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
" allow mouse clicks
set mouse=a
" Without setting this, ZoomWin restores windows in a way that causes
" equalalways behavior to be triggered the next time CommandT is used.
" This is likely a bludgeon to solve some other issue, but it works
" set noequalalways
" This allows <C-h> to be mapped otherwise it overwrites it
if has('nvim')
nmap <BS> <C-W>h
endif
" Navigate between split windows
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Same split settings as tmux
map <C-w>- :sp<cr>
map <C-w>\| :vs<cr>
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make set noexpandtab
" Set the Ruby filetype for a number of common Ruby files without .rb
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" Treat JSON files like JavaScript
au BufNewFile,BufRead *.json set ft=javascript
" remember last position in file
" see :help last-position-jump
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
"
au FileWritePre * :call TrimWhiteSpace()
au FileAppendPre * :call TrimWhiteSpace()
au FilterWritePre * :call TrimWhiteSpace()
au BufWritePre * :call TrimWhiteSpace()
endif
""
"" Ack
""
map <leader>F :Ack<space>
" disable cursor keys in normal mode
map <Left> <nop>
map <Right> <nop>
map <Up> <nop>
map <Down> <nop>
imap jj <esc>
" copy selection to clipboard
vmap <leader>y "*y
vmap <leader>p "*gP
" Copy Paste settings - EasyClip
"
" share yank buffer across vims
" let g:EasyClipShareYank = 1
" toggle formatting on a block of pasted text
" nmap <leader>cf <plug>EasyClipToggleFormattedPaste
" easy align mapping
" Start interactive EasyAlign in visual mode (e.g. vipga)
" xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
" nmap ga <Plug>(EasyAlign)
" succombing to nerdtree
let g:NERDTreeWinSize=40
let g:NERDTreeChDirMode=2
let g:NERDTreeMinimalUI=1
let g:NERDTreeDirArrows=1
let g:NERDTreeMouseMode=2
map <Leader>n :NERDTreeToggle<CR>
map <Leader>f :NERDTreeFind<CR>
" signify (git diff) settings
let g:signify_vcs_list = ['git']
let g:signify_disable_by_default = 1
if filereadable("zeus.json")
let g:turbux_command_rspec = 'zeus rspec'
let g:turbux_command_cucumber = 'zeus cucumber'
endif
" Run a ruby file in another pane
:map <Leader>r :w\|:call Send_to_Tmux("ruby ".expand("%")."\n")<CR>
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>