-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.vimrc
296 lines (251 loc) · 9.29 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
set nocompatible
map <Esc>[B <Down>]
let mapleader = ','
" Bundle =======================================================================
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
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'chemzqm/vim-jsx-improve'
Plug 'ap/vim-css-color'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-sleuth'
Plug 'godlygeek/tabular'
Plug 'Raimondi/delimitMate'
Plug 'digitaltoad/vim-pug',
Plug 'blueyed/vim-diminactive'
Plug 'Shougo/vimproc.vim',
Plug 'leafgarland/typescript-vim'
Plug 'wesQ3/vim-windowswap'
Plug 'hail2u/vim-css3-syntax'
augroup VimCSS3Syntax
autocmd!
autocmd FileType css setlocal iskeyword+=-
augroup END
Plug 'easymotion/vim-easymotion'
map <Leader> <Plug>(easymotion-prefix)
Plug 'kana/vim-operator-user'
Plug 'haya14busa/vim-operator-flashy'
map y <Plug>(operator-flashy)
nmap Y <Plug>(operator-flashy)$
Plug 'haya14busa/incsearch.vim'
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
Plug 'haya14busa/incsearch-easymotion.vim'
map m/ <Plug>(incsearch-fuzzy-/)
map m? <Plug>(incsearch-fuzzy-?)
map mg/ <Plug>(incsearch-fuzzy-stay)
Plug 'haya14busa/incsearch-fuzzy.vim'
map z/ <Plug>(incsearch-fuzzy-/)
map z? <Plug>(incsearch-fuzzy-?)
map zg/ <Plug>(incsearch-fuzzy-stay)
Plug 'scrooloose/syntastic'
let g:syntastic_javascript_checkers = ['eslint']
Plug 'Yggdroot/indentLine'
let g:indentLine_char = '¦'
let g:indentLine_enabled = 1
let g:indentLine_color_term = 0
Plug 'simnalamburt/vim-mundo'
nnoremap <leader>u :GundoToggle<CR>
Plug 'elzr/vim-json'
let g:vim_json_syntax_conceal = 0
Plug 'fatih/vim-go', { 'for': 'go' }
let g:go_fmt_command = "goimports"
Plug 'christoomey/vim-tmux-navigator'
nnoremap <silent> <C-Left> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-Down> :TmuxNavigateDown<cr>
nnoremap <silent> <C-Up> :TmuxNavigateUp<cr>
nnoremap <silent> <C-Right> :TmuxNavigateRight<cr>
nnoremap <silent> <C-~> :TmuxNavigatePrevious<cr>
Plug 'tpope/vim-fugitive'
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
Plug 'altercation/vim-colors-solarized'
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
set t_Co=16
set background=dark
colorscheme solarized
highlight IncSearch ctermbg=5 ctermfg=8 cterm=none
Plug 'kien/ctrlp.vim'
Plug 'tacahiroy/ctrlp-funky'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
\ },
\ 'fallback': 'find %s -type f'
\ }
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_extensions = ['funky']
nnoremap <Leader>fu :CtrlPFunky<Cr>
nnoremap U <c-r>
noremap <c-r> :CtrlPFunky<Cr>
noremap <c-u> :CtrlPBuffer<Cr>
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeTabsToggle' }
Plug 'jistr/vim-nerdtree-tabs', { 'on': 'NERDTreeTabsToggle' }
map <C-e> :NERDTreeTabsToggle<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr', 'node_modules']
let NERDTreeChDirMode=0
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0
Plug 'bling/vim-airline'
set showmode
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
if has('statusline')
set laststatus=2
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " Filetype
set statusline+=\ [%{getcwd()}] " Current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
highlight clear SignColumn
let g:CSApprox_hook_post = ['hi clear SignColumn']
let g:gitgutter_max_signs = 1000
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
" set encoding=utf-8
" let g:ycm_complete_in_strings = 0
" let g:ycm_seed_identifiers_with_syntax = 1
" if !exists("g:ycm_semantic_triggers")
" let g:ycm_semantic_triggers = {}
" endif
" let g:ycm_semantic_triggers['typescript'] = ['.']
call plug#end()
filetype plugin indent on
" Appearance ===================================================================
scriptencoding utf-8
syntax on
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
set hidden " Allow buffer switching without saving
set showmatch " Highlight matches on search
set winminheight=0 " Allow windows to collapse entirely
set spell " Enable spellcheck
set number " Enable line numbers
set nowrap " Don't wrap long lines
set lazyredraw " Speed up display
set ttyfast " Speed up display
" Highlight the current line
set cursorline
highlight CursorLine cterm=none ctermbg=8
" Show whitespace
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:.
autocmd BufNewFile,BufRead * :highlight BadForm ctermbg=11 ctermfg=8
autocmd BufNewFile,BufRead * :match BadForm /\s\+$/
" Highlight flex files like Javascript
au BufNewFile,BufRead *.mxml set filetype=javascript
au BufNewFile,BufRead *.as set filetype=javascript
" Highlight 80th collumn
set fo-=t
set colorcolumn=81
highlight ColorColumn ctermbg=0
" https://unix.stackexchange.com/a/383044
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
" Cursor =======================================================================
set mouse-=a " Disable visual selection with mouse
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
set iskeyword-=- " '-' is an end of word designator
set iskeyword-=_ " '-' is an end of word designator
set virtualedit=onemore " Allow for cursor beyond last character
" Restore cursor to file position in previous editing session
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" Autocomplete =================================================================
set wildmenu
set wildmode=list:longest,full
" Keybindings ==================================================================
set backspace=indent,eol,start
set whichwrap=b,s,h,l,<,>,[,]
set scrolljump=5
set scrolloff=3
nmap <silent> <leader>d :bp\|bd #<CR>
cmap w!! w !sudo tee % >/dev/null
nmap cp :let @+ = expand("%:p")<CR>
nnoremap gp `[v`]
" Tabs =========================================================================
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<cr>
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>tt :tabnext<cr>
" Splits =======================================================================
set splitright " Open new splits to right of current
set splitbelow " Open new splits below current
" Whitespace ===================================================================
" 4 space tabs
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent " Indent on paste
set smartindent " Indent intelligently
set nojoinspaces " Collapse spaces after sentences
" Don't exit visual mode when indenting
vnoremap < <gv
vnoremap > >gv
" Search =======================================================================
set ignorecase
set smartcase
set incsearch
set hlsearch
" Remove search highlights on Esc
nnoremap <silent> <esc> :noh<cr><esc>
" Metadata =====================================================================
set backup
set backupcopy=yes
set history=1000
set backupdir=$HOME/.vim/backups
set directory=$HOME/.vim/swaps
set undodir=$HOME/.vim/undo
if has('persistent_undo')
set undofile
set undolevels=1000
set undoreload=10000
endif
" Always switch to the current file directory
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
" Git ==========================================================================
" Instead of reverting the cursor to the last position in the buffer, we
" set it to the first line when editing a git commit message
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>