-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
238 lines (191 loc) · 8.63 KB
/
.vimrc
File metadata and controls
238 lines (191 loc) · 8.63 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
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
set nocompatible
" ---------------------------------------------------------------------
" ----- Plugins through Vim-plug --------------------------------------
" ---------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
" plugins will go here (see next step)
" (be sure to replace 'Plugin' with 'Plug')
Plug 'altercation/vim-colors-solarized'
Plug 'tomasr/molokai'
Plug 'bling/vim-airline'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
" Plug 'scrooloose/syntastic'
" Plug 'xolox/vim-misc'
" Plug 'xolox/vim-easytags'
Plug 'majutsushi/tagbar'
Plug 'kien/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
" Plug 'Raimondi/delimitMate'
Plug 'christoomey/vim-tmux-navigator'
" Plug 'cakebaker/scss-syntax.vim'
Plug 'mileszs/ack.vim'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-endwise'
Plug 'ervandew/supertab'
Plug 'scrooloose/nerdcommenter'
" Plug 'mattn/emmet-vim'
" Plug 'pangloss/vim-javascript'
" Plug 'mxw/vim-jsx'
" Plug 'junegunn/vim-easy-align'
Plug 'editorconfig/editorconfig-vim'
Plug 'slim-template/vim-slim'
Plug 'mustache/vim-mustache-handlebars'
" Highlight and strip trailing whitespace
Plug 'ntpeters/vim-better-whitespace'
" Align CSV files at commas, align Markdown tables, and more
Plug 'godlygeek/tabular'
call plug#end()
" ---------------------------------------------------------------------
" ----- General Settings ---------------------------------------------------
" ---------------------------------------------------------------------
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=1000 " keep 1000 lines of command line history
set number " line numbers
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set linebreak " wrap lines on 'word' boundaries
set scrolloff=3 " don't let the cursor touch the edge of the viewport
set splitright " Vertical splits use right half of screen
set timeoutlen=800 " Lower ^[ timeout
set fillchars=fold:\ , " get rid of obnoxious '-' characters in folds
set tildeop " use ~ to toggle case as an operator, not a motion
set showcmd
set incsearch
set hlsearch
set ignorecase " Ignore case when searching. Use \C for case sensitive searches
set hidden " Hiding the buffer without first saving the buffer. You will be asked to save the modified buffers when quiting VIM
set autoread " VIM reloads file that has been changed externally
syntax on
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set mouse=a
if exists('&breakindent')
set breakindent " Indent wrapped lines up to the same level
endif
" 80 column line
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
:au FocusLost * :wa "autosave
" Set the colorscheme
colorscheme molokai
" ---------------------------------------------------------------------
" ----- UNDO ---------------------------------------------------
" ---------------------------------------------------------------------
set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
" ---------------------------------------------------------------------
" ----- VIM-JSX ---------------------------------------------------
" ---------------------------------------------------------------------
let g:jsx_ext_required = 0
" ---------------------------------------------------------------------
" ----- Tab Setting ---------------------------------------------------
" ---------------------------------------------------------------------
set expandtab " Expand tabs into spaces
set tabstop=2 " default to 2 spaces for a hard tab
set softtabstop=2 " default to 2 spaces for the soft tab
set shiftwidth=2 " for when <TAB> is pressed at the beginning of a line
" ---------------------------------------------------------------------
" ----- Key Binding ---------------------------------------------------
" ---------------------------------------------------------------------
" map <leader> to ,
let mapleader = " "
" make jj do ESC
inoremap jj <esc>
" Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" Navigate buffer
nnoremap <C-n> :bnext<CR>
nnoremap <C-p> :bprevious<CR>
nnoremap <C-b> :CtrlPBuffer<CR>
" Resize
nnoremap <silent> <leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
" ---------------------------------------------------------------------
" ----- Plugin-Specific Settings --------------------------------------
" ---------------------------------------------------------------------
" ---- NERDCommenter -------------------------------------------------------
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" ---- CTRLP ---------------------------------------------------------------
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|\tags\'
" ---- Vim-Ruby, Vim-Rails -------------------------------------------------
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
" ---- Better Whitespace ------------------------------------------------------
autocmd FileType javascript,html,ruby autocmd BufWritePre <buffer> StripWhitespace
" ---- NERDTree ------------------------------------------------------
" To have NERDTree always open on startup
" let g:nerdtree_tabs_open_on_console_startup = 0
" ----- Solarized ----------------------------------------------------
" Toggle this to "light" for light colorscheme
set background=dark
" Uncomment the next line if your terminal is not configured for solarized
" let g:solarized_termcolors=256
" ----- Airline ----------------------------------------------------
" Always show statusbar
set laststatus=2
" Fancy arrow symbols, requires a patched font
" To install a patched font, run over to
" https://github.com/abertsch/Menlo-for-Powerline
" download all the .ttf files, double-click on them and click "Install"
" Finally, uncomment the next line
"let g:airline_powerline_fonts = 1
" Show PASTE if in paste mode
let g:airline_detect_paste=1
" Show airline for tabs too
let g:airline#extensions#tabline#enabled = 1
" ----- Syntastic ----------------------------------------------------
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
let g:syntastic_javascript_checkers = ['eslint']
augroup mySyntastic
au!
au FileType tex let b:syntastic_mode = "passive"
augroup END
" ----- vim-easytags ----------------------------------
" Where to look for tags files
set tags=./tags;,~/.vimtags
" Sensible defaults
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
" ----- Tagbar -----------------------------------------------
" Open/close tagbar with \b
nmap <silent> <leader>b :TagbarToggle<CR>
" ----- vim-gitgutter ------------------------------------------
" Required after having changed the colorscheme
hi clear SignColumn
" In vim-airline, only display "hunks" if the diff is non-zero
let g:airline#extensions#hunks#non_zero_only = 1
" ----- DelimitMate ----------------------------------------------
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END
" ----- Ag ------------------------------------------------------
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>